@knocklabs/node 1.0.0 → 1.1.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 +24 -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 +5 -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/activities.d.mts +10 -0
- package/resources/messages/activities.d.mts.map +1 -1
- package/resources/messages/activities.d.ts +10 -0
- package/resources/messages/activities.d.ts.map +1 -1
- package/resources/messages/activities.js +10 -0
- package/resources/messages/activities.js.map +1 -1
- package/resources/messages/activities.mjs +10 -0
- package/resources/messages/activities.mjs.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/messages.d.mts +101 -0
- package/resources/messages/messages.d.mts.map +1 -1
- package/resources/messages/messages.d.ts +101 -0
- package/resources/messages/messages.d.ts.map +1 -1
- package/resources/messages/messages.js +104 -25
- package/resources/messages/messages.js.map +1 -1
- package/resources/messages/messages.mjs +101 -0
- 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 +175 -4
- package/resources/objects/objects.d.mts.map +1 -1
- package/resources/objects/objects.d.ts +175 -4
- 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/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 +74 -0
- package/resources/schedules/schedules.d.mts.map +1 -1
- package/resources/schedules/schedules.d.ts +74 -0
- 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 +169 -15
- package/resources/users/users.d.mts.map +1 -1
- package/resources/users/users.d.ts +169 -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/activities.ts +10 -0
- package/src/resources/messages/batch.ts +76 -0
- package/src/resources/messages/messages.ts +101 -0
- package/src/resources/objects/bulk.ts +49 -0
- package/src/resources/objects/objects.ts +175 -4
- package/src/resources/providers/ms-teams.ts +40 -0
- package/src/resources/providers/slack.ts +27 -0
- package/src/resources/schedules/bulk.ts +30 -0
- package/src/resources/schedules/schedules.ts +74 -0
- 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 +172 -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/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
|
@@ -19,6 +19,30 @@ export class Users extends APIResource {
|
|
|
19
19
|
* Create or update a user with the provided identification data. When you identify
|
|
20
20
|
* an existing user, the system merges the properties you specific with what is
|
|
21
21
|
* currently set on the user, updating only the fields included in your requests.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const user = await client.users.update('user_id', {
|
|
26
|
+
* channel_data: {
|
|
27
|
+
* '97c5837d-c65c-4d54-aa39-080eeb81c69d': {
|
|
28
|
+
* data: { tokens: ['push_token_123'] },
|
|
29
|
+
* },
|
|
30
|
+
* },
|
|
31
|
+
* email: 'ian.malcolm@chaos.theory',
|
|
32
|
+
* name: 'Dr. Ian Malcolm',
|
|
33
|
+
* preferences: {
|
|
34
|
+
* default: {
|
|
35
|
+
* channel_types: { email: true },
|
|
36
|
+
* workflows: {
|
|
37
|
+
* 'dinosaurs-loose': {
|
|
38
|
+
* channel_types: { email: true },
|
|
39
|
+
* },
|
|
40
|
+
* },
|
|
41
|
+
* },
|
|
42
|
+
* },
|
|
43
|
+
* timezone: 'America/New_York',
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
22
46
|
*/
|
|
23
47
|
update(userID, body, options) {
|
|
24
48
|
return this._client.put(path `/v1/users/${userID}`, { body, ...options });
|
|
@@ -26,24 +50,50 @@ export class Users extends APIResource {
|
|
|
26
50
|
/**
|
|
27
51
|
* Retrieve a paginated list of users in the environment. Defaults to 50 users per
|
|
28
52
|
* page.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* // Automatically fetches more pages as needed.
|
|
57
|
+
* for await (const user of client.users.list()) {
|
|
58
|
+
* // ...
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
29
61
|
*/
|
|
30
62
|
list(query = {}, options) {
|
|
31
63
|
return this._client.getAPIList('/v1/users', (EntriesCursor), { query, ...options });
|
|
32
64
|
}
|
|
33
65
|
/**
|
|
34
66
|
* Permanently delete a user and all associated data.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* const user = await client.users.delete('user_id');
|
|
71
|
+
* ```
|
|
35
72
|
*/
|
|
36
73
|
delete(userID, options) {
|
|
37
74
|
return this._client.delete(path `/v1/users/${userID}`, options);
|
|
38
75
|
}
|
|
39
76
|
/**
|
|
40
77
|
* Retrieve a specific user by their ID.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* const user = await client.users.get('user_id');
|
|
82
|
+
* ```
|
|
41
83
|
*/
|
|
42
84
|
get(userID, options) {
|
|
43
85
|
return this._client.get(path `/v1/users/${userID}`, options);
|
|
44
86
|
}
|
|
45
87
|
/**
|
|
46
88
|
* Retrieves the channel data for a specific user and channel ID.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* const channelData = await client.users.getChannelData(
|
|
93
|
+
* 'user_id',
|
|
94
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
95
|
+
* );
|
|
96
|
+
* ```
|
|
47
97
|
*/
|
|
48
98
|
getChannelData(userID, channelID, options) {
|
|
49
99
|
return this._client.get(path `/v1/users/${userID}/channel_data/${channelID}`, options);
|
|
@@ -51,6 +101,14 @@ export class Users extends APIResource {
|
|
|
51
101
|
/**
|
|
52
102
|
* Retrieves a specific preference set for a user identified by the preference set
|
|
53
103
|
* ID.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* const preferenceSet = await client.users.getPreferences(
|
|
108
|
+
* 'user_id',
|
|
109
|
+
* 'default',
|
|
110
|
+
* );
|
|
111
|
+
* ```
|
|
54
112
|
*/
|
|
55
113
|
getPreferences(userID, id, query = {}, options) {
|
|
56
114
|
return this._client.get(path `/v1/users/${userID}/preferences/${id}`, { query, ...options });
|
|
@@ -59,6 +117,16 @@ export class Users extends APIResource {
|
|
|
59
117
|
* Returns a paginated list of messages for a specific user. Allows filtering by
|
|
60
118
|
* message status and provides various sorting options. Messages outside the
|
|
61
119
|
* account's retention window will not be included in the results.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* // Automatically fetches more pages as needed.
|
|
124
|
+
* for await (const message of client.users.listMessages(
|
|
125
|
+
* 'user-123',
|
|
126
|
+
* )) {
|
|
127
|
+
* // ...
|
|
128
|
+
* }
|
|
129
|
+
* ```
|
|
62
130
|
*/
|
|
63
131
|
listMessages(userID, query = {}, options) {
|
|
64
132
|
return this._client.getAPIList(path `/v1/users/${userID}/messages`, (EntriesCursor), {
|
|
@@ -68,12 +136,29 @@ export class Users extends APIResource {
|
|
|
68
136
|
}
|
|
69
137
|
/**
|
|
70
138
|
* Retrieves a list of all preference sets for a specific user.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```ts
|
|
142
|
+
* const preferenceSets = await client.users.listPreferences(
|
|
143
|
+
* 'user_id',
|
|
144
|
+
* );
|
|
145
|
+
* ```
|
|
71
146
|
*/
|
|
72
147
|
listPreferences(userID, options) {
|
|
73
148
|
return this._client.get(path `/v1/users/${userID}/preferences`, options);
|
|
74
149
|
}
|
|
75
150
|
/**
|
|
76
151
|
* Returns a paginated list of schedules for a specific user, in descending order.
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```ts
|
|
155
|
+
* // Automatically fetches more pages as needed.
|
|
156
|
+
* for await (const schedule of client.users.listSchedules(
|
|
157
|
+
* 'user_id',
|
|
158
|
+
* )) {
|
|
159
|
+
* // ...
|
|
160
|
+
* }
|
|
161
|
+
* ```
|
|
77
162
|
*/
|
|
78
163
|
listSchedules(userID, query = {}, options) {
|
|
79
164
|
return this._client.getAPIList(path `/v1/users/${userID}/schedules`, (EntriesCursor), { query, ...options });
|
|
@@ -81,6 +166,16 @@ export class Users extends APIResource {
|
|
|
81
166
|
/**
|
|
82
167
|
* Retrieves a paginated list of subscriptions for a specific user, in descending
|
|
83
168
|
* order.
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```ts
|
|
172
|
+
* // Automatically fetches more pages as needed.
|
|
173
|
+
* for await (const subscription of client.users.listSubscriptions(
|
|
174
|
+
* 'user_id',
|
|
175
|
+
* )) {
|
|
176
|
+
* // ...
|
|
177
|
+
* }
|
|
178
|
+
* ```
|
|
84
179
|
*/
|
|
85
180
|
listSubscriptions(userID, query = {}, options) {
|
|
86
181
|
return this._client.getAPIList(path `/v1/users/${userID}/subscriptions`, (EntriesCursor), { query, ...options });
|
|
@@ -88,12 +183,28 @@ export class Users extends APIResource {
|
|
|
88
183
|
/**
|
|
89
184
|
* Merge two users together, where the user specified with the `from_user_id` param
|
|
90
185
|
* will be merged into the user specified by `user_id`.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```ts
|
|
189
|
+
* const user = await client.users.merge('user_id', {
|
|
190
|
+
* from_user_id: 'user_1',
|
|
191
|
+
* });
|
|
192
|
+
* ```
|
|
91
193
|
*/
|
|
92
194
|
merge(userID, body, options) {
|
|
93
195
|
return this._client.post(path `/v1/users/${userID}/merge`, { body, ...options });
|
|
94
196
|
}
|
|
95
197
|
/**
|
|
96
198
|
* Updates or creates channel data for a specific user and channel ID.
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```ts
|
|
202
|
+
* const channelData = await client.users.setChannelData(
|
|
203
|
+
* 'user_id',
|
|
204
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
205
|
+
* { data: { tokens: ['push_token_1'] } },
|
|
206
|
+
* );
|
|
207
|
+
* ```
|
|
97
208
|
*/
|
|
98
209
|
setChannelData(userID, channelID, body, options) {
|
|
99
210
|
return this._client.put(path `/v1/users/${userID}/channel_data/${channelID}`, { body, ...options });
|
|
@@ -101,12 +212,40 @@ export class Users extends APIResource {
|
|
|
101
212
|
/**
|
|
102
213
|
* Updates a complete preference set for a user. This is a destructive operation
|
|
103
214
|
* that will replace the existing preference set for the user.
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```ts
|
|
218
|
+
* const preferenceSet = await client.users.setPreferences(
|
|
219
|
+
* 'user_id',
|
|
220
|
+
* 'default',
|
|
221
|
+
* {
|
|
222
|
+
* categories: {
|
|
223
|
+
* marketing: false,
|
|
224
|
+
* transactional: { channel_types: { email: false } },
|
|
225
|
+
* },
|
|
226
|
+
* channel_types: { email: true },
|
|
227
|
+
* workflows: {
|
|
228
|
+
* 'dinosaurs-loose': {
|
|
229
|
+
* channel_types: { email: false },
|
|
230
|
+
* },
|
|
231
|
+
* },
|
|
232
|
+
* },
|
|
233
|
+
* );
|
|
234
|
+
* ```
|
|
104
235
|
*/
|
|
105
236
|
setPreferences(userID, id, body, options) {
|
|
106
237
|
return this._client.put(path `/v1/users/${userID}/preferences/${id}`, { body, ...options });
|
|
107
238
|
}
|
|
108
239
|
/**
|
|
109
240
|
* Deletes channel data for a specific user and channel ID.
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* ```ts
|
|
244
|
+
* const response = await client.users.unsetChannelData(
|
|
245
|
+
* 'user_id',
|
|
246
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
247
|
+
* );
|
|
248
|
+
* ```
|
|
110
249
|
*/
|
|
111
250
|
unsetChannelData(userID, channelID, options) {
|
|
112
251
|
return this._client.delete(path `/v1/users/${userID}/channel_data/${channelID}`, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.mjs","sourceRoot":"","sources":["../../src/resources/users/users.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAUf,KAAK,OAAO;OACZ,EAAE,IAAI,EAAkE;OACxE,KAAK,QAAQ;OACb,EAKL,KAAK,GACN;OACM,KAAK,SAAS;OACd,EASL,MAAM,GACP;OAEM,EAAE,aAAa,EAAyC;OAExD,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,KAAM,SAAQ,WAAW;IAAtC;;QACE,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzD,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9D,SAAI,GAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"users.mjs","sourceRoot":"","sources":["../../src/resources/users/users.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAUf,KAAK,OAAO;OACZ,EAAE,IAAI,EAAkE;OACxE,KAAK,QAAQ;OACb,EAKL,KAAK,GACN;OACM,KAAK,SAAS;OACd,EASL,MAAM,GACP;OAEM,EAAE,aAAa,EAAyC;OAExD,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,KAAM,SAAQ,WAAW;IAAtC;;QACE,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzD,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QA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CAAC;IAED;;;;;;;;;;;OAWG;IACH,cAAc,CACZ,MAAc,EACd,SAAiB,EACjB,IAA8B,EAC9B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,MAAM,iBAAiB,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrG,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,cAAc,CACZ,MAAc,EACd,EAAU,EACV,IAA8B,EAC9B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,aAAa,MAAM,gBAAgB,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7F,CAAC;IAED;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,MAAc,EAAE,SAAiB,EAAE,OAAwB;QAC1E,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,aAAa,MAAM,iBAAiB,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC;IAC3F,CAAC;CACF;AAobD,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;AACpB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;AACtB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC"}
|
package/resources/users.js
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
-
};
|
|
17
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
|
|
4
|
+
const tslib_1 = require("../internal/tslib.js");
|
|
5
|
+
tslib_1.__exportStar(require("./users/index.js"), exports);
|
|
19
6
|
//# sourceMappingURL=users.js.map
|
package/resources/users.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.js","sourceRoot":"","sources":["../src/resources/users.ts"],"names":[],"mappings":";AAAA,sFAAsF
|
|
1
|
+
{"version":3,"file":"users.js","sourceRoot":"","sources":["../src/resources/users.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,2DAA8B"}
|
|
@@ -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.mts","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.mts","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;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ACpD,CAAC;CACH"}
|
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();
|