@knocklabs/node 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +1 -1
- package/api-promise.js +2 -15
- package/api-promise.js.map +1 -1
- package/client.d.mts +4 -1
- package/client.d.mts.map +1 -1
- package/client.d.ts +4 -1
- package/client.d.ts.map +1 -1
- package/client.js +27 -44
- package/client.js.map +1 -1
- package/client.mjs +18 -12
- package/client.mjs.map +1 -1
- package/core/api-promise.d.mts +0 -1
- package/core/api-promise.d.mts.map +1 -1
- package/core/api-promise.d.ts +0 -1
- package/core/api-promise.d.ts.map +1 -1
- package/core/api-promise.js +4 -14
- package/core/api-promise.js.map +1 -1
- package/core/api-promise.mjs +1 -11
- package/core/api-promise.mjs.map +1 -1
- package/core/error.d.mts +0 -1
- package/core/error.d.mts.map +1 -1
- package/core/error.d.ts +0 -1
- package/core/error.d.ts.map +1 -1
- package/core/error.js.map +1 -1
- package/core/error.mjs.map +1 -1
- package/core/pagination.d.mts +0 -1
- package/core/pagination.d.mts.map +1 -1
- package/core/pagination.d.ts +0 -1
- package/core/pagination.d.ts.map +1 -1
- package/core/pagination.js +3 -13
- package/core/pagination.js.map +1 -1
- package/core/pagination.mjs +1 -11
- package/core/pagination.mjs.map +1 -1
- package/error.js +2 -15
- package/error.js.map +1 -1
- package/internal/builtin-types.d.mts +0 -2
- package/internal/builtin-types.d.mts.map +1 -1
- package/internal/builtin-types.d.ts +0 -2
- package/internal/builtin-types.d.ts.map +1 -1
- package/internal/detect-platform.js.map +1 -1
- package/internal/detect-platform.mjs.map +1 -1
- package/internal/errors.d.mts.map +1 -1
- package/internal/errors.d.ts.map +1 -1
- package/internal/errors.js +2 -2
- package/internal/errors.js.map +1 -1
- package/internal/errors.mjs.map +1 -1
- package/internal/headers.d.mts +0 -1
- package/internal/headers.d.mts.map +1 -1
- package/internal/headers.d.ts +0 -1
- package/internal/headers.d.ts.map +1 -1
- package/internal/headers.js +1 -1
- package/internal/headers.js.map +1 -1
- package/internal/headers.mjs +1 -1
- package/internal/headers.mjs.map +1 -1
- package/internal/parse.d.mts +0 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts +0 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +1 -2
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs.map +1 -1
- package/internal/qs/stringify.js +1 -2
- package/internal/qs/stringify.js.map +1 -1
- package/internal/qs/stringify.mjs.map +1 -1
- package/internal/qs/utils.js +9 -9
- package/internal/qs/utils.js.map +1 -1
- package/internal/qs/utils.mjs.map +1 -1
- package/internal/request-options.d.mts +0 -1
- package/internal/request-options.d.mts.map +1 -1
- package/internal/request-options.d.ts +0 -1
- package/internal/request-options.d.ts.map +1 -1
- package/internal/shims.js +5 -6
- package/internal/shims.js.map +1 -1
- package/internal/shims.mjs.map +1 -1
- package/internal/to-file.d.mts +0 -1
- package/internal/to-file.d.mts.map +1 -1
- package/internal/to-file.d.ts +0 -1
- package/internal/to-file.d.ts.map +1 -1
- package/internal/to-file.js +4 -4
- package/internal/to-file.js.map +1 -1
- package/internal/to-file.mjs +3 -2
- package/internal/to-file.mjs.map +1 -1
- package/internal/tslib.js +81 -0
- package/internal/tslib.mjs +17 -0
- package/internal/types.d.mts +0 -1
- package/internal/types.d.mts.map +1 -1
- package/internal/types.d.ts +0 -1
- package/internal/types.d.ts.map +1 -1
- package/internal/uploads.d.mts +1 -3
- package/internal/uploads.d.mts.map +1 -1
- package/internal/uploads.d.ts +1 -3
- package/internal/uploads.d.ts.map +1 -1
- package/internal/uploads.js +16 -6
- package/internal/uploads.js.map +1 -1
- package/internal/uploads.mjs +12 -3
- package/internal/uploads.mjs.map +1 -1
- package/internal/utils/base64.d.mts.map +1 -1
- package/internal/utils/base64.d.ts.map +1 -1
- package/internal/utils/base64.js.map +1 -1
- package/internal/utils/base64.mjs.map +1 -1
- package/internal/utils/bytes.d.mts +1 -1
- package/internal/utils/bytes.d.mts.map +1 -1
- package/internal/utils/bytes.d.ts +1 -1
- package/internal/utils/bytes.d.ts.map +1 -1
- package/internal/utils/bytes.js +3 -4
- package/internal/utils/bytes.js.map +1 -1
- package/internal/utils/bytes.mjs.map +1 -1
- package/internal/utils/env.d.mts.map +1 -1
- package/internal/utils/env.d.ts.map +1 -1
- package/internal/utils/env.js.map +1 -1
- package/internal/utils/env.mjs.map +1 -1
- package/internal/utils/log.d.mts +0 -1
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts +0 -1
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.js +2 -2
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs.map +1 -1
- package/internal/utils/path.d.mts.map +1 -1
- package/internal/utils/path.d.ts.map +1 -1
- package/internal/utils/path.js +2 -2
- package/internal/utils/path.js.map +1 -1
- package/internal/utils/path.mjs.map +1 -1
- package/internal/utils/sleep.d.mts.map +1 -1
- package/internal/utils/sleep.d.ts.map +1 -1
- package/internal/utils/uuid.d.mts +1 -1
- package/internal/utils/uuid.d.mts.map +1 -1
- package/internal/utils/uuid.d.ts +1 -1
- package/internal/utils/uuid.d.ts.map +1 -1
- package/internal/utils/uuid.js +1 -2
- package/internal/utils/uuid.js.map +1 -1
- package/internal/utils/uuid.mjs +1 -2
- package/internal/utils/uuid.mjs.map +1 -1
- package/internal/utils/values.d.mts.map +1 -1
- package/internal/utils/values.d.ts.map +1 -1
- package/internal/utils/values.js +5 -5
- package/internal/utils/values.js.map +1 -1
- package/internal/utils/values.mjs.map +1 -1
- package/internal/utils.js +7 -20
- package/internal/utils.js.map +1 -1
- package/lib/index.js +3 -16
- package/lib/index.js.map +1 -1
- package/lib/tokenSigner.js +5 -28
- package/lib/tokenSigner.js.map +1 -1
- package/lib/tokenSigner.mjs.map +1 -1
- package/lib/userTokens.js +1 -1
- package/lib/userTokens.js.map +1 -1
- package/package.json +2 -6
- package/pagination.js +2 -15
- package/pagination.js.map +1 -1
- package/resource.js +2 -15
- package/resource.js.map +1 -1
- package/resources/audiences.d.mts +37 -0
- package/resources/audiences.d.mts.map +1 -1
- package/resources/audiences.d.ts +37 -0
- package/resources/audiences.d.ts.map +1 -1
- package/resources/audiences.js +25 -0
- package/resources/audiences.js.map +1 -1
- package/resources/audiences.mjs +25 -0
- package/resources/audiences.mjs.map +1 -1
- package/resources/bulk-operations.d.mts +7 -0
- package/resources/bulk-operations.d.mts.map +1 -1
- package/resources/bulk-operations.d.ts +7 -0
- package/resources/bulk-operations.d.ts.map +1 -1
- package/resources/bulk-operations.js +7 -0
- package/resources/bulk-operations.js.map +1 -1
- package/resources/bulk-operations.mjs +7 -0
- package/resources/bulk-operations.mjs.map +1 -1
- package/resources/channels/bulk.d.mts +21 -0
- package/resources/channels/bulk.d.mts.map +1 -1
- package/resources/channels/bulk.d.ts +21 -0
- package/resources/channels/bulk.d.ts.map +1 -1
- package/resources/channels/bulk.js +21 -0
- package/resources/channels/bulk.js.map +1 -1
- package/resources/channels/bulk.mjs +21 -0
- package/resources/channels/bulk.mjs.map +1 -1
- package/resources/channels/channels.js +2 -24
- package/resources/channels/channels.js.map +1 -1
- package/resources/channels.js +2 -15
- package/resources/channels.js.map +1 -1
- package/resources/integrations/integrations.js +3 -25
- package/resources/integrations/integrations.js.map +1 -1
- package/resources/integrations.js +2 -15
- package/resources/integrations.js.map +1 -1
- package/resources/messages/batch.d.mts +76 -0
- package/resources/messages/batch.d.mts.map +1 -1
- package/resources/messages/batch.d.ts +76 -0
- package/resources/messages/batch.d.ts.map +1 -1
- package/resources/messages/batch.js +76 -0
- package/resources/messages/batch.js.map +1 -1
- package/resources/messages/batch.mjs +76 -0
- package/resources/messages/batch.mjs.map +1 -1
- package/resources/messages/index.d.mts +0 -1
- package/resources/messages/index.d.mts.map +1 -1
- package/resources/messages/index.d.ts +0 -1
- package/resources/messages/index.d.ts.map +1 -1
- package/resources/messages/index.js +1 -3
- package/resources/messages/index.js.map +1 -1
- package/resources/messages/index.mjs +0 -1
- package/resources/messages/index.mjs.map +1 -1
- package/resources/messages/messages.d.mts +101 -4
- package/resources/messages/messages.d.mts.map +1 -1
- package/resources/messages/messages.d.ts +101 -4
- package/resources/messages/messages.d.ts.map +1 -1
- package/resources/messages/messages.js +103 -28
- package/resources/messages/messages.js.map +1 -1
- package/resources/messages/messages.mjs +101 -4
- package/resources/messages/messages.mjs.map +1 -1
- package/resources/messages.js +2 -15
- package/resources/messages.js.map +1 -1
- package/resources/objects/bulk.d.mts +49 -0
- package/resources/objects/bulk.d.mts.map +1 -1
- package/resources/objects/bulk.d.ts +49 -0
- package/resources/objects/bulk.d.ts.map +1 -1
- package/resources/objects/bulk.js +49 -0
- package/resources/objects/bulk.js.map +1 -1
- package/resources/objects/bulk.mjs +49 -0
- package/resources/objects/bulk.mjs.map +1 -1
- package/resources/objects/objects.d.mts +179 -5
- package/resources/objects/objects.d.mts.map +1 -1
- package/resources/objects/objects.d.ts +179 -5
- package/resources/objects/objects.d.ts.map +1 -1
- package/resources/objects/objects.js +173 -24
- package/resources/objects/objects.js.map +1 -1
- package/resources/objects/objects.mjs +171 -0
- package/resources/objects/objects.mjs.map +1 -1
- package/resources/objects.js +2 -15
- package/resources/objects.js.map +1 -1
- package/resources/providers/ms-teams.d.mts +40 -0
- package/resources/providers/ms-teams.d.mts.map +1 -1
- package/resources/providers/ms-teams.d.ts +40 -0
- package/resources/providers/ms-teams.d.ts.map +1 -1
- package/resources/providers/ms-teams.js +40 -0
- package/resources/providers/ms-teams.js.map +1 -1
- package/resources/providers/ms-teams.mjs +40 -0
- package/resources/providers/ms-teams.mjs.map +1 -1
- package/resources/providers/providers.js +3 -25
- package/resources/providers/providers.js.map +1 -1
- package/resources/providers/slack.d.mts +27 -0
- package/resources/providers/slack.d.mts.map +1 -1
- package/resources/providers/slack.d.ts +27 -0
- package/resources/providers/slack.d.ts.map +1 -1
- package/resources/providers/slack.js +27 -0
- package/resources/providers/slack.js.map +1 -1
- package/resources/providers/slack.mjs +27 -0
- package/resources/providers/slack.mjs.map +1 -1
- package/resources/providers.js +2 -15
- package/resources/providers.js.map +1 -1
- package/resources/recipients/channel-data.d.mts +1 -1
- package/resources/recipients/channel-data.d.mts.map +1 -1
- package/resources/recipients/channel-data.d.ts +1 -1
- package/resources/recipients/channel-data.d.ts.map +1 -1
- package/resources/recipients/recipients.js +4 -26
- package/resources/recipients/recipients.js.map +1 -1
- package/resources/recipients.js +2 -15
- package/resources/recipients.js.map +1 -1
- package/resources/schedules/bulk.d.mts +30 -0
- package/resources/schedules/bulk.d.mts.map +1 -1
- package/resources/schedules/bulk.d.ts +30 -0
- package/resources/schedules/bulk.d.ts.map +1 -1
- package/resources/schedules/bulk.js +30 -0
- package/resources/schedules/bulk.js.map +1 -1
- package/resources/schedules/bulk.mjs +30 -0
- package/resources/schedules/bulk.mjs.map +1 -1
- package/resources/schedules/schedules.d.mts +75 -2
- package/resources/schedules/schedules.d.mts.map +1 -1
- package/resources/schedules/schedules.d.ts +75 -2
- package/resources/schedules/schedules.d.ts.map +1 -1
- package/resources/schedules/schedules.js +76 -24
- package/resources/schedules/schedules.js.map +1 -1
- package/resources/schedules/schedules.mjs +74 -0
- package/resources/schedules/schedules.mjs.map +1 -1
- package/resources/schedules.js +2 -15
- package/resources/schedules.js.map +1 -1
- package/resources/tenants/bulk.d.mts +14 -0
- package/resources/tenants/bulk.d.mts.map +1 -1
- package/resources/tenants/bulk.d.ts +14 -0
- package/resources/tenants/bulk.d.ts.map +1 -1
- package/resources/tenants/bulk.js +14 -0
- package/resources/tenants/bulk.js.map +1 -1
- package/resources/tenants/bulk.mjs +14 -0
- package/resources/tenants/bulk.mjs.map +1 -1
- package/resources/tenants/tenants.d.mts +33 -0
- package/resources/tenants/tenants.d.mts.map +1 -1
- package/resources/tenants/tenants.d.ts +33 -0
- package/resources/tenants/tenants.d.ts.map +1 -1
- package/resources/tenants/tenants.js +35 -24
- package/resources/tenants/tenants.js.map +1 -1
- package/resources/tenants/tenants.mjs +33 -0
- package/resources/tenants/tenants.mjs.map +1 -1
- package/resources/tenants.js +2 -15
- package/resources/tenants.js.map +1 -1
- package/resources/users/bulk.d.mts +41 -0
- package/resources/users/bulk.d.mts.map +1 -1
- package/resources/users/bulk.d.ts +41 -0
- package/resources/users/bulk.d.ts.map +1 -1
- package/resources/users/bulk.js +41 -0
- package/resources/users/bulk.js.map +1 -1
- package/resources/users/bulk.mjs +41 -0
- package/resources/users/bulk.mjs.map +1 -1
- package/resources/users/feeds.d.mts +19 -0
- package/resources/users/feeds.d.mts.map +1 -1
- package/resources/users/feeds.d.ts +19 -0
- package/resources/users/feeds.d.ts.map +1 -1
- package/resources/users/feeds.js +19 -0
- package/resources/users/feeds.js.map +1 -1
- package/resources/users/feeds.mjs +19 -0
- package/resources/users/feeds.mjs.map +1 -1
- package/resources/users/guides.d.mts +68 -0
- package/resources/users/guides.d.mts.map +1 -1
- package/resources/users/guides.d.ts +68 -0
- package/resources/users/guides.d.ts.map +1 -1
- package/resources/users/guides.js +68 -0
- package/resources/users/guides.js.map +1 -1
- package/resources/users/guides.mjs +68 -0
- package/resources/users/guides.mjs.map +1 -1
- package/resources/users/users.d.mts +182 -15
- package/resources/users/users.d.mts.map +1 -1
- package/resources/users/users.d.ts +182 -15
- package/resources/users/users.d.ts.map +1 -1
- package/resources/users/users.js +143 -26
- package/resources/users/users.js.map +1 -1
- package/resources/users/users.mjs +139 -0
- package/resources/users/users.mjs.map +1 -1
- package/resources/users.js +2 -15
- package/resources/users.js.map +1 -1
- package/resources/workflows.d.mts +30 -0
- package/resources/workflows.d.mts.map +1 -1
- package/resources/workflows.d.ts +30 -0
- package/resources/workflows.d.ts.map +1 -1
- package/resources/workflows.js +30 -0
- package/resources/workflows.js.map +1 -1
- package/resources/workflows.mjs +30 -0
- package/resources/workflows.mjs.map +1 -1
- package/resources.js +2 -15
- package/resources.js.map +1 -1
- package/src/client.ts +17 -0
- package/src/internal/headers.ts +1 -1
- package/src/internal/to-file.ts +4 -2
- package/src/internal/uploads.ts +16 -4
- package/src/internal/utils/uuid.ts +1 -3
- package/src/resources/audiences.ts +37 -0
- package/src/resources/bulk-operations.ts +7 -0
- package/src/resources/channels/bulk.ts +21 -0
- package/src/resources/messages/batch.ts +76 -0
- package/src/resources/messages/index.ts +0 -1
- package/src/resources/messages/messages.ts +101 -6
- package/src/resources/objects/bulk.ts +49 -0
- package/src/resources/objects/objects.ts +179 -5
- package/src/resources/providers/ms-teams.ts +40 -0
- package/src/resources/providers/slack.ts +27 -0
- package/src/resources/recipients/channel-data.ts +4 -1
- package/src/resources/schedules/bulk.ts +30 -0
- package/src/resources/schedules/schedules.ts +75 -2
- package/src/resources/tenants/bulk.ts +14 -0
- package/src/resources/tenants/tenants.ts +33 -0
- package/src/resources/users/bulk.ts +41 -0
- package/src/resources/users/feeds.ts +19 -0
- package/src/resources/users/guides.ts +68 -0
- package/src/resources/users/users.ts +188 -15
- package/src/resources/workflows.ts +30 -0
- package/src/version.ts +1 -1
- package/uploads.js +2 -15
- package/uploads.js.map +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/internal/shims/crypto.d.mts +0 -13
- package/internal/shims/crypto.d.mts.map +0 -1
- package/internal/shims/crypto.d.ts +0 -13
- package/internal/shims/crypto.d.ts.map +0 -1
- package/internal/shims/crypto.js +0 -13
- package/internal/shims/crypto.js.map +0 -1
- package/internal/shims/crypto.mjs +0 -9
- package/internal/shims/crypto.mjs.map +0 -1
- package/internal/shims/file.d.mts +0 -23
- package/internal/shims/file.d.mts.map +0 -1
- package/internal/shims/file.d.ts +0 -23
- package/internal/shims/file.d.ts.map +0 -1
- package/internal/shims/file.js +0 -16
- package/internal/shims/file.js.map +0 -1
- package/internal/shims/file.mjs +0 -12
- package/internal/shims/file.mjs.map +0 -1
- package/internal/shims/getBuiltinModule.d.mts +0 -11
- package/internal/shims/getBuiltinModule.d.mts.map +0 -1
- package/internal/shims/getBuiltinModule.d.ts +0 -11
- package/internal/shims/getBuiltinModule.d.ts.map +0 -1
- package/internal/shims/getBuiltinModule.js +0 -71
- package/internal/shims/getBuiltinModule.js.map +0 -1
- package/internal/shims/getBuiltinModule.mjs +0 -67
- package/internal/shims/getBuiltinModule.mjs.map +0 -1
- package/internal/shims/nullGetBuiltinModule.d.mts +0 -2
- package/internal/shims/nullGetBuiltinModule.d.mts.map +0 -1
- package/internal/shims/nullGetBuiltinModule.d.ts +0 -2
- package/internal/shims/nullGetBuiltinModule.d.ts.map +0 -1
- package/internal/shims/nullGetBuiltinModule.js +0 -5
- package/internal/shims/nullGetBuiltinModule.js.map +0 -1
- package/internal/shims/nullGetBuiltinModule.mjs +0 -2
- package/internal/shims/nullGetBuiltinModule.mjs.map +0 -1
- package/resources/messages/activities.d.mts +0 -22
- package/resources/messages/activities.d.mts.map +0 -1
- package/resources/messages/activities.d.ts +0 -22
- package/resources/messages/activities.d.ts.map +0 -1
- package/resources/messages/activities.js +0 -17
- package/resources/messages/activities.js.map +0 -1
- package/resources/messages/activities.mjs +0 -13
- package/resources/messages/activities.mjs.map +0 -1
- package/src/internal/shims/crypto.ts +0 -18
- package/src/internal/shims/file.ts +0 -32
- package/src/internal/shims/getBuiltinModule.ts +0 -66
- package/src/internal/shims/nullGetBuiltinModule.ts +0 -1
- package/src/resources/messages/activities.ts +0 -38
package/resources/workflows.d.ts
CHANGED
|
@@ -8,6 +8,14 @@ export declare class Workflows extends APIResource {
|
|
|
8
8
|
* When invoked for a workflow using a specific workflow key and cancellation key,
|
|
9
9
|
* will cancel any queued workflow runs associated with that key/cancellation key
|
|
10
10
|
* pair. Can optionally be provided one or more recipients to scope the request to.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const response = await client.workflows.cancel('key', {
|
|
15
|
+
* cancellation_key: 'cancel-workflow-123',
|
|
16
|
+
* recipients: ['jhammond'],
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
11
19
|
*/
|
|
12
20
|
cancel(key: string, body: WorkflowCancelParams, options?: RequestOptions): APIPromise<string>;
|
|
13
21
|
/**
|
|
@@ -16,6 +24,28 @@ export declare class Workflows extends APIResource {
|
|
|
16
24
|
* workflow runs are executed asynchronously. This endpoint also handles
|
|
17
25
|
* [inline identifications](/managing-recipients/identifying-recipients#inline-identifying-recipients)
|
|
18
26
|
* for the `actor`, `recipient`, and `tenant` fields.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const response = await client.workflows.trigger('key', {
|
|
31
|
+
* recipients: ['dr_grant', 'dr_sattler', 'dr_malcolm'],
|
|
32
|
+
* actor: 'mr_dna',
|
|
33
|
+
* cancellation_key: 'isla_nublar_incident_1993',
|
|
34
|
+
* data: {
|
|
35
|
+
* affected_areas: [
|
|
36
|
+
* 'visitor_center',
|
|
37
|
+
* 'raptor_pen',
|
|
38
|
+
* 'trex_paddock',
|
|
39
|
+
* ],
|
|
40
|
+
* attraction_id: 'paddock_rex_01',
|
|
41
|
+
* evacuation_protocol: 'active',
|
|
42
|
+
* message: 'Life finds a way',
|
|
43
|
+
* severity: 'critical',
|
|
44
|
+
* system_status: 'fences_failing',
|
|
45
|
+
* },
|
|
46
|
+
* tenant: 'ingen_isla_nublar',
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
19
49
|
*/
|
|
20
50
|
trigger(key: string, body: WorkflowTriggerParams, options?: RequestOptions): APIPromise<WorkflowTriggerResponse>;
|
|
21
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../src/resources/workflows.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,aAAa;OAClB,KAAK,UAAU;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,SAAU,SAAQ,WAAW;IACxC
|
|
1
|
+
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../src/resources/workflows.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,aAAa;OAClB,KAAK,UAAU;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,SAAU,SAAQ,WAAW;IACxC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;IAI7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,OAAO,CACL,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,qBAAqB,EAC3B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,uBAAuB,CAAC;CAGvC;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC;CAC7D;AAED,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAElD;;;;OAIG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAE9C;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAEtC;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC,mBAAmB,GAAG,IAAI,CAAC;CAChD;AAED,MAAM,CAAC,OAAO,WAAW,SAAS,CAAC;IACjC,OAAO,EACL,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,qBAAqB,IAAI,qBAAqB,GACpD,CAAC;CACH"}
|
package/resources/workflows.js
CHANGED
|
@@ -9,6 +9,14 @@ class Workflows extends resource_1.APIResource {
|
|
|
9
9
|
* When invoked for a workflow using a specific workflow key and cancellation key,
|
|
10
10
|
* will cancel any queued workflow runs associated with that key/cancellation key
|
|
11
11
|
* pair. Can optionally be provided one or more recipients to scope the request to.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const response = await client.workflows.cancel('key', {
|
|
16
|
+
* cancellation_key: 'cancel-workflow-123',
|
|
17
|
+
* recipients: ['jhammond'],
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
12
20
|
*/
|
|
13
21
|
cancel(key, body, options) {
|
|
14
22
|
return this._client.post((0, path_1.path) `/v1/workflows/${key}/cancel`, { body, ...options });
|
|
@@ -19,6 +27,28 @@ class Workflows extends resource_1.APIResource {
|
|
|
19
27
|
* workflow runs are executed asynchronously. This endpoint also handles
|
|
20
28
|
* [inline identifications](/managing-recipients/identifying-recipients#inline-identifying-recipients)
|
|
21
29
|
* for the `actor`, `recipient`, and `tenant` fields.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const response = await client.workflows.trigger('key', {
|
|
34
|
+
* recipients: ['dr_grant', 'dr_sattler', 'dr_malcolm'],
|
|
35
|
+
* actor: 'mr_dna',
|
|
36
|
+
* cancellation_key: 'isla_nublar_incident_1993',
|
|
37
|
+
* data: {
|
|
38
|
+
* affected_areas: [
|
|
39
|
+
* 'visitor_center',
|
|
40
|
+
* 'raptor_pen',
|
|
41
|
+
* 'trex_paddock',
|
|
42
|
+
* ],
|
|
43
|
+
* attraction_id: 'paddock_rex_01',
|
|
44
|
+
* evacuation_protocol: 'active',
|
|
45
|
+
* message: 'Life finds a way',
|
|
46
|
+
* severity: 'critical',
|
|
47
|
+
* system_status: 'fences_failing',
|
|
48
|
+
* },
|
|
49
|
+
* tenant: 'ingen_isla_nublar',
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
22
52
|
*/
|
|
23
53
|
trigger(key, body, options) {
|
|
24
54
|
return this._client.post((0, path_1.path) `/v1/workflows/${key}/trigger`, { body, ...options });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.js","sourceRoot":"","sources":["../src/resources/workflows.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAK/C,oDAA8C;AAE9C,MAAa,SAAU,SAAQ,sBAAW;IACxC
|
|
1
|
+
{"version":3,"file":"workflows.js","sourceRoot":"","sources":["../src/resources/workflows.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAK/C,oDAA8C;AAE9C,MAAa,SAAU,SAAQ,sBAAW;IACxC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,GAAW,EAAE,IAA0B,EAAE,OAAwB;QACtE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,iBAAiB,GAAG,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACpF,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,OAAO,CACL,GAAW,EACX,IAA2B,EAC3B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,iBAAiB,GAAG,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrF,CAAC;CACF;AAtDD,8BAsDC"}
|
package/resources/workflows.mjs
CHANGED
|
@@ -6,6 +6,14 @@ export class Workflows extends APIResource {
|
|
|
6
6
|
* When invoked for a workflow using a specific workflow key and cancellation key,
|
|
7
7
|
* will cancel any queued workflow runs associated with that key/cancellation key
|
|
8
8
|
* pair. Can optionally be provided one or more recipients to scope the request to.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const response = await client.workflows.cancel('key', {
|
|
13
|
+
* cancellation_key: 'cancel-workflow-123',
|
|
14
|
+
* recipients: ['jhammond'],
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
9
17
|
*/
|
|
10
18
|
cancel(key, body, options) {
|
|
11
19
|
return this._client.post(path `/v1/workflows/${key}/cancel`, { body, ...options });
|
|
@@ -16,6 +24,28 @@ export class Workflows extends APIResource {
|
|
|
16
24
|
* workflow runs are executed asynchronously. This endpoint also handles
|
|
17
25
|
* [inline identifications](/managing-recipients/identifying-recipients#inline-identifying-recipients)
|
|
18
26
|
* for the `actor`, `recipient`, and `tenant` fields.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const response = await client.workflows.trigger('key', {
|
|
31
|
+
* recipients: ['dr_grant', 'dr_sattler', 'dr_malcolm'],
|
|
32
|
+
* actor: 'mr_dna',
|
|
33
|
+
* cancellation_key: 'isla_nublar_incident_1993',
|
|
34
|
+
* data: {
|
|
35
|
+
* affected_areas: [
|
|
36
|
+
* 'visitor_center',
|
|
37
|
+
* 'raptor_pen',
|
|
38
|
+
* 'trex_paddock',
|
|
39
|
+
* ],
|
|
40
|
+
* attraction_id: 'paddock_rex_01',
|
|
41
|
+
* evacuation_protocol: 'active',
|
|
42
|
+
* message: 'Life finds a way',
|
|
43
|
+
* severity: 'critical',
|
|
44
|
+
* system_status: 'fences_failing',
|
|
45
|
+
* },
|
|
46
|
+
* tenant: 'ingen_isla_nublar',
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
19
49
|
*/
|
|
20
50
|
trigger(key, body, options) {
|
|
21
51
|
return this._client.post(path `/v1/workflows/${key}/trigger`, { body, ...options });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.mjs","sourceRoot":"","sources":["../src/resources/workflows.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAKf,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,SAAU,SAAQ,WAAW;IACxC
|
|
1
|
+
{"version":3,"file":"workflows.mjs","sourceRoot":"","sources":["../src/resources/workflows.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAKf,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,SAAU,SAAQ,WAAW;IACxC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,GAAW,EAAE,IAA0B,EAAE,OAAwB;QACtE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,iBAAiB,GAAG,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACpF,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,OAAO,CACL,GAAW,EACX,IAA2B,EAC3B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,iBAAiB,GAAG,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrF,CAAC;CACF"}
|
package/resources.js
CHANGED
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
3
|
+
const tslib_1 = require("./internal/tslib.js");
|
|
4
|
+
tslib_1.__exportStar(require("./resources/index.js"), exports);
|
|
18
5
|
//# sourceMappingURL=resources.js.map
|
package/resources.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.js","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["src/resources.ts"],"names":[],"mappings":";;;AAAA,+DAAkC"}
|
package/src/client.ts
CHANGED
|
@@ -283,6 +283,23 @@ export class Knock {
|
|
|
283
283
|
this.apiKey = apiKey;
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
+
/**
|
|
287
|
+
* Create a new client instance re-using the same options given to the current client with optional overriding.
|
|
288
|
+
*/
|
|
289
|
+
withOptions(options: Partial<ClientOptions>): this {
|
|
290
|
+
return new (this.constructor as any as new (props: ClientOptions) => typeof this)({
|
|
291
|
+
...this._options,
|
|
292
|
+
baseURL: this.baseURL,
|
|
293
|
+
maxRetries: this.maxRetries,
|
|
294
|
+
timeout: this.timeout,
|
|
295
|
+
logger: this.logger,
|
|
296
|
+
logLevel: this.logLevel,
|
|
297
|
+
fetchOptions: this.fetchOptions,
|
|
298
|
+
apiKey: this.apiKey,
|
|
299
|
+
...options,
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
|
|
286
303
|
protected defaultQuery(): Record<string, string | undefined> | undefined {
|
|
287
304
|
return this._options.defaultQuery;
|
|
288
305
|
}
|
package/src/internal/headers.ts
CHANGED
|
@@ -71,8 +71,8 @@ function* iterateHeaders(headers: HeadersLike): IterableIterator<readonly [strin
|
|
|
71
71
|
export const buildHeaders = (newHeaders: HeadersLike[]): NullableHeaders => {
|
|
72
72
|
const targetHeaders = new Headers();
|
|
73
73
|
const nullHeaders = new Set<string>();
|
|
74
|
-
const seenHeaders = new Set<string>();
|
|
75
74
|
for (const headers of newHeaders) {
|
|
75
|
+
const seenHeaders = new Set<string>();
|
|
76
76
|
for (const [name, value] of iterateHeaders(headers)) {
|
|
77
77
|
const lowerName = name.toLowerCase();
|
|
78
78
|
if (!seenHeaders.has(lowerName)) {
|
package/src/internal/to-file.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type File, getFile } from './shims/file';
|
|
2
1
|
import { BlobPart, getName, makeFile, isAsyncIterable } from './uploads';
|
|
3
2
|
import type { FilePropertyBag } from './builtin-types';
|
|
3
|
+
import { checkFileSupport } from './uploads';
|
|
4
4
|
|
|
5
5
|
type BlobLikePart = string | ArrayBuffer | ArrayBufferView | BlobLike | DataView;
|
|
6
6
|
|
|
@@ -85,12 +85,14 @@ export async function toFile(
|
|
|
85
85
|
name?: string | null | undefined,
|
|
86
86
|
options?: FilePropertyBag | undefined,
|
|
87
87
|
): Promise<File> {
|
|
88
|
+
checkFileSupport();
|
|
89
|
+
|
|
88
90
|
// If it's a promise, resolve it.
|
|
89
91
|
value = await value;
|
|
90
92
|
|
|
91
93
|
// If we've been given a `File` we don't need to do anything
|
|
92
94
|
if (isFileLike(value)) {
|
|
93
|
-
if (value instanceof
|
|
95
|
+
if (value instanceof File) {
|
|
94
96
|
return value;
|
|
95
97
|
}
|
|
96
98
|
return makeFile([await value.arrayBuffer()], value.name);
|
package/src/internal/uploads.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type RequestOptions } from './request-options';
|
|
2
2
|
import type { FilePropertyBag, Fetch } from './builtin-types';
|
|
3
3
|
import type { Knock } from '../client';
|
|
4
|
-
import { type File, getFile } from './shims/file';
|
|
5
4
|
import { ReadableStreamFrom } from './shims';
|
|
6
5
|
|
|
7
6
|
export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | DataView;
|
|
@@ -12,6 +11,20 @@ interface BunFile extends Blob {
|
|
|
12
11
|
readonly name?: string | undefined;
|
|
13
12
|
}
|
|
14
13
|
|
|
14
|
+
export const checkFileSupport = () => {
|
|
15
|
+
if (typeof File === 'undefined') {
|
|
16
|
+
const { process } = globalThis as any;
|
|
17
|
+
const isOldNode =
|
|
18
|
+
typeof process?.versions?.node === 'string' && parseInt(process.versions.node.split('.')) < 20;
|
|
19
|
+
throw new Error(
|
|
20
|
+
'`File` is not defined as a global, which is required for file uploads.' +
|
|
21
|
+
(isOldNode ?
|
|
22
|
+
" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`."
|
|
23
|
+
: ''),
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
15
28
|
/**
|
|
16
29
|
* Typically, this is a native "File" class.
|
|
17
30
|
*
|
|
@@ -32,7 +45,7 @@ export function makeFile(
|
|
|
32
45
|
fileName: string | undefined,
|
|
33
46
|
options?: FilePropertyBag,
|
|
34
47
|
): File {
|
|
35
|
-
|
|
48
|
+
checkFileSupport();
|
|
36
49
|
return new File(fileBits as any, fileName ?? 'unknown_file', options);
|
|
37
50
|
}
|
|
38
51
|
|
|
@@ -125,8 +138,7 @@ export const createForm = async <T = Record<string, unknown>>(
|
|
|
125
138
|
|
|
126
139
|
// We check for Blob not File because Bun.File doesn't inherit from File,
|
|
127
140
|
// but they both inherit from Blob and have a `name` property at runtime.
|
|
128
|
-
const isNamedBlob = (value: object) =>
|
|
129
|
-
value instanceof getFile() || (value instanceof Blob && 'name' in value);
|
|
141
|
+
const isNamedBlob = (value: object) => value instanceof Blob && 'name' in value;
|
|
130
142
|
|
|
131
143
|
const isUploadable = (value: unknown) =>
|
|
132
144
|
typeof value === 'object' &&
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { getCrypto } from '../shims/crypto';
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
* https://stackoverflow.com/a/2117523
|
|
7
5
|
*/
|
|
8
6
|
export let uuid4 = function () {
|
|
9
|
-
const crypto =
|
|
7
|
+
const { crypto } = globalThis as any;
|
|
10
8
|
if (crypto?.randomUUID) {
|
|
11
9
|
uuid4 = crypto.randomUUID.bind(crypto);
|
|
12
10
|
return crypto.randomUUID();
|
|
@@ -10,6 +10,18 @@ import { path } from '../internal/utils/path';
|
|
|
10
10
|
export class Audiences extends APIResource {
|
|
11
11
|
/**
|
|
12
12
|
* Adds one or more members to the specified audience.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const response = await client.audiences.addMembers('key', {
|
|
17
|
+
* members: [
|
|
18
|
+
* {
|
|
19
|
+
* tenant: 'ingen_isla_nublar',
|
|
20
|
+
* user: { id: 'dr_sattler' },
|
|
21
|
+
* },
|
|
22
|
+
* ],
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
13
25
|
*/
|
|
14
26
|
addMembers(key: string, body: AudienceAddMembersParams, options?: RequestOptions): APIPromise<string> {
|
|
15
27
|
return this._client.post(path`/v1/audiences/${key}/members`, { body, ...options });
|
|
@@ -17,6 +29,11 @@ export class Audiences extends APIResource {
|
|
|
17
29
|
|
|
18
30
|
/**
|
|
19
31
|
* Returns a paginated list of members for the specified audience.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const response = await client.audiences.listMembers('key');
|
|
36
|
+
* ```
|
|
20
37
|
*/
|
|
21
38
|
listMembers(key: string, options?: RequestOptions): APIPromise<AudienceListMembersResponse> {
|
|
22
39
|
return this._client.get(path`/v1/audiences/${key}/members`, options);
|
|
@@ -24,6 +41,14 @@ export class Audiences extends APIResource {
|
|
|
24
41
|
|
|
25
42
|
/**
|
|
26
43
|
* Removes one or more members from the specified audience.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* const response = await client.audiences.removeMembers(
|
|
48
|
+
* 'key',
|
|
49
|
+
* { members: [{ user: {} }] },
|
|
50
|
+
* );
|
|
51
|
+
* ```
|
|
27
52
|
*/
|
|
28
53
|
removeMembers(
|
|
29
54
|
key: string,
|
|
@@ -103,6 +128,9 @@ export namespace AudienceAddMembersParams {
|
|
|
103
128
|
* An audience member.
|
|
104
129
|
*/
|
|
105
130
|
export interface Member {
|
|
131
|
+
/**
|
|
132
|
+
* An object containing the user's ID.
|
|
133
|
+
*/
|
|
106
134
|
user: Member.User;
|
|
107
135
|
|
|
108
136
|
/**
|
|
@@ -112,6 +140,9 @@ export namespace AudienceAddMembersParams {
|
|
|
112
140
|
}
|
|
113
141
|
|
|
114
142
|
export namespace Member {
|
|
143
|
+
/**
|
|
144
|
+
* An object containing the user's ID.
|
|
145
|
+
*/
|
|
115
146
|
export interface User {
|
|
116
147
|
/**
|
|
117
148
|
* The ID for the user that you set when identifying them in Knock.
|
|
@@ -133,6 +164,9 @@ export namespace AudienceRemoveMembersParams {
|
|
|
133
164
|
* An audience member.
|
|
134
165
|
*/
|
|
135
166
|
export interface Member {
|
|
167
|
+
/**
|
|
168
|
+
* An object containing the user's ID.
|
|
169
|
+
*/
|
|
136
170
|
user: Member.User;
|
|
137
171
|
|
|
138
172
|
/**
|
|
@@ -142,6 +176,9 @@ export namespace AudienceRemoveMembersParams {
|
|
|
142
176
|
}
|
|
143
177
|
|
|
144
178
|
export namespace Member {
|
|
179
|
+
/**
|
|
180
|
+
* An object containing the user's ID.
|
|
181
|
+
*/
|
|
145
182
|
export interface User {
|
|
146
183
|
/**
|
|
147
184
|
* The ID for the user that you set when identifying them in Knock.
|
|
@@ -8,6 +8,13 @@ import { path } from '../internal/utils/path';
|
|
|
8
8
|
export class BulkOperations extends APIResource {
|
|
9
9
|
/**
|
|
10
10
|
* Retrieves a bulk operation (if it exists) and displays the current state of it.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const bulkOperation = await client.bulkOperations.get(
|
|
15
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
16
|
+
* );
|
|
17
|
+
* ```
|
|
11
18
|
*/
|
|
12
19
|
get(id: string, options?: RequestOptions): APIPromise<BulkOperation> {
|
|
13
20
|
return this._client.get(path`/v1/bulk_operations/${id}`, options);
|
|
@@ -12,6 +12,27 @@ export class Bulk extends APIResource {
|
|
|
12
12
|
* specified by the `channel_id` parameter. The action to perform is specified by
|
|
13
13
|
* the `action` parameter, where the action is a status change action (e.g.
|
|
14
14
|
* `archive`, `unarchive`).
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const bulkOperation =
|
|
19
|
+
* await client.channels.bulk.updateMessageStatus(
|
|
20
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
21
|
+
* 'seen',
|
|
22
|
+
* {
|
|
23
|
+
* archived: 'include',
|
|
24
|
+
* delivery_status: 'delivered',
|
|
25
|
+
* engagement_status: 'seen',
|
|
26
|
+
* has_tenant: true,
|
|
27
|
+
* newer_than: '2024-01-01T00:00:00Z',
|
|
28
|
+
* older_than: '2024-01-01T00:00:00Z',
|
|
29
|
+
* recipient_ids: ['recipient1', 'recipient2'],
|
|
30
|
+
* tenants: ['tenant1', 'tenant2'],
|
|
31
|
+
* trigger_data: '{"key":"value"}',
|
|
32
|
+
* workflows: ['workflow1', 'workflow2'],
|
|
33
|
+
* },
|
|
34
|
+
* );
|
|
35
|
+
* ```
|
|
15
36
|
*/
|
|
16
37
|
updateMessageStatus(
|
|
17
38
|
channelID: string,
|
|
@@ -9,6 +9,16 @@ export class Batch extends APIResource {
|
|
|
9
9
|
/**
|
|
10
10
|
* Marks the given messages as archived. Archived messages are hidden from the
|
|
11
11
|
* default message list in the feed but can still be accessed and unarchived later.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const messages = await client.messages.batch.archive({
|
|
16
|
+
* message_ids: [
|
|
17
|
+
* '2w3YUpTTOxuDvZFji8OMsKrG176',
|
|
18
|
+
* '2w3YVRbPXMIh8Zq6oBFcVDA5xes',
|
|
19
|
+
* ],
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
12
22
|
*/
|
|
13
23
|
archive(body: BatchArchiveParams, options?: RequestOptions): APIPromise<BatchArchiveResponse> {
|
|
14
24
|
return this._client.post('/v1/messages/batch/archived', { body, ...options });
|
|
@@ -16,6 +26,13 @@ export class Batch extends APIResource {
|
|
|
16
26
|
|
|
17
27
|
/**
|
|
18
28
|
* Get the contents of multiple messages in a single request.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const response = await client.messages.batch.getContent({
|
|
33
|
+
* message_ids: ['string'],
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
19
36
|
*/
|
|
20
37
|
getContent(query: BatchGetContentParams, options?: RequestOptions): APIPromise<BatchGetContentResponse> {
|
|
21
38
|
return this._client.get('/v1/messages/batch/content', { query, ...options });
|
|
@@ -27,6 +44,15 @@ export class Batch extends APIResource {
|
|
|
27
44
|
* interaction. Cannot include more than 5 key-value pairs, must not contain nested
|
|
28
45
|
* data. Read more about message engagement statuses
|
|
29
46
|
* [here](/send-notifications/message-statuses#engagement-status).
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const messages =
|
|
51
|
+
* await client.messages.batch.markAsInteracted({
|
|
52
|
+
* message_ids: ['1jNaXzB2RZX3LY8wVQnfCKyPnv7'],
|
|
53
|
+
* metadata: { key: 'value' },
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
30
56
|
*/
|
|
31
57
|
markAsInteracted(
|
|
32
58
|
body: BatchMarkAsInteractedParams,
|
|
@@ -38,6 +64,16 @@ export class Batch extends APIResource {
|
|
|
38
64
|
/**
|
|
39
65
|
* Marks the given messages as `read`. Read more about message engagement statuses
|
|
40
66
|
* [here](/send-notifications/message-statuses#engagement-status).
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* const messages = await client.messages.batch.markAsRead({
|
|
71
|
+
* message_ids: [
|
|
72
|
+
* '2w3YUpTTOxuDvZFji8OMsKrG176',
|
|
73
|
+
* '2w3YVRbPXMIh8Zq6oBFcVDA5xes',
|
|
74
|
+
* ],
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
41
77
|
*/
|
|
42
78
|
markAsRead(body: BatchMarkAsReadParams, options?: RequestOptions): APIPromise<BatchMarkAsReadResponse> {
|
|
43
79
|
return this._client.post('/v1/messages/batch/read', { body, ...options });
|
|
@@ -47,6 +83,16 @@ export class Batch extends APIResource {
|
|
|
47
83
|
* Marks the given messages as `seen`. This indicates that the user has viewed the
|
|
48
84
|
* message in their feed or inbox. Read more about message engagement statuses
|
|
49
85
|
* [here](/send-notifications/message-statuses#engagement-status).
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* const messages = await client.messages.batch.markAsSeen({
|
|
90
|
+
* message_ids: [
|
|
91
|
+
* '2w3YUpTTOxuDvZFji8OMsKrG176',
|
|
92
|
+
* '2w3YVRbPXMIh8Zq6oBFcVDA5xes',
|
|
93
|
+
* ],
|
|
94
|
+
* });
|
|
95
|
+
* ```
|
|
50
96
|
*/
|
|
51
97
|
markAsSeen(body: BatchMarkAsSeenParams, options?: RequestOptions): APIPromise<BatchMarkAsSeenResponse> {
|
|
52
98
|
return this._client.post('/v1/messages/batch/seen', { body, ...options });
|
|
@@ -56,6 +102,16 @@ export class Batch extends APIResource {
|
|
|
56
102
|
* Marks the given messages as `unread`. This reverses the `read` state. Read more
|
|
57
103
|
* about message engagement statuses
|
|
58
104
|
* [here](/send-notifications/message-statuses#engagement-status).
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* const messages = await client.messages.batch.markAsUnread({
|
|
109
|
+
* message_ids: [
|
|
110
|
+
* '2w3YUpTTOxuDvZFji8OMsKrG176',
|
|
111
|
+
* '2w3YVRbPXMIh8Zq6oBFcVDA5xes',
|
|
112
|
+
* ],
|
|
113
|
+
* });
|
|
114
|
+
* ```
|
|
59
115
|
*/
|
|
60
116
|
markAsUnread(
|
|
61
117
|
body: BatchMarkAsUnreadParams,
|
|
@@ -68,6 +124,16 @@ export class Batch extends APIResource {
|
|
|
68
124
|
* Marks the given messages as `unseen`. This reverses the `seen` state. Read more
|
|
69
125
|
* about message engagement statuses
|
|
70
126
|
* [here](/send-notifications/message-statuses#engagement-status).
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```ts
|
|
130
|
+
* const messages = await client.messages.batch.markAsUnseen({
|
|
131
|
+
* message_ids: [
|
|
132
|
+
* '2w3YUpTTOxuDvZFji8OMsKrG176',
|
|
133
|
+
* '2w3YVRbPXMIh8Zq6oBFcVDA5xes',
|
|
134
|
+
* ],
|
|
135
|
+
* });
|
|
136
|
+
* ```
|
|
71
137
|
*/
|
|
72
138
|
markAsUnseen(
|
|
73
139
|
body: BatchMarkAsUnseenParams,
|
|
@@ -80,6 +146,16 @@ export class Batch extends APIResource {
|
|
|
80
146
|
* Marks the given messages as unarchived. This reverses the `archived` state.
|
|
81
147
|
* Archived messages are hidden from the default message list in the feed but can
|
|
82
148
|
* still be accessed and unarchived later.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```ts
|
|
152
|
+
* const messages = await client.messages.batch.unarchive({
|
|
153
|
+
* message_ids: [
|
|
154
|
+
* '2w3YUpTTOxuDvZFji8OMsKrG176',
|
|
155
|
+
* '2w3YVRbPXMIh8Zq6oBFcVDA5xes',
|
|
156
|
+
* ],
|
|
157
|
+
* });
|
|
158
|
+
* ```
|
|
83
159
|
*/
|
|
84
160
|
unarchive(body: BatchUnarchiveParams, options?: RequestOptions): APIPromise<BatchUnarchiveResponse> {
|
|
85
161
|
return this._client.post('/v1/messages/batch/unarchived', { body, ...options });
|