UNPKG

3.72 kBTypeScriptView Raw
1import type { RawAxiosRequestHeaders } from 'axios';
2import type { CollectionProp, GetAppDefinitionParams, GetAppInstallationParams, GetSpaceEnvironmentParams, PaginationQueryParams } from '../../common-types';
3import type { AppInstallationsForOrganizationProps } from '../../entities/app-definition';
4import type { AppInstallationProps, CreateAppInstallationProps } from '../../entities/app-installation';
5import type { OptionalDefaults } from '../wrappers/wrap';
6export type AppInstallationPlainClientAPI = {
7 /**
8 * Fetches the App Installation
9 * @param params entity IDs to identify the App Installation
10 * @returns the App Installation
11 * @throws if the request fails, or the App Installation is not found
12 * @example
13 * ```javascript
14 * const appInstallation = await client.appInstallation.get({
15 * spaceId: '<space_id>',
16 * environmentId: '<environment_id>',
17 * appDefinitionId: '<app_definition_id>'
18 * });
19 * ```
20 */
21 get(params: OptionalDefaults<GetAppInstallationParams>): Promise<AppInstallationProps>;
22 /**
23 * Fetches all App Installations for the given App
24 * @param params entity IDs to identify the App
25 * @returns an object containing an array of App Installations
26 * @throws if the request fails, or the App is not found
27 * @example
28 * ```javascript
29 * const results = await client.appInstallation.getMany({
30 * organizationId: "<org_id>",
31 * appDefinitionId: "<app_definition_id>",
32 * });
33 * ```
34 */
35 getMany(params: OptionalDefaults<GetSpaceEnvironmentParams & PaginationQueryParams>): Promise<CollectionProp<AppInstallationProps>>;
36 /**
37 * Fetches all App Installations for the given Organization
38 * @param params entity IDs to identify the Organization
39 * @returns an object containing an array of App Installations
40 * @throws if the request fails, or the Organization is not found
41 * @example
42 * ```javascript
43 * const results = await client.appInstallation.getForOrganization({
44 * organizationId: '<organization_id>',
45 * appDefinitionId: '<app_definition_id>',
46 * });
47 * ```
48 */
49 getForOrganization(params: OptionalDefaults<GetAppDefinitionParams>): Promise<AppInstallationsForOrganizationProps>;
50 /**
51 * Creates or updates an App Installation
52 * @param params entity IDs to identify the App Installation to update, or the App to install
53 * @param rawData the App Installation
54 * @returns the created or updated App Installation and its metadata
55 * @throws if the request fails, the App or App Installation is not found, or the payload is malformed
56 * @example
57 * ```javascript
58 * const appInstallation = await client.appInstallation.upsert(
59 * {
60 * spaceId: '<space_id>',
61 * environmentId: '<environment_id>',
62 * appDefinitionId: '<app_definition_id>',
63 * },
64 * {
65 * parameters: {
66 * // freeform parameters
67 * },
68 * }
69 * );
70 * ```
71 */
72 upsert(params: OptionalDefaults<GetAppInstallationParams>, rawData: CreateAppInstallationProps, headers?: RawAxiosRequestHeaders): Promise<AppInstallationProps>;
73 /**
74 * Uninstalls the App
75 * @param params entity IDs to identify the App to uninstall
76 * @throws if the request fails, or the App Installation is not found
77 * @example
78 * ```javascript
79 * await client.appInstallation.delete({
80 * spaceId: '<space_id>',
81 * environmentId: '<environment_id>',
82 * appDefinitionId: '<app_definition_id>',
83 * });
84 * ```
85 */
86 delete(params: OptionalDefaults<GetAppInstallationParams>): Promise<any>;
87};