Skip to content

FunctionMethods

Methods available on function response objects. These are bound to the function data and delegate to the service.

Methods

invoke()

invoke<TInput, TOutput>(input?: TInput): Promise<TOutput>

Invokes this function and returns its output.

Type Parameters

Type Parameter Default type
TInput extends object Record<string, unknown>
TOutput unknown

Parameters

Parameter Type Description
input? TInput Input for the function, sent as the request body (or as query parameters for functions declared with the Get method). Defaults to an empty object.

Returns

Promise<TOutput>

Promise resolving to the function's output

Example

const deployed = await functions.getAll({ folderId: <folderId> });
const hello = deployed.items.find(f => f.name === 'hello');

if (hello) {
  const result = await hello.invoke({ name: 'Alice' });
}