UNPKG

2.44 kBTypeScriptView Raw
1import type { RawAxiosRequestHeaders } from 'axios';
2import type { GetResourceProviderParams } from '../../common-types';
3import type { UpsertResourceProviderProps, ResourceProviderProps } from '../../entities/resource-provider';
4import type { OptionalDefaults } from '../wrappers/wrap';
5export type ResourceProviderPlainClientAPI = {
6 /**
7 * Fetch a Resource Provider
8 * @param params entity IDs to identify the Resource Provider
9 * @returns the App Definition config
10 * @throws if the request fails, or the Resource Provider is not found
11 * @example
12 * ```javascript
13 * const resourceProvider = await client.resourceProvider.get({
14 * organizationId: '<organization_id>',
15 * appDefinitionId: '<app_definition_id>',
16 * });
17 * ```
18 */
19 get(params: OptionalDefaults<GetResourceProviderParams>): Promise<ResourceProviderProps>;
20 /**
21 * Creates or updates a Resource Provider
22 * @param params entity IDs to identify the Resource Provider
23 * @param rawData the ResourceProvider
24 * @returns the created or updated Resource Provider
25 * @throws if the request fails, the App Definition or Resource Provider is not found, or the payload is malformed
26 * @example
27 * ```javascript
28 * // You need a valid AppDefinition with an activated AppBundle that has a contentful function configured
29 * const appInstallation = await client.resourceProvider.upsert(
30 * {
31 * organizationId: '<organization_id>',
32 * appDefinitionId: '<app_definition_id>',
33 * },
34 * {
35 * sys: { id: '<resource_provider_id>' },
36 * type: 'function',
37 * function: { sys: { id: '<contentful_function_id>', type: 'Link', linkType: 'Function' } },
38 * }
39 * );
40 * ```
41 */
42 upsert(params: OptionalDefaults<GetResourceProviderParams>, rawData: UpsertResourceProviderProps, headers?: RawAxiosRequestHeaders): Promise<ResourceProviderProps>;
43 /**
44 * Delete a ResourceProvider
45 * @param params entity IDs to identify the Resource Provider
46 * @throws if the request fails, or the Resource Provider is not found
47 * @example
48 * ```javascript
49 * await client.resourceProvider.delete({
50 * organizationId: '<organization_id>',
51 * appDefinitionId: '<app_definition_id>',
52 * });
53 * ```
54 */
55 delete(params: OptionalDefaults<GetResourceProviderParams>): Promise<any>;
56};