@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
|
@@ -24,6 +24,16 @@ export class Objects extends APIResource {
|
|
|
24
24
|
/**
|
|
25
25
|
* Returns a paginated list of objects from the specified collection. Optionally
|
|
26
26
|
* includes preference data for the objects.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* // Automatically fetches more pages as needed.
|
|
31
|
+
* for await (const object of client.objects.list(
|
|
32
|
+
* 'collection',
|
|
33
|
+
* )) {
|
|
34
|
+
* // ...
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
27
37
|
*/
|
|
28
38
|
list(
|
|
29
39
|
collection: string,
|
|
@@ -39,6 +49,14 @@ export class Objects extends APIResource {
|
|
|
39
49
|
/**
|
|
40
50
|
* Permanently removes an object from the specified collection. This operation
|
|
41
51
|
* cannot be undone.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* const object = await client.objects.delete(
|
|
56
|
+
* 'collection',
|
|
57
|
+
* 'id',
|
|
58
|
+
* );
|
|
59
|
+
* ```
|
|
42
60
|
*/
|
|
43
61
|
delete(collection: string, id: string, options?: RequestOptions): APIPromise<string> {
|
|
44
62
|
return this._client.delete(path`/v1/objects/${collection}/${id}`, options);
|
|
@@ -49,6 +67,18 @@ export class Objects extends APIResource {
|
|
|
49
67
|
* updated. This endpoint also handles
|
|
50
68
|
* [inline identifications](/managing-recipients/identifying-recipients#inline-identifying-recipients)
|
|
51
69
|
* for the `recipient`.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* const subscriptions = await client.objects.addSubscriptions(
|
|
74
|
+
* 'collection',
|
|
75
|
+
* 'object_id',
|
|
76
|
+
* {
|
|
77
|
+
* recipients: ['user_1', 'user_2'],
|
|
78
|
+
* properties: { key: 'value' },
|
|
79
|
+
* },
|
|
80
|
+
* );
|
|
81
|
+
* ```
|
|
52
82
|
*/
|
|
53
83
|
addSubscriptions(
|
|
54
84
|
collection: string,
|
|
@@ -62,6 +92,16 @@ export class Objects extends APIResource {
|
|
|
62
92
|
/**
|
|
63
93
|
* Delete subscriptions for the specified recipients from an object. Returns the
|
|
64
94
|
* list of deleted subscriptions.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* const subscriptions =
|
|
99
|
+
* await client.objects.deleteSubscriptions(
|
|
100
|
+
* 'collection',
|
|
101
|
+
* 'object_id',
|
|
102
|
+
* { recipients: ['user_123'] },
|
|
103
|
+
* );
|
|
104
|
+
* ```
|
|
65
105
|
*/
|
|
66
106
|
deleteSubscriptions(
|
|
67
107
|
collection: string,
|
|
@@ -78,6 +118,11 @@ export class Objects extends APIResource {
|
|
|
78
118
|
/**
|
|
79
119
|
* Retrieves a specific object by its ID from the specified collection. Returns the
|
|
80
120
|
* object with all its properties.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* const object = await client.objects.get('collection', 'id');
|
|
125
|
+
* ```
|
|
81
126
|
*/
|
|
82
127
|
get(collection: string, id: string, options?: RequestOptions): APIPromise<Object> {
|
|
83
128
|
return this._client.get(path`/v1/objects/${collection}/${id}`, options);
|
|
@@ -85,6 +130,15 @@ export class Objects extends APIResource {
|
|
|
85
130
|
|
|
86
131
|
/**
|
|
87
132
|
* Returns the channel data for the specified object and channel.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```ts
|
|
136
|
+
* const channelData = await client.objects.getChannelData(
|
|
137
|
+
* 'collection',
|
|
138
|
+
* 'object_id',
|
|
139
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
140
|
+
* );
|
|
141
|
+
* ```
|
|
88
142
|
*/
|
|
89
143
|
getChannelData(
|
|
90
144
|
collection: string,
|
|
@@ -97,6 +151,15 @@ export class Objects extends APIResource {
|
|
|
97
151
|
|
|
98
152
|
/**
|
|
99
153
|
* Returns the preference set for the specified object and preference set `id`.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```ts
|
|
157
|
+
* const preferenceSet = await client.objects.getPreferences(
|
|
158
|
+
* 'collection',
|
|
159
|
+
* 'object_id',
|
|
160
|
+
* 'default',
|
|
161
|
+
* );
|
|
162
|
+
* ```
|
|
100
163
|
*/
|
|
101
164
|
getPreferences(
|
|
102
165
|
collection: string,
|
|
@@ -111,6 +174,17 @@ export class Objects extends APIResource {
|
|
|
111
174
|
* Returns a paginated list of messages for a specific object in the given
|
|
112
175
|
* collection. Allows filtering by message status and provides various sorting
|
|
113
176
|
* options.
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```ts
|
|
180
|
+
* // Automatically fetches more pages as needed.
|
|
181
|
+
* for await (const message of client.objects.listMessages(
|
|
182
|
+
* 'projects',
|
|
183
|
+
* 'project-123',
|
|
184
|
+
* )) {
|
|
185
|
+
* // ...
|
|
186
|
+
* }
|
|
187
|
+
* ```
|
|
114
188
|
*/
|
|
115
189
|
listMessages(
|
|
116
190
|
collection: string,
|
|
@@ -127,6 +201,14 @@ export class Objects extends APIResource {
|
|
|
127
201
|
|
|
128
202
|
/**
|
|
129
203
|
* Returns a paginated list of preference sets for the specified object.
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```ts
|
|
207
|
+
* const preferenceSets = await client.objects.listPreferences(
|
|
208
|
+
* 'collection',
|
|
209
|
+
* 'object_id',
|
|
210
|
+
* );
|
|
211
|
+
* ```
|
|
130
212
|
*/
|
|
131
213
|
listPreferences(
|
|
132
214
|
collection: string,
|
|
@@ -138,6 +220,17 @@ export class Objects extends APIResource {
|
|
|
138
220
|
|
|
139
221
|
/**
|
|
140
222
|
* Returns a paginated list of schedules for an object.
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```ts
|
|
226
|
+
* // Automatically fetches more pages as needed.
|
|
227
|
+
* for await (const schedule of client.objects.listSchedules(
|
|
228
|
+
* 'collection',
|
|
229
|
+
* 'id',
|
|
230
|
+
* )) {
|
|
231
|
+
* // ...
|
|
232
|
+
* }
|
|
233
|
+
* ```
|
|
141
234
|
*/
|
|
142
235
|
listSchedules(
|
|
143
236
|
collection: string,
|
|
@@ -156,6 +249,17 @@ export class Objects extends APIResource {
|
|
|
156
249
|
* List subscriptions for an object. Either list the recipients that subscribe to
|
|
157
250
|
* the provided object, or list the objects that the provided object is subscribed
|
|
158
251
|
* to. Determined by the `mode` query parameter.
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```ts
|
|
255
|
+
* // Automatically fetches more pages as needed.
|
|
256
|
+
* for await (const subscription of client.objects.listSubscriptions(
|
|
257
|
+
* 'collection',
|
|
258
|
+
* 'object_id',
|
|
259
|
+
* )) {
|
|
260
|
+
* // ...
|
|
261
|
+
* }
|
|
262
|
+
* ```
|
|
159
263
|
*/
|
|
160
264
|
listSubscriptions(
|
|
161
265
|
collection: string,
|
|
@@ -174,6 +278,33 @@ export class Objects extends APIResource {
|
|
|
174
278
|
* Creates a new object or updates an existing one in the specified collection.
|
|
175
279
|
* This operation is used to identify objects with their properties, as well as
|
|
176
280
|
* optional preferences and channel data.
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* ```ts
|
|
284
|
+
* const object = await client.objects.set(
|
|
285
|
+
* 'collection',
|
|
286
|
+
* 'id',
|
|
287
|
+
* {
|
|
288
|
+
* channel_data: {
|
|
289
|
+
* '97c5837d-c65c-4d54-aa39-080eeb81c69d': {
|
|
290
|
+
* data: { tokens: ['push_token_123'] },
|
|
291
|
+
* },
|
|
292
|
+
* },
|
|
293
|
+
* locale: 'en-US',
|
|
294
|
+
* preferences: {
|
|
295
|
+
* default: {
|
|
296
|
+
* channel_types: { email: true },
|
|
297
|
+
* workflows: {
|
|
298
|
+
* 'dinosaurs-loose': {
|
|
299
|
+
* channel_types: { email: true },
|
|
300
|
+
* },
|
|
301
|
+
* },
|
|
302
|
+
* },
|
|
303
|
+
* },
|
|
304
|
+
* timezone: 'America/New_York',
|
|
305
|
+
* },
|
|
306
|
+
* );
|
|
307
|
+
* ```
|
|
177
308
|
*/
|
|
178
309
|
set(collection: string, id: string, body: ObjectSetParams, options?: RequestOptions): APIPromise<Object> {
|
|
179
310
|
return this._client.put(path`/v1/objects/${collection}/${id}`, { body, ...options });
|
|
@@ -183,6 +314,16 @@ export class Objects extends APIResource {
|
|
|
183
314
|
* Sets the channel data for the specified object and channel. If no object exists
|
|
184
315
|
* in the current environment for the given `collection` and `object_id`, Knock
|
|
185
316
|
* will create the object as part of this request.
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* ```ts
|
|
320
|
+
* const channelData = await client.objects.setChannelData(
|
|
321
|
+
* 'collection',
|
|
322
|
+
* 'object_id',
|
|
323
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
324
|
+
* { data: { tokens: ['push_token_1'] } },
|
|
325
|
+
* );
|
|
326
|
+
* ```
|
|
186
327
|
*/
|
|
187
328
|
setChannelData(
|
|
188
329
|
collection: string,
|
|
@@ -204,6 +345,27 @@ export class Objects extends APIResource {
|
|
|
204
345
|
* `:object_id`, Knock will create the object as part of this request. The
|
|
205
346
|
* preference set `:id` can be either `default` or a `tenant.id`. Learn more about
|
|
206
347
|
* [per-tenant preferences](/preferences/tenant-preferences).
|
|
348
|
+
*
|
|
349
|
+
* @example
|
|
350
|
+
* ```ts
|
|
351
|
+
* const preferenceSet = await client.objects.setPreferences(
|
|
352
|
+
* 'collection',
|
|
353
|
+
* 'object_id',
|
|
354
|
+
* 'default',
|
|
355
|
+
* {
|
|
356
|
+
* categories: {
|
|
357
|
+
* marketing: false,
|
|
358
|
+
* transactional: { channel_types: { email: false } },
|
|
359
|
+
* },
|
|
360
|
+
* channel_types: { email: true },
|
|
361
|
+
* workflows: {
|
|
362
|
+
* 'dinosaurs-loose': {
|
|
363
|
+
* channel_types: { email: false },
|
|
364
|
+
* },
|
|
365
|
+
* },
|
|
366
|
+
* },
|
|
367
|
+
* );
|
|
368
|
+
* ```
|
|
207
369
|
*/
|
|
208
370
|
setPreferences(
|
|
209
371
|
collection: string,
|
|
@@ -220,6 +382,15 @@ export class Objects extends APIResource {
|
|
|
220
382
|
|
|
221
383
|
/**
|
|
222
384
|
* Unsets the channel data for the specified object and channel.
|
|
385
|
+
*
|
|
386
|
+
* @example
|
|
387
|
+
* ```ts
|
|
388
|
+
* const response = await client.objects.unsetChannelData(
|
|
389
|
+
* 'collection',
|
|
390
|
+
* 'object_id',
|
|
391
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
392
|
+
* );
|
|
393
|
+
* ```
|
|
223
394
|
*/
|
|
224
395
|
unsetChannelData(
|
|
225
396
|
collection: string,
|
|
@@ -508,10 +679,10 @@ export interface ObjectSetParams {
|
|
|
508
679
|
preferences?: PreferencesAPI.InlinePreferenceSetRequest;
|
|
509
680
|
|
|
510
681
|
/**
|
|
511
|
-
* The timezone of the object. Must be a
|
|
512
|
-
* [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
|
|
513
|
-
* Used
|
|
514
|
-
* [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients).
|
|
682
|
+
* The timezone of the object. Must be a
|
|
683
|
+
* valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
|
|
684
|
+
* Used
|
|
685
|
+
* for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients).
|
|
515
686
|
*/
|
|
516
687
|
timezone?: string | null;
|
|
517
688
|
|
|
@@ -10,6 +10,14 @@ export class MsTeams extends APIResource {
|
|
|
10
10
|
/**
|
|
11
11
|
* Check if a connection to Microsoft Teams has been authorized for a given
|
|
12
12
|
* Microsoft Teams tenant object.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const response = await client.providers.msTeams.checkAuth(
|
|
17
|
+
* 'channel_id',
|
|
18
|
+
* { ms_teams_tenant_object: 'ms_teams_tenant_object' },
|
|
19
|
+
* );
|
|
20
|
+
* ```
|
|
13
21
|
*/
|
|
14
22
|
checkAuth(
|
|
15
23
|
channelID: string,
|
|
@@ -22,6 +30,18 @@ export class MsTeams extends APIResource {
|
|
|
22
30
|
/**
|
|
23
31
|
* List the Microsoft Teams channels within a team. By default, archived and
|
|
24
32
|
* private channels are excluded from the results.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const response =
|
|
37
|
+
* await client.providers.msTeams.listChannels(
|
|
38
|
+
* 'channel_id',
|
|
39
|
+
* {
|
|
40
|
+
* ms_teams_tenant_object: 'ms_teams_tenant_object',
|
|
41
|
+
* team_id: 'team_id',
|
|
42
|
+
* },
|
|
43
|
+
* );
|
|
44
|
+
* ```
|
|
25
45
|
*/
|
|
26
46
|
listChannels(
|
|
27
47
|
channelID: string,
|
|
@@ -34,6 +54,17 @@ export class MsTeams extends APIResource {
|
|
|
34
54
|
/**
|
|
35
55
|
* Get a list of teams belonging to the Microsoft Entra tenant. By default,
|
|
36
56
|
* archived and private channels are excluded from the results.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* // Automatically fetches more pages as needed.
|
|
61
|
+
* for await (const msTeamListTeamsResponse of client.providers.msTeams.listTeams(
|
|
62
|
+
* 'channel_id',
|
|
63
|
+
* { ms_teams_tenant_object: 'ms_teams_tenant_object' },
|
|
64
|
+
* )) {
|
|
65
|
+
* // ...
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
37
68
|
*/
|
|
38
69
|
listTeams(
|
|
39
70
|
channelID: string,
|
|
@@ -49,6 +80,15 @@ export class MsTeams extends APIResource {
|
|
|
49
80
|
|
|
50
81
|
/**
|
|
51
82
|
* Remove a Microsoft Entra tenant ID from a Microsoft Teams tenant object.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* const response =
|
|
87
|
+
* await client.providers.msTeams.revokeAccess(
|
|
88
|
+
* 'channel_id',
|
|
89
|
+
* { ms_teams_tenant_object: 'ms_teams_tenant_object' },
|
|
90
|
+
* );
|
|
91
|
+
* ```
|
|
52
92
|
*/
|
|
53
93
|
revokeAccess(
|
|
54
94
|
channelID: string,
|
|
@@ -9,6 +9,14 @@ import { path } from '../../internal/utils/path';
|
|
|
9
9
|
export class Slack extends APIResource {
|
|
10
10
|
/**
|
|
11
11
|
* Check if a Slack channel is authenticated.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const response = await client.providers.slack.checkAuth(
|
|
16
|
+
* 'channel_id',
|
|
17
|
+
* { access_token_object: 'access_token_object' },
|
|
18
|
+
* );
|
|
19
|
+
* ```
|
|
12
20
|
*/
|
|
13
21
|
checkAuth(
|
|
14
22
|
channelID: string,
|
|
@@ -20,6 +28,17 @@ export class Slack extends APIResource {
|
|
|
20
28
|
|
|
21
29
|
/**
|
|
22
30
|
* List Slack channels for a Slack workspace.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* // Automatically fetches more pages as needed.
|
|
35
|
+
* for await (const slackListChannelsResponse of client.providers.slack.listChannels(
|
|
36
|
+
* 'channel_id',
|
|
37
|
+
* { access_token_object: 'access_token_object' },
|
|
38
|
+
* )) {
|
|
39
|
+
* // ...
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
23
42
|
*/
|
|
24
43
|
listChannels(
|
|
25
44
|
channelID: string,
|
|
@@ -35,6 +54,14 @@ export class Slack extends APIResource {
|
|
|
35
54
|
|
|
36
55
|
/**
|
|
37
56
|
* Revoke access for a Slack channel.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const response = await client.providers.slack.revokeAccess(
|
|
61
|
+
* 'channel_id',
|
|
62
|
+
* { access_token_object: 'access_token_object' },
|
|
63
|
+
* );
|
|
64
|
+
* ```
|
|
38
65
|
*/
|
|
39
66
|
revokeAccess(
|
|
40
67
|
channelID: string,
|
|
@@ -13,6 +13,36 @@ export class Bulk extends APIResource {
|
|
|
13
13
|
* Bulk creates up to 1,000 schedules at a time. This endpoint also handles
|
|
14
14
|
* [inline identifications](/managing-recipients/identifying-recipients#inline-identifying-recipients)
|
|
15
15
|
* for the `actor`, `recipient`, and `tenant` fields.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const bulkOperation = await client.schedules.bulk.create({
|
|
20
|
+
* schedules: [
|
|
21
|
+
* {
|
|
22
|
+
* data: { ... },
|
|
23
|
+
* ending_at: null,
|
|
24
|
+
* recipient: 'dnedry',
|
|
25
|
+
* repeats: [
|
|
26
|
+
* { ... },
|
|
27
|
+
* ],
|
|
28
|
+
* scheduled_at: null,
|
|
29
|
+
* tenant: 'acme_corp',
|
|
30
|
+
* workflow: 'comment-created',
|
|
31
|
+
* },
|
|
32
|
+
* {
|
|
33
|
+
* data: { ... },
|
|
34
|
+
* ending_at: null,
|
|
35
|
+
* recipient: 'esattler',
|
|
36
|
+
* repeats: [
|
|
37
|
+
* { ... },
|
|
38
|
+
* ],
|
|
39
|
+
* scheduled_at: null,
|
|
40
|
+
* tenant: 'acme_corp',
|
|
41
|
+
* workflow: 'comment-created',
|
|
42
|
+
* },
|
|
43
|
+
* ],
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
16
46
|
*/
|
|
17
47
|
create(body: BulkCreateParams, options?: RequestOptions): APIPromise<BulkOperationsAPI.BulkOperation> {
|
|
18
48
|
return this._client.post('/v1/schedules/bulk/create', { body, ...options });
|
|
@@ -18,6 +18,35 @@ export class Schedules extends APIResource {
|
|
|
18
18
|
* handles
|
|
19
19
|
* [inline identifications](/managing-recipients/identifying-recipients#inline-identifying-recipients)
|
|
20
20
|
* for the `actor`, `recipient`, and `tenant` fields.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const schedules = await client.schedules.create({
|
|
25
|
+
* recipients: ['user_123'],
|
|
26
|
+
* repeats: [
|
|
27
|
+
* {
|
|
28
|
+
* __typename: 'ScheduleRepeat',
|
|
29
|
+
* day_of_month: null,
|
|
30
|
+
* days: [
|
|
31
|
+
* 'mon',
|
|
32
|
+
* 'tue',
|
|
33
|
+
* 'wed',
|
|
34
|
+
* 'thu',
|
|
35
|
+
* 'fri',
|
|
36
|
+
* 'sat',
|
|
37
|
+
* 'sun',
|
|
38
|
+
* ],
|
|
39
|
+
* frequency: 'daily',
|
|
40
|
+
* hours: null,
|
|
41
|
+
* interval: 1,
|
|
42
|
+
* minutes: null,
|
|
43
|
+
* },
|
|
44
|
+
* ],
|
|
45
|
+
* workflow: 'comment-created',
|
|
46
|
+
* data: { key: 'value' },
|
|
47
|
+
* tenant: 'acme_corp',
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
21
50
|
*/
|
|
22
51
|
create(body: ScheduleCreateParams, options?: RequestOptions): APIPromise<ScheduleCreateResponse> {
|
|
23
52
|
return this._client.post('/v1/schedules', { body, ...options });
|
|
@@ -29,6 +58,34 @@ export class Schedules extends APIResource {
|
|
|
29
58
|
* This endpoint also handles
|
|
30
59
|
* [inline identifications](/managing-recipients/identifying-recipients#inline-identifying-recipients)
|
|
31
60
|
* for the `actor`, `recipient`, and `tenant` fields.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* const schedules = await client.schedules.update({
|
|
65
|
+
* schedule_ids: ['123e4567-e89b-12d3-a456-426614174000'],
|
|
66
|
+
* data: { key: 'value' },
|
|
67
|
+
* repeats: [
|
|
68
|
+
* {
|
|
69
|
+
* __typename: 'ScheduleRepeat',
|
|
70
|
+
* day_of_month: null,
|
|
71
|
+
* days: [
|
|
72
|
+
* 'mon',
|
|
73
|
+
* 'tue',
|
|
74
|
+
* 'wed',
|
|
75
|
+
* 'thu',
|
|
76
|
+
* 'fri',
|
|
77
|
+
* 'sat',
|
|
78
|
+
* 'sun',
|
|
79
|
+
* ],
|
|
80
|
+
* frequency: 'daily',
|
|
81
|
+
* hours: null,
|
|
82
|
+
* interval: 1,
|
|
83
|
+
* minutes: null,
|
|
84
|
+
* },
|
|
85
|
+
* ],
|
|
86
|
+
* tenant: 'acme_corp',
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
32
89
|
*/
|
|
33
90
|
update(body: ScheduleUpdateParams, options?: RequestOptions): APIPromise<ScheduleUpdateResponse> {
|
|
34
91
|
return this._client.put('/v1/schedules', { body, ...options });
|
|
@@ -37,6 +94,16 @@ export class Schedules extends APIResource {
|
|
|
37
94
|
/**
|
|
38
95
|
* Returns a paginated list of schedules for the current environment, filtered by
|
|
39
96
|
* workflow and optionally by recipients and tenant.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* // Automatically fetches more pages as needed.
|
|
101
|
+
* for await (const schedule of client.schedules.list({
|
|
102
|
+
* workflow: 'workflow',
|
|
103
|
+
* })) {
|
|
104
|
+
* // ...
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
40
107
|
*/
|
|
41
108
|
list(query: ScheduleListParams, options?: RequestOptions): PagePromise<SchedulesEntriesCursor, Schedule> {
|
|
42
109
|
return this._client.getAPIList('/v1/schedules', EntriesCursor<Schedule>, { query, ...options });
|
|
@@ -45,6 +112,13 @@ export class Schedules extends APIResource {
|
|
|
45
112
|
/**
|
|
46
113
|
* Permanently deletes one or more schedules identified by the provided schedule
|
|
47
114
|
* IDs. This operation cannot be undone.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```ts
|
|
118
|
+
* const schedules = await client.schedules.delete({
|
|
119
|
+
* schedule_ids: ['123e4567-e89b-12d3-a456-426614174000'],
|
|
120
|
+
* });
|
|
121
|
+
* ```
|
|
48
122
|
*/
|
|
49
123
|
delete(body: ScheduleDeleteParams, options?: RequestOptions): APIPromise<ScheduleDeleteResponse> {
|
|
50
124
|
return this._client.delete('/v1/schedules', { body, ...options });
|
|
@@ -9,6 +9,13 @@ import { RequestOptions } from '../../internal/request-options';
|
|
|
9
9
|
export class Bulk extends APIResource {
|
|
10
10
|
/**
|
|
11
11
|
* Delete multiple tenants in a single operation. This operation cannot be undone.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const bulkOperation = await client.tenants.bulk.delete({
|
|
16
|
+
* tenant_ids: ['string'],
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
12
19
|
*/
|
|
13
20
|
delete(params: BulkDeleteParams, options?: RequestOptions): APIPromise<BulkOperationsAPI.BulkOperation> {
|
|
14
21
|
const { tenant_ids } = params;
|
|
@@ -17,6 +24,13 @@ export class Bulk extends APIResource {
|
|
|
17
24
|
|
|
18
25
|
/**
|
|
19
26
|
* Set or update up to 1,000 tenants in a single operation.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const bulkOperation = await client.tenants.bulk.set({
|
|
31
|
+
* tenants: ['[object Object]'],
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
20
34
|
*/
|
|
21
35
|
set(body: BulkSetParams, options?: RequestOptions): APIPromise<BulkOperationsAPI.BulkOperation> {
|
|
22
36
|
return this._client.post('/v1/tenants/bulk/set', { body, ...options });
|
|
@@ -15,6 +15,14 @@ export class Tenants extends APIResource {
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* List tenants for the current environment.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* // Automatically fetches more pages as needed.
|
|
22
|
+
* for await (const tenant of client.tenants.list()) {
|
|
23
|
+
* // ...
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
18
26
|
*/
|
|
19
27
|
list(
|
|
20
28
|
query: TenantListParams | null | undefined = {},
|
|
@@ -25,6 +33,11 @@ export class Tenants extends APIResource {
|
|
|
25
33
|
|
|
26
34
|
/**
|
|
27
35
|
* Delete a tenant and all associated data. This operation cannot be undone.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const tenant = await client.tenants.delete('id');
|
|
40
|
+
* ```
|
|
28
41
|
*/
|
|
29
42
|
delete(id: string, options?: RequestOptions): APIPromise<string> {
|
|
30
43
|
return this._client.delete(path`/v1/tenants/${id}`, options);
|
|
@@ -32,6 +45,11 @@ export class Tenants extends APIResource {
|
|
|
32
45
|
|
|
33
46
|
/**
|
|
34
47
|
* Get a tenant by ID.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const tenant = await client.tenants.get('id');
|
|
52
|
+
* ```
|
|
35
53
|
*/
|
|
36
54
|
get(id: string, options?: RequestOptions): APIPromise<Tenant> {
|
|
37
55
|
return this._client.get(path`/v1/tenants/${id}`, options);
|
|
@@ -40,6 +58,21 @@ export class Tenants extends APIResource {
|
|
|
40
58
|
/**
|
|
41
59
|
* Sets a tenant within an environment, performing an upsert operation. Any
|
|
42
60
|
* existing properties will be merged with the incoming properties.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* const tenant = await client.tenants.set('id', {
|
|
65
|
+
* settings: {
|
|
66
|
+
* branding: {
|
|
67
|
+
* icon_url:
|
|
68
|
+
* 'https://example.com/trex_silhouette_icon.png',
|
|
69
|
+
* logo_url: 'https://example.com/amber_fossil_logo.png',
|
|
70
|
+
* primary_color: '#DF1A22',
|
|
71
|
+
* primary_color_contrast: '#FFDE00',
|
|
72
|
+
* },
|
|
73
|
+
* },
|
|
74
|
+
* });
|
|
75
|
+
* ```
|
|
43
76
|
*/
|
|
44
77
|
set(id: string, body: TenantSetParams, options?: RequestOptions): APIPromise<Tenant> {
|
|
45
78
|
return this._client.put(path`/v1/tenants/${id}`, { body, ...options });
|
|
@@ -11,6 +11,13 @@ export class Bulk extends APIResource {
|
|
|
11
11
|
/**
|
|
12
12
|
* Deletes multiple users in a single operation. Accepts up to 100 user IDs to
|
|
13
13
|
* delete and returns a bulk operation that can be queried for progress.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const bulkOperation = await client.users.bulk.delete({
|
|
18
|
+
* user_ids: ['user_1', 'user_2'],
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
14
21
|
*/
|
|
15
22
|
delete(body: BulkDeleteParams, options?: RequestOptions): APIPromise<BulkOperationsAPI.BulkOperation> {
|
|
16
23
|
return this._client.post('/v1/users/bulk/delete', { body, ...options });
|
|
@@ -20,6 +27,20 @@ export class Bulk extends APIResource {
|
|
|
20
27
|
* Identifies multiple users in a single operation. Allows creating or updating up
|
|
21
28
|
* to 100 users in a single batch with various properties, preferences, and channel
|
|
22
29
|
* data.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const bulkOperation = await client.users.bulk.identify({
|
|
34
|
+
* users: [
|
|
35
|
+
* {
|
|
36
|
+
* email: 'jane@ingen.net',
|
|
37
|
+
* id: 'user_1',
|
|
38
|
+
* name: 'Jane Doe',
|
|
39
|
+
* timezone: 'America/New_York',
|
|
40
|
+
* },
|
|
41
|
+
* ],
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
23
44
|
*/
|
|
24
45
|
identify(body: BulkIdentifyParams, options?: RequestOptions): APIPromise<BulkOperationsAPI.BulkOperation> {
|
|
25
46
|
return this._client.post('/v1/users/bulk/identify', { body, ...options });
|
|
@@ -29,6 +50,26 @@ export class Bulk extends APIResource {
|
|
|
29
50
|
* Sets preferences for multiple users in a single operation. Supports either
|
|
30
51
|
* setting the same preferences for multiple users or specific preferences for each
|
|
31
52
|
* user.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* const bulkOperation =
|
|
57
|
+
* await client.users.bulk.setPreferences({
|
|
58
|
+
* preferences: {
|
|
59
|
+
* categories: {
|
|
60
|
+
* marketing: false,
|
|
61
|
+
* transactional: { channel_types: { email: false } },
|
|
62
|
+
* },
|
|
63
|
+
* channel_types: { email: true },
|
|
64
|
+
* workflows: {
|
|
65
|
+
* 'dinosaurs-loose': {
|
|
66
|
+
* channel_types: { email: false },
|
|
67
|
+
* },
|
|
68
|
+
* },
|
|
69
|
+
* },
|
|
70
|
+
* user_ids: ['user_1', 'user_2'],
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
32
73
|
*/
|
|
33
74
|
setPreferences(
|
|
34
75
|
body: BulkSetPreferencesParams,
|