UNPKG

4.31 kBTypeScriptView Raw
1import type { CollectionProp, GetAppActionParams, GetAppActionsForEnvParams, GetAppDefinitionParams, QueryParams } from '../../common-types';
2import type { AppActionProps, CreateAppActionProps } from '../../entities/app-action';
3import type { OptionalDefaults } from '../wrappers/wrap';
4export type AppActionPlainClientAPI = {
5 /**
6 * Fetches the App Action
7 * @param params entity IDs to identify the App Action
8 * @returns the App Action
9 * @throws if the request fails, or the App Action is not found
10 * @example
11 * ```javascript
12 * const appAction = await client.appAction.get({
13 * organizationId: "<org_id>",
14 * appDefinitionId: "<app_definition_id>",
15 * appActionId: "<app_action_id>",
16 * });
17 * ```
18 */
19 get(params: OptionalDefaults<GetAppActionParams>): Promise<AppActionProps>;
20 /**
21 * Fetches all App Actions for the given App
22 * @param params entity IDs to identify the App
23 * @returns an object containing an array of App Actions
24 * @throws if the request fails, or the App is not found
25 * @example
26 * ```javascript
27 * const appActions = await client.appAction.getMany({
28 * organizationId: "<org_id>",
29 * appDefinitionId: "<app_definition_id>",
30 * });
31 * ```
32 */
33 getMany(params: OptionalDefaults<GetAppDefinitionParams & QueryParams>): Promise<CollectionProp<AppActionProps>>;
34 /**
35 * Fetches all App Actions for the given environment
36 * @param params entity IDs to identify the Environment
37 * @returns an object containing an array of App Actions
38 * @throws if the request fails, or the Environment is not found
39 * @example
40 * ```javascript
41 * const appActions = await client.appAction.getManyForEnvironment({
42 * spaceId: "<space_id>",
43 * environmentId: "<environment_id>",
44 * });
45 * ```
46 */
47 getManyForEnvironment(params: OptionalDefaults<GetAppActionsForEnvParams & QueryParams>): Promise<CollectionProp<AppActionProps>>;
48 /**
49 * Deletes the App Action
50 * @param params entity IDs to identify the App Action to delete
51 * @returns void
52 * @throws if the request fails, or the App Action is not found
53 * @example
54 * ```javascript
55 * await client.appAction.delete({
56 * organizationId: "<org_id>",
57 * appDefinitionId: "<app_definition_id>",
58 * appActionId: "<app_action_id>",
59 * });
60 * ```
61 */
62 delete(params: OptionalDefaults<GetAppActionParams>): Promise<void>;
63 /**
64 * Creates an App Action
65 * @param params entity IDs to scope where to create the App Action
66 * @param payload the App Action details
67 * @returns the created App Action and its metadata
68 * @throws if the request fails, an entity is not found, or the payload is malformed
69 * @example
70 * ```javascript
71 * const appAction = await client.appAction.create(
72 * {
73 * organizationId: "<org_id>",
74 * appDefinitionId: "<app_definition_id>",
75 * appActionId: "<app_action_id>",
76 * },
77 * {
78 * category: "Notification.v1.0",
79 * url: "https://www.somewhere-else.com/action",
80 * description: "sends a notification",
81 * name: "My Notification",
82 * }
83 * );
84 * ```
85 */
86 create(params: OptionalDefaults<GetAppDefinitionParams>, payload: CreateAppActionProps): Promise<AppActionProps>;
87 /**
88 * Updates an App Action
89 * @param params entity IDs to identify the App Action
90 * @param payload the App Action update
91 * @returns the updated App Action and its metadata
92 * @throws if the request fails, the App Action is not found, or the payload is malformed
93 * @example
94 * ```javascript
95 * const appAction = await client.appAction.update(
96 * {
97 * organizationId: "<org_id>",
98 * appDefinitionId: "<app_definition_id>",
99 * appActionId: "<app_action_id>",
100 * },
101 * {
102 * category: "Notification.v1.0",
103 * url: "https://www.somewhere-else.com/action",
104 * description: "sends a notification",
105 * name: "My Notification",
106 * }
107 * );
108 * ```
109 */
110 update(params: OptionalDefaults<GetAppActionParams>, payload: CreateAppActionProps): Promise<AppActionProps>;
111};