Skip to content

Function: makeEmptyFormula

core.makeEmptyFormula

makeEmptyFormula<ParamDefsT>(definition): { cacheTtlSecs?: number ; connectionRequirement?: ConnectionRequirement ; description: string ; examples?: { params: (undefined | PackFormulaValue)[] ; result: PackFormulaResult }[] ; extraOAuthScopes?: string[] ; isAction?: boolean ; isExperimental?: boolean ; isSystem?: boolean ; name: string ; network?: Network ; parameters: ParamDefsT ; varargParameters?: ParamDefs } & { execute: (params: ParamValues<ParamDefsT>, context: ExecutionContext) => Promise<string> ; resultType: string }

Creates the definition of an "empty" formula, that is, a formula that uses a RequestHandlerTemplate to define an implementation for the formula rather than implementing an actual execute function in JavaScript.

Example

coda.makeEmptyFormula({
   name: "GetWidget",
   description: "Gets a widget.",
   request: {
     url: "https://example.com/widgets/{id}",
     method: "GET",
   },
   parameters: [
     coda.makeParameter({type: coda.ParameterType.Number, name: "id", description: "The ID of the widget to get."}),
   ],
 }),

Type parameters

Name Type
ParamDefsT extends ParamDefs

Parameters

Name Type
definition EmptyFormulaDef<ParamDefsT>

Returns

{ cacheTtlSecs?: number ; connectionRequirement?: ConnectionRequirement ; description: string ; examples?: { params: (undefined | PackFormulaValue)[] ; result: PackFormulaResult }[] ; extraOAuthScopes?: string[] ; isAction?: boolean ; isExperimental?: boolean ; isSystem?: boolean ; name: string ; network?: Network ; parameters: ParamDefsT ; varargParameters?: ParamDefs } & { execute: (params: ParamValues<ParamDefsT>, context: ExecutionContext) => Promise<string> ; resultType: string }

Defined in

api.ts:1786