1 | import type { DefaultElements, BasicMetaSysProps, SysLink, MakeRequest } from '../common-types';
|
2 | import type { Except } from 'type-fest';
|
3 | import type { FreeFormParameters } from './widget-parameters';
|
4 | export type AppInstallationProps = {
|
5 | sys: Omit<BasicMetaSysProps, 'id'> & {
|
6 | appDefinition: SysLink;
|
7 | environment: SysLink;
|
8 | space: SysLink;
|
9 | };
|
10 | /**
|
11 | * Free-form installation parameters (API limits stringified length to 32KB)
|
12 | */
|
13 | parameters?: FreeFormParameters;
|
14 | };
|
15 | export type CreateAppInstallationProps = Except<AppInstallationProps, 'sys'>;
|
16 | export interface AppInstallation extends AppInstallationProps, DefaultElements<AppInstallationProps> {
|
17 | /**
|
18 | * Sends an update to the server with any changes made to the object's properties
|
19 | * @return Object returned from the server with updated changes.
|
20 | * @example ```javascript
|
21 | * const contentful = require('contentful-management')
|
22 | *
|
23 | * const client = contentful.createClient({
|
24 | * accessToken: '<content_management_api_key>'
|
25 | * })
|
26 | *
|
27 | * client.getSpace('<space_id>')
|
28 | * .then((space) => space.getEnvironment('<environment_id>'))
|
29 | * .then((environment) => environment.getAppInstallation('<app_definition_id>'))
|
30 | * .then((appInstallation) => {
|
31 | * appInstallation.parameters.someParameter = 'New Value'
|
32 | * return appInstallation.update()
|
33 | * })
|
34 | * .then((appInstallation) => console.log(`App installation ${appInstallation.sys.id} was updated`))
|
35 | * .catch(console.error)
|
36 | * ```
|
37 | */
|
38 | update(): Promise<AppInstallation>;
|
39 | /**
|
40 | * Deletes this object on the server.
|
41 | * @return Promise for the deletion. It contains no data, but the Promise error case should be handled.
|
42 | * @example ```javascript
|
43 | * const contentful = require('contentful-management')
|
44 | *
|
45 | * const client = contentful.createClient({
|
46 | * accessToken: '<content_management_api_key>'
|
47 | * })
|
48 | *
|
49 | * client.getSpace('<space_id>')
|
50 | * .then((space) => space.getEnvironment('<environment_id>'))
|
51 | * .then((environment) => environment.getAppInstallation('<app_definition_id>'))
|
52 | * .then((appInstallation) => appInstallation.delete())
|
53 | * .then(() => console.log(`App installation deleted.`))
|
54 | * .catch(console.error)
|
55 | * ```
|
56 | */
|
57 | delete(): Promise<void>;
|
58 | }
|
59 | /**
|
60 | * @private
|
61 | * @param makeRequest - function to make requests via an adapter
|
62 | * @param data - Raw App Installation data
|
63 | * @return Wrapped App installation data
|
64 | */
|
65 | export declare function wrapAppInstallation(makeRequest: MakeRequest, data: AppInstallationProps): AppInstallation;
|
66 | /**
|
67 | * @private
|
68 | */
|
69 | export declare const wrapAppInstallationCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<AppInstallationProps>) => import("../common-types").Collection<AppInstallation, AppInstallationProps>;
|