ArgumentsHost

Provides methods for retrieving the arguments being passed to a handler. Allows choosing the appropriate execution context (e.g., Http, RPC, or WebSockets) to retrieve the arguments from.


interface ArgumentsHost {
  getArgs<T extends Array<any> = any[]>(): T
  getArgByIndex<T = any>(index: number): T
  switchToRpc(): RpcArgumentsHost
  switchToHttp(): HttpArgumentsHost
  switchToWs(): WsArgumentsHost
  getType<TContext extends string = ContextType>(): TContext
}

Child interfaces

Methods

getArgs()

Returns the array of arguments being passed to the handler.


getArgs<T extends Array<any> = any[]>(): T

Parameters

There are no parameters.

Returns

T

getArgByIndex()

Returns a particular argument by index.


getArgByIndex<T = any>(index: number): T

Parameters

Option Type Description
index number

index of argument to retrieve

Returns

T

switchToRpc()

Switch context to RPC.


switchToRpc(): RpcArgumentsHost

Parameters

There are no parameters.

Returns

RpcArgumentsHost interface with methods to retrieve RPC arguments

switchToHttp()

Switch context to HTTP.


switchToHttp(): HttpArgumentsHost

Parameters

There are no parameters.

Returns

HttpArgumentsHost interface with methods to retrieve HTTP arguments

switchToWs()

Switch context to WebSockets.


switchToWs(): WsArgumentsHost

Parameters

There are no parameters.

Returns

WsArgumentsHost interface with methods to retrieve WebSockets arguments

getType()

Returns the current execution context type (string)


getType<TContext extends string = ContextType>(): TContext

Parameters

There are no parameters.

Returns

TContext