UNPKG

1.74 kBTypeScriptView Raw
1import type { Link, DefaultElements } from '../common-types';
2import type { MakeRequest } from '../common-types';
3import createFunctionApi from '../create-function-api';
4export type FunctionProps = {
5 sys: {
6 id: string;
7 type: 'Function';
8 createdBy: Link<'User'>;
9 createdAt: string;
10 updatedBy: Link<'User'>;
11 updatedAt: string;
12 organization: Link<'Organization'>;
13 appDefinition: Link<'AppDefinition'>;
14 };
15 name: string;
16 description: string;
17 path: string;
18 accepts: string[];
19 allowNetworks?: string[];
20};
21export interface Function extends FunctionProps, DefaultElements<FunctionProps> {
22}
23/**
24 * @private
25 * @param makeRequest - (real) function to make requests via an adapter
26 * @param data - raw contentful-Function data
27 * @return Wrapped Function data
28 */
29export declare function wrapFunction(makeRequest: MakeRequest, data: FunctionProps): FunctionProps & ReturnType<typeof createFunctionApi>;
30/**
31 * @private
32 * @param makeRequest - real) function to make requests via an adapter
33 * @param data - raw contentful-function data
34 * @return Wrapped App Function collection data
35 */
36export declare const wrapFunctionCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<FunctionProps>) => import("../common-types").Collection<FunctionProps & {
37 getManyFunctions(): Promise<import("../common-types").Collection<FunctionProps & any, FunctionProps>>;
38 getFunction(functionId: string): Promise<FunctionProps & any>;
39 getManyFunctionsForEnvironment(spaceId: string, environmentId: string, appInstallationId: string): Promise<import("../common-types").Collection<FunctionProps & any, FunctionProps>>;
40}, FunctionProps>;