UNPKG

1.05 kBTypeScriptView Raw
1import type { BasicMetaSysProps, DefaultElements, MakeRequest, SysLink } from '../common-types';
2export type ResourceProviderProps = {
3 /**
4 * System metadata
5 */
6 sys: Omit<BasicMetaSysProps, 'version'> & {
7 organization: SysLink;
8 appDefinition: SysLink;
9 };
10 /**
11 * Resource Provider type, value is 'function'
12 */
13 type: 'function';
14 /**
15 * Link to a Contentful function
16 */
17 function: SysLink;
18};
19export type UpsertResourceProviderProps = Omit<ResourceProviderProps, 'sys'> & {
20 sys: {
21 id: string;
22 };
23};
24export interface ResourceProvider extends ResourceProviderProps, DefaultElements<ResourceProviderProps> {
25 upsert(): Promise<ResourceProvider>;
26 delete(): Promise<void>;
27}
28/**
29 * @private
30 * @param makeRequest - function to make requests via an adapter
31 * @param data - Raw Resource Provider data
32 * @return Wrapped Resource Provider data
33 */
34export declare function wrapResourceProvider(makeRequest: MakeRequest, data: ResourceProviderProps): ResourceProvider;