Skip to main content

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)

nimble.addLocalServices(types)

nimble.addRemoteService(origin, type)

nimble.interceptCalls(interceptors)

nimble.interceptResults(interceptors)

nimble.interceptAllCalls(callback)

nimble.interceptAllResults(callback)

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
}
};