Skip to content

Interface: ResponseHandlerTemplate<T>

Defined in: handler_templates.ts:116

Configuration for how to handle the response for a code-free formula definition created using makeTranslateObjectFormula.

Type Parameters

Type Parameter
T extends Schema

Properties

projectKey?

optional projectKey: string

Defined in: handler_templates.ts:141

The key in the response body that indicates the objects of interest.

Sometimes the response body is itself an array of objects, allowing you to return the body as-is, but more commonly, the response body is an object where one of its properties is the array of objects of interest, with other properties containing metadata about the response.

This allows you to specify a response property name to "project" out the relevant part of the response body.

For example, suppose the response body looks like:

{
  items: [{name: "Alice"}, {name: "Bob"}],
  nextPageUrl: "/users?page=2",
}

You would set projectKey: "items" and the generated formula implementation will return response.body.items.


schema?

optional schema: T

Defined in: handler_templates.ts:118

The schema of the objects being returned.

Methods

onError()?

optional onError(error): any

Defined in: handler_templates.ts:146

If specified, will catch HTTP errors and call this function with the error, instead of letting them throw and the formula failing.

Parameters

Parameter Type
error Error

Returns

any