Client API
Reference
The following is the GenzyContainer class with all method signatures.
export class GenzyContainer {
constructor();
public addLocalService(type: Constructor): GenzyContainer;
public addLocalServices(...types: Constructor): GenzyContainer;
public addRemoteService(origin: string, type: Constructor): GenzyContainer;
public addRemoteServices(origin: string, ...types: Constructor): GenzyContainer;
public interceptCalls(customInterceptors: CustomInterceptors<InterceptorCallback>): GenzyContainer;
public interceptResults(customInterceptors: CustomInterceptors<InterceptorCallback>): GenzyContainer;
public interceptAllCalls(callback: InterceptorCallback): GenzyContainer;
public interceptAllResults(callback: InterceptorCallback): GenzyContainer;
public getAllServices(): any;
}
new GenzyContainer()
- Creates a new instance of GenzyContainer.
nimble.addLocalService(type)
Registers a
localservice class to the nimble.type<Constructor>
nimble.addLocalServices(types)
Registers
localservice classes to the nimble.types<Constructor>[]
nimble.addRemoteService(origin, type)
Registers a
remoteservice class to the nimble.origin<string>type<Constructor>Registers
remoteservice classes to the nimble.origin<string>types<Constructor>[]
nimble.interceptCalls(interceptors)
Registers a set of custom Client interceptors that execute
beforeeach request.interceptors<CustomInterceptors>
nimble.interceptResults(interceptors)
Registers a set of custom Client interceptors that execute
aftereach request.interceptors<CustomInterceptors>
nimble.interceptAllCalls(callback)
Registers a custom Client interceptor that executes
beforeall requests.callback<InterceptorCallback>
nimble.interceptAllResults(callback)
Registers a custom Client interceptor that executes
afterall requests.callback<InterceptorCallback>
nimble.getAllServices()
- Returns GenzyContainer's service registry.
Types
Constructor
interface Constructor {
new (...args: any[]);
}
GenzyInfo
type GenzyInfo = {
version?: string;
name?: string;
description?: string;
basePath?: string;
}
InterceptorCallback
type InterceptorCallback = ({setHeader, getHeader, setBody, getBody}:
{setHeader: (key: string, value: string) => any, getHeader: (key: string) => string, setBody: (body: any) => any, getBody: () => any}) => any;
CustomInterceptors
type CustomInterceptors<TInterceptorCallback> = {
[classKey: string]: {
[methodKey: string]: TInterceptorCallback
}
};