@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
|
@@ -1,32 +1,10 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
4
|
exports.Objects = void 0;
|
|
5
|
+
const tslib_1 = require("../../internal/tslib.js");
|
|
28
6
|
const resource_1 = require("../../core/resource.js");
|
|
29
|
-
const BulkAPI = __importStar(require("./bulk.js"));
|
|
7
|
+
const BulkAPI = tslib_1.__importStar(require("./bulk.js"));
|
|
30
8
|
const bulk_1 = require("./bulk.js");
|
|
31
9
|
const pagination_1 = require("../../core/pagination.js");
|
|
32
10
|
const path_1 = require("../../internal/utils/path.js");
|
|
@@ -38,6 +16,16 @@ class Objects extends resource_1.APIResource {
|
|
|
38
16
|
/**
|
|
39
17
|
* Returns a paginated list of objects from the specified collection. Optionally
|
|
40
18
|
* includes preference data for the objects.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* // Automatically fetches more pages as needed.
|
|
23
|
+
* for await (const object of client.objects.list(
|
|
24
|
+
* 'collection',
|
|
25
|
+
* )) {
|
|
26
|
+
* // ...
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
41
29
|
*/
|
|
42
30
|
list(collection, query = {}, options) {
|
|
43
31
|
return this._client.getAPIList((0, path_1.path) `/v1/objects/${collection}`, (pagination_1.EntriesCursor), {
|
|
@@ -48,6 +36,14 @@ class Objects extends resource_1.APIResource {
|
|
|
48
36
|
/**
|
|
49
37
|
* Permanently removes an object from the specified collection. This operation
|
|
50
38
|
* cannot be undone.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const object = await client.objects.delete(
|
|
43
|
+
* 'collection',
|
|
44
|
+
* 'id',
|
|
45
|
+
* );
|
|
46
|
+
* ```
|
|
51
47
|
*/
|
|
52
48
|
delete(collection, id, options) {
|
|
53
49
|
return this._client.delete((0, path_1.path) `/v1/objects/${collection}/${id}`, options);
|
|
@@ -57,6 +53,18 @@ class Objects extends resource_1.APIResource {
|
|
|
57
53
|
* updated. This endpoint also handles
|
|
58
54
|
* [inline identifications](/managing-recipients/identifying-recipients#inline-identifying-recipients)
|
|
59
55
|
* for the `recipient`.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* const subscriptions = await client.objects.addSubscriptions(
|
|
60
|
+
* 'collection',
|
|
61
|
+
* 'object_id',
|
|
62
|
+
* {
|
|
63
|
+
* recipients: ['user_1', 'user_2'],
|
|
64
|
+
* properties: { key: 'value' },
|
|
65
|
+
* },
|
|
66
|
+
* );
|
|
67
|
+
* ```
|
|
60
68
|
*/
|
|
61
69
|
addSubscriptions(collection, objectID, body, options) {
|
|
62
70
|
return this._client.post((0, path_1.path) `/v1/objects/${collection}/${objectID}/subscriptions`, { body, ...options });
|
|
@@ -64,6 +72,16 @@ class Objects extends resource_1.APIResource {
|
|
|
64
72
|
/**
|
|
65
73
|
* Delete subscriptions for the specified recipients from an object. Returns the
|
|
66
74
|
* list of deleted subscriptions.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* const subscriptions =
|
|
79
|
+
* await client.objects.deleteSubscriptions(
|
|
80
|
+
* 'collection',
|
|
81
|
+
* 'object_id',
|
|
82
|
+
* { recipients: ['user_123'] },
|
|
83
|
+
* );
|
|
84
|
+
* ```
|
|
67
85
|
*/
|
|
68
86
|
deleteSubscriptions(collection, objectID, body, options) {
|
|
69
87
|
return this._client.delete((0, path_1.path) `/v1/objects/${collection}/${objectID}/subscriptions`, {
|
|
@@ -74,18 +92,41 @@ class Objects extends resource_1.APIResource {
|
|
|
74
92
|
/**
|
|
75
93
|
* Retrieves a specific object by its ID from the specified collection. Returns the
|
|
76
94
|
* object with all its properties.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* const object = await client.objects.get('collection', 'id');
|
|
99
|
+
* ```
|
|
77
100
|
*/
|
|
78
101
|
get(collection, id, options) {
|
|
79
102
|
return this._client.get((0, path_1.path) `/v1/objects/${collection}/${id}`, options);
|
|
80
103
|
}
|
|
81
104
|
/**
|
|
82
105
|
* Returns the channel data for the specified object and channel.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```ts
|
|
109
|
+
* const channelData = await client.objects.getChannelData(
|
|
110
|
+
* 'collection',
|
|
111
|
+
* 'object_id',
|
|
112
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
113
|
+
* );
|
|
114
|
+
* ```
|
|
83
115
|
*/
|
|
84
116
|
getChannelData(collection, objectID, channelID, options) {
|
|
85
117
|
return this._client.get((0, path_1.path) `/v1/objects/${collection}/${objectID}/channel_data/${channelID}`, options);
|
|
86
118
|
}
|
|
87
119
|
/**
|
|
88
120
|
* Returns the preference set for the specified object and preference set `id`.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* const preferenceSet = await client.objects.getPreferences(
|
|
125
|
+
* 'collection',
|
|
126
|
+
* 'object_id',
|
|
127
|
+
* 'default',
|
|
128
|
+
* );
|
|
129
|
+
* ```
|
|
89
130
|
*/
|
|
90
131
|
getPreferences(collection, objectID, id, options) {
|
|
91
132
|
return this._client.get((0, path_1.path) `/v1/objects/${collection}/${objectID}/preferences/${id}`, options);
|
|
@@ -94,18 +135,48 @@ class Objects extends resource_1.APIResource {
|
|
|
94
135
|
* Returns a paginated list of messages for a specific object in the given
|
|
95
136
|
* collection. Allows filtering by message status and provides various sorting
|
|
96
137
|
* options.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* // Automatically fetches more pages as needed.
|
|
142
|
+
* for await (const message of client.objects.listMessages(
|
|
143
|
+
* 'projects',
|
|
144
|
+
* 'project-123',
|
|
145
|
+
* )) {
|
|
146
|
+
* // ...
|
|
147
|
+
* }
|
|
148
|
+
* ```
|
|
97
149
|
*/
|
|
98
150
|
listMessages(collection, id, query = {}, options) {
|
|
99
151
|
return this._client.getAPIList((0, path_1.path) `/v1/objects/${collection}/${id}/messages`, (pagination_1.EntriesCursor), { query, ...options });
|
|
100
152
|
}
|
|
101
153
|
/**
|
|
102
154
|
* Returns a paginated list of preference sets for the specified object.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```ts
|
|
158
|
+
* const preferenceSets = await client.objects.listPreferences(
|
|
159
|
+
* 'collection',
|
|
160
|
+
* 'object_id',
|
|
161
|
+
* );
|
|
162
|
+
* ```
|
|
103
163
|
*/
|
|
104
164
|
listPreferences(collection, objectID, options) {
|
|
105
165
|
return this._client.get((0, path_1.path) `/v1/objects/${collection}/${objectID}/preferences`, options);
|
|
106
166
|
}
|
|
107
167
|
/**
|
|
108
168
|
* Returns a paginated list of schedules for an object.
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```ts
|
|
172
|
+
* // Automatically fetches more pages as needed.
|
|
173
|
+
* for await (const schedule of client.objects.listSchedules(
|
|
174
|
+
* 'collection',
|
|
175
|
+
* 'id',
|
|
176
|
+
* )) {
|
|
177
|
+
* // ...
|
|
178
|
+
* }
|
|
179
|
+
* ```
|
|
109
180
|
*/
|
|
110
181
|
listSchedules(collection, id, query = {}, options) {
|
|
111
182
|
return this._client.getAPIList((0, path_1.path) `/v1/objects/${collection}/${id}/schedules`, (pagination_1.EntriesCursor), { query, ...options });
|
|
@@ -114,6 +185,17 @@ class Objects extends resource_1.APIResource {
|
|
|
114
185
|
* List subscriptions for an object. Either list the recipients that subscribe to
|
|
115
186
|
* the provided object, or list the objects that the provided object is subscribed
|
|
116
187
|
* to. Determined by the `mode` query parameter.
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```ts
|
|
191
|
+
* // Automatically fetches more pages as needed.
|
|
192
|
+
* for await (const subscription of client.objects.listSubscriptions(
|
|
193
|
+
* 'collection',
|
|
194
|
+
* 'object_id',
|
|
195
|
+
* )) {
|
|
196
|
+
* // ...
|
|
197
|
+
* }
|
|
198
|
+
* ```
|
|
117
199
|
*/
|
|
118
200
|
listSubscriptions(collection, objectID, query = {}, options) {
|
|
119
201
|
return this._client.getAPIList((0, path_1.path) `/v1/objects/${collection}/${objectID}/subscriptions`, (pagination_1.EntriesCursor), { query, ...options });
|
|
@@ -122,6 +204,33 @@ class Objects extends resource_1.APIResource {
|
|
|
122
204
|
* Creates a new object or updates an existing one in the specified collection.
|
|
123
205
|
* This operation is used to identify objects with their properties, as well as
|
|
124
206
|
* optional preferences and channel data.
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```ts
|
|
210
|
+
* const object = await client.objects.set(
|
|
211
|
+
* 'collection',
|
|
212
|
+
* 'id',
|
|
213
|
+
* {
|
|
214
|
+
* channel_data: {
|
|
215
|
+
* '97c5837d-c65c-4d54-aa39-080eeb81c69d': {
|
|
216
|
+
* data: { tokens: ['push_token_123'] },
|
|
217
|
+
* },
|
|
218
|
+
* },
|
|
219
|
+
* locale: 'en-US',
|
|
220
|
+
* preferences: {
|
|
221
|
+
* default: {
|
|
222
|
+
* channel_types: { email: true },
|
|
223
|
+
* workflows: {
|
|
224
|
+
* 'dinosaurs-loose': {
|
|
225
|
+
* channel_types: { email: true },
|
|
226
|
+
* },
|
|
227
|
+
* },
|
|
228
|
+
* },
|
|
229
|
+
* },
|
|
230
|
+
* timezone: 'America/New_York',
|
|
231
|
+
* },
|
|
232
|
+
* );
|
|
233
|
+
* ```
|
|
125
234
|
*/
|
|
126
235
|
set(collection, id, body, options) {
|
|
127
236
|
return this._client.put((0, path_1.path) `/v1/objects/${collection}/${id}`, { body, ...options });
|
|
@@ -130,6 +239,16 @@ class Objects extends resource_1.APIResource {
|
|
|
130
239
|
* Sets the channel data for the specified object and channel. If no object exists
|
|
131
240
|
* in the current environment for the given `collection` and `object_id`, Knock
|
|
132
241
|
* will create the object as part of this request.
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```ts
|
|
245
|
+
* const channelData = await client.objects.setChannelData(
|
|
246
|
+
* 'collection',
|
|
247
|
+
* 'object_id',
|
|
248
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
249
|
+
* { data: { tokens: ['push_token_1'] } },
|
|
250
|
+
* );
|
|
251
|
+
* ```
|
|
133
252
|
*/
|
|
134
253
|
setChannelData(collection, objectID, channelID, body, options) {
|
|
135
254
|
return this._client.put((0, path_1.path) `/v1/objects/${collection}/${objectID}/channel_data/${channelID}`, {
|
|
@@ -144,6 +263,27 @@ class Objects extends resource_1.APIResource {
|
|
|
144
263
|
* `:object_id`, Knock will create the object as part of this request. The
|
|
145
264
|
* preference set `:id` can be either `default` or a `tenant.id`. Learn more about
|
|
146
265
|
* [per-tenant preferences](/preferences/tenant-preferences).
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* ```ts
|
|
269
|
+
* const preferenceSet = await client.objects.setPreferences(
|
|
270
|
+
* 'collection',
|
|
271
|
+
* 'object_id',
|
|
272
|
+
* 'default',
|
|
273
|
+
* {
|
|
274
|
+
* categories: {
|
|
275
|
+
* marketing: false,
|
|
276
|
+
* transactional: { channel_types: { email: false } },
|
|
277
|
+
* },
|
|
278
|
+
* channel_types: { email: true },
|
|
279
|
+
* workflows: {
|
|
280
|
+
* 'dinosaurs-loose': {
|
|
281
|
+
* channel_types: { email: false },
|
|
282
|
+
* },
|
|
283
|
+
* },
|
|
284
|
+
* },
|
|
285
|
+
* );
|
|
286
|
+
* ```
|
|
147
287
|
*/
|
|
148
288
|
setPreferences(collection, objectID, id, body, options) {
|
|
149
289
|
return this._client.put((0, path_1.path) `/v1/objects/${collection}/${objectID}/preferences/${id}`, {
|
|
@@ -153,6 +293,15 @@ class Objects extends resource_1.APIResource {
|
|
|
153
293
|
}
|
|
154
294
|
/**
|
|
155
295
|
* Unsets the channel data for the specified object and channel.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```ts
|
|
299
|
+
* const response = await client.objects.unsetChannelData(
|
|
300
|
+
* 'collection',
|
|
301
|
+
* 'object_id',
|
|
302
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
303
|
+
* );
|
|
304
|
+
* ```
|
|
156
305
|
*/
|
|
157
306
|
unsetChannelData(collection, objectID, channelID, options) {
|
|
158
307
|
return this._client.delete((0, path_1.path) `/v1/objects/${collection}/${objectID}/channel_data/${channelID}`, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objects.js","sourceRoot":"","sources":["../../src/resources/objects/objects.ts"],"names":[],"mappings":";AAAA,sFAAsF
|
|
1
|
+
{"version":3,"file":"objects.js","sourceRoot":"","sources":["../../src/resources/objects/objects.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAIlD,2DAAkC;AAClC,oCAA2F;AAS3F,yDAA6F;AAE7F,uDAAiD;AAEjD,MAAa,OAAQ,SAAQ,sBAAW;IAAxC;;QACE,SAAI,GAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAgYtD,CAAC;IA9XC;;;;;;;;;;;;;OAaG;IACH,IAAI,CACF,UAAkB,EAClB,QAA6C,EAAE,EAC/C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAA,WAAI,EAAA,eAAe,UAAU,EAAE,EAAE,CAAA,0BAAqB,CAAA,EAAE;YACrF,KAAK;YACL,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,UAAkB,EAAE,EAAU,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,eAAe,UAAU,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC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AU,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvF,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,cAAc,CACZ,UAAkB,EAClB,QAAgB,EAChB,SAAiB,EACjB,IAAgC,EAChC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,eAAe,UAAU,IAAI,QAAQ,iBAAiB,SAAS,EAAE,EAAE;YAC7F,IAAI;YACJ,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,cAAc,CACZ,UAAkB,EAClB,QAAgB,EAChB,EAAU,EACV,IAAgC,EAChC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,eAAe,UAAU,IAAI,QAAQ,gBAAgB,EAAE,EAAE,EAAE;YACrF,IAAI;YACJ,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;OAWG;IACH,gBAAgB,CACd,UAAkB,EAClB,QAAgB,EAChB,SAAiB,EACjB,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CACxB,IAAA,WAAI,EAAA,eAAe,UAAU,IAAI,QAAQ,iBAAiB,SAAS,EAAE,EACrE,OAAO,CACR,CAAC;IACJ,CAAC;CACF;AAjYD,0BAiYC;AAqWD,OAAO,CAAC,IAAI,GAAG,WAAI,CAAC"}
|
|
@@ -12,6 +12,16 @@ export class Objects extends APIResource {
|
|
|
12
12
|
/**
|
|
13
13
|
* Returns a paginated list of objects from the specified collection. Optionally
|
|
14
14
|
* includes preference data for the objects.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* // Automatically fetches more pages as needed.
|
|
19
|
+
* for await (const object of client.objects.list(
|
|
20
|
+
* 'collection',
|
|
21
|
+
* )) {
|
|
22
|
+
* // ...
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
15
25
|
*/
|
|
16
26
|
list(collection, query = {}, options) {
|
|
17
27
|
return this._client.getAPIList(path `/v1/objects/${collection}`, (EntriesCursor), {
|
|
@@ -22,6 +32,14 @@ export class Objects extends APIResource {
|
|
|
22
32
|
/**
|
|
23
33
|
* Permanently removes an object from the specified collection. This operation
|
|
24
34
|
* cannot be undone.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const object = await client.objects.delete(
|
|
39
|
+
* 'collection',
|
|
40
|
+
* 'id',
|
|
41
|
+
* );
|
|
42
|
+
* ```
|
|
25
43
|
*/
|
|
26
44
|
delete(collection, id, options) {
|
|
27
45
|
return this._client.delete(path `/v1/objects/${collection}/${id}`, options);
|
|
@@ -31,6 +49,18 @@ export class Objects extends APIResource {
|
|
|
31
49
|
* updated. This endpoint also handles
|
|
32
50
|
* [inline identifications](/managing-recipients/identifying-recipients#inline-identifying-recipients)
|
|
33
51
|
* for the `recipient`.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* const subscriptions = await client.objects.addSubscriptions(
|
|
56
|
+
* 'collection',
|
|
57
|
+
* 'object_id',
|
|
58
|
+
* {
|
|
59
|
+
* recipients: ['user_1', 'user_2'],
|
|
60
|
+
* properties: { key: 'value' },
|
|
61
|
+
* },
|
|
62
|
+
* );
|
|
63
|
+
* ```
|
|
34
64
|
*/
|
|
35
65
|
addSubscriptions(collection, objectID, body, options) {
|
|
36
66
|
return this._client.post(path `/v1/objects/${collection}/${objectID}/subscriptions`, { body, ...options });
|
|
@@ -38,6 +68,16 @@ export class Objects extends APIResource {
|
|
|
38
68
|
/**
|
|
39
69
|
* Delete subscriptions for the specified recipients from an object. Returns the
|
|
40
70
|
* list of deleted subscriptions.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* const subscriptions =
|
|
75
|
+
* await client.objects.deleteSubscriptions(
|
|
76
|
+
* 'collection',
|
|
77
|
+
* 'object_id',
|
|
78
|
+
* { recipients: ['user_123'] },
|
|
79
|
+
* );
|
|
80
|
+
* ```
|
|
41
81
|
*/
|
|
42
82
|
deleteSubscriptions(collection, objectID, body, options) {
|
|
43
83
|
return this._client.delete(path `/v1/objects/${collection}/${objectID}/subscriptions`, {
|
|
@@ -48,18 +88,41 @@ export class Objects extends APIResource {
|
|
|
48
88
|
/**
|
|
49
89
|
* Retrieves a specific object by its ID from the specified collection. Returns the
|
|
50
90
|
* object with all its properties.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* const object = await client.objects.get('collection', 'id');
|
|
95
|
+
* ```
|
|
51
96
|
*/
|
|
52
97
|
get(collection, id, options) {
|
|
53
98
|
return this._client.get(path `/v1/objects/${collection}/${id}`, options);
|
|
54
99
|
}
|
|
55
100
|
/**
|
|
56
101
|
* Returns the channel data for the specified object and channel.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* const channelData = await client.objects.getChannelData(
|
|
106
|
+
* 'collection',
|
|
107
|
+
* 'object_id',
|
|
108
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
109
|
+
* );
|
|
110
|
+
* ```
|
|
57
111
|
*/
|
|
58
112
|
getChannelData(collection, objectID, channelID, options) {
|
|
59
113
|
return this._client.get(path `/v1/objects/${collection}/${objectID}/channel_data/${channelID}`, options);
|
|
60
114
|
}
|
|
61
115
|
/**
|
|
62
116
|
* Returns the preference set for the specified object and preference set `id`.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* const preferenceSet = await client.objects.getPreferences(
|
|
121
|
+
* 'collection',
|
|
122
|
+
* 'object_id',
|
|
123
|
+
* 'default',
|
|
124
|
+
* );
|
|
125
|
+
* ```
|
|
63
126
|
*/
|
|
64
127
|
getPreferences(collection, objectID, id, options) {
|
|
65
128
|
return this._client.get(path `/v1/objects/${collection}/${objectID}/preferences/${id}`, options);
|
|
@@ -68,18 +131,48 @@ export class Objects extends APIResource {
|
|
|
68
131
|
* Returns a paginated list of messages for a specific object in the given
|
|
69
132
|
* collection. Allows filtering by message status and provides various sorting
|
|
70
133
|
* options.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* // Automatically fetches more pages as needed.
|
|
138
|
+
* for await (const message of client.objects.listMessages(
|
|
139
|
+
* 'projects',
|
|
140
|
+
* 'project-123',
|
|
141
|
+
* )) {
|
|
142
|
+
* // ...
|
|
143
|
+
* }
|
|
144
|
+
* ```
|
|
71
145
|
*/
|
|
72
146
|
listMessages(collection, id, query = {}, options) {
|
|
73
147
|
return this._client.getAPIList(path `/v1/objects/${collection}/${id}/messages`, (EntriesCursor), { query, ...options });
|
|
74
148
|
}
|
|
75
149
|
/**
|
|
76
150
|
* Returns a paginated list of preference sets for the specified object.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```ts
|
|
154
|
+
* const preferenceSets = await client.objects.listPreferences(
|
|
155
|
+
* 'collection',
|
|
156
|
+
* 'object_id',
|
|
157
|
+
* );
|
|
158
|
+
* ```
|
|
77
159
|
*/
|
|
78
160
|
listPreferences(collection, objectID, options) {
|
|
79
161
|
return this._client.get(path `/v1/objects/${collection}/${objectID}/preferences`, options);
|
|
80
162
|
}
|
|
81
163
|
/**
|
|
82
164
|
* Returns a paginated list of schedules for an object.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```ts
|
|
168
|
+
* // Automatically fetches more pages as needed.
|
|
169
|
+
* for await (const schedule of client.objects.listSchedules(
|
|
170
|
+
* 'collection',
|
|
171
|
+
* 'id',
|
|
172
|
+
* )) {
|
|
173
|
+
* // ...
|
|
174
|
+
* }
|
|
175
|
+
* ```
|
|
83
176
|
*/
|
|
84
177
|
listSchedules(collection, id, query = {}, options) {
|
|
85
178
|
return this._client.getAPIList(path `/v1/objects/${collection}/${id}/schedules`, (EntriesCursor), { query, ...options });
|
|
@@ -88,6 +181,17 @@ export class Objects extends APIResource {
|
|
|
88
181
|
* List subscriptions for an object. Either list the recipients that subscribe to
|
|
89
182
|
* the provided object, or list the objects that the provided object is subscribed
|
|
90
183
|
* to. Determined by the `mode` query parameter.
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```ts
|
|
187
|
+
* // Automatically fetches more pages as needed.
|
|
188
|
+
* for await (const subscription of client.objects.listSubscriptions(
|
|
189
|
+
* 'collection',
|
|
190
|
+
* 'object_id',
|
|
191
|
+
* )) {
|
|
192
|
+
* // ...
|
|
193
|
+
* }
|
|
194
|
+
* ```
|
|
91
195
|
*/
|
|
92
196
|
listSubscriptions(collection, objectID, query = {}, options) {
|
|
93
197
|
return this._client.getAPIList(path `/v1/objects/${collection}/${objectID}/subscriptions`, (EntriesCursor), { query, ...options });
|
|
@@ -96,6 +200,33 @@ export class Objects extends APIResource {
|
|
|
96
200
|
* Creates a new object or updates an existing one in the specified collection.
|
|
97
201
|
* This operation is used to identify objects with their properties, as well as
|
|
98
202
|
* optional preferences and channel data.
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```ts
|
|
206
|
+
* const object = await client.objects.set(
|
|
207
|
+
* 'collection',
|
|
208
|
+
* 'id',
|
|
209
|
+
* {
|
|
210
|
+
* channel_data: {
|
|
211
|
+
* '97c5837d-c65c-4d54-aa39-080eeb81c69d': {
|
|
212
|
+
* data: { tokens: ['push_token_123'] },
|
|
213
|
+
* },
|
|
214
|
+
* },
|
|
215
|
+
* locale: 'en-US',
|
|
216
|
+
* preferences: {
|
|
217
|
+
* default: {
|
|
218
|
+
* channel_types: { email: true },
|
|
219
|
+
* workflows: {
|
|
220
|
+
* 'dinosaurs-loose': {
|
|
221
|
+
* channel_types: { email: true },
|
|
222
|
+
* },
|
|
223
|
+
* },
|
|
224
|
+
* },
|
|
225
|
+
* },
|
|
226
|
+
* timezone: 'America/New_York',
|
|
227
|
+
* },
|
|
228
|
+
* );
|
|
229
|
+
* ```
|
|
99
230
|
*/
|
|
100
231
|
set(collection, id, body, options) {
|
|
101
232
|
return this._client.put(path `/v1/objects/${collection}/${id}`, { body, ...options });
|
|
@@ -104,6 +235,16 @@ export class Objects extends APIResource {
|
|
|
104
235
|
* Sets the channel data for the specified object and channel. If no object exists
|
|
105
236
|
* in the current environment for the given `collection` and `object_id`, Knock
|
|
106
237
|
* will create the object as part of this request.
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```ts
|
|
241
|
+
* const channelData = await client.objects.setChannelData(
|
|
242
|
+
* 'collection',
|
|
243
|
+
* 'object_id',
|
|
244
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
245
|
+
* { data: { tokens: ['push_token_1'] } },
|
|
246
|
+
* );
|
|
247
|
+
* ```
|
|
107
248
|
*/
|
|
108
249
|
setChannelData(collection, objectID, channelID, body, options) {
|
|
109
250
|
return this._client.put(path `/v1/objects/${collection}/${objectID}/channel_data/${channelID}`, {
|
|
@@ -118,6 +259,27 @@ export class Objects extends APIResource {
|
|
|
118
259
|
* `:object_id`, Knock will create the object as part of this request. The
|
|
119
260
|
* preference set `:id` can be either `default` or a `tenant.id`. Learn more about
|
|
120
261
|
* [per-tenant preferences](/preferences/tenant-preferences).
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* ```ts
|
|
265
|
+
* const preferenceSet = await client.objects.setPreferences(
|
|
266
|
+
* 'collection',
|
|
267
|
+
* 'object_id',
|
|
268
|
+
* 'default',
|
|
269
|
+
* {
|
|
270
|
+
* categories: {
|
|
271
|
+
* marketing: false,
|
|
272
|
+
* transactional: { channel_types: { email: false } },
|
|
273
|
+
* },
|
|
274
|
+
* channel_types: { email: true },
|
|
275
|
+
* workflows: {
|
|
276
|
+
* 'dinosaurs-loose': {
|
|
277
|
+
* channel_types: { email: false },
|
|
278
|
+
* },
|
|
279
|
+
* },
|
|
280
|
+
* },
|
|
281
|
+
* );
|
|
282
|
+
* ```
|
|
121
283
|
*/
|
|
122
284
|
setPreferences(collection, objectID, id, body, options) {
|
|
123
285
|
return this._client.put(path `/v1/objects/${collection}/${objectID}/preferences/${id}`, {
|
|
@@ -127,6 +289,15 @@ export class Objects extends APIResource {
|
|
|
127
289
|
}
|
|
128
290
|
/**
|
|
129
291
|
* Unsets the channel data for the specified object and channel.
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* ```ts
|
|
295
|
+
* const response = await client.objects.unsetChannelData(
|
|
296
|
+
* 'collection',
|
|
297
|
+
* 'object_id',
|
|
298
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
299
|
+
* );
|
|
300
|
+
* ```
|
|
130
301
|
*/
|
|
131
302
|
unsetChannelData(collection, objectID, channelID, options) {
|
|
132
303
|
return this._client.delete(path `/v1/objects/${collection}/${objectID}/channel_data/${channelID}`, options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objects.mjs","sourceRoot":"","sources":["../../src/resources/objects/objects.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAIf,KAAK,OAAO;OACZ,EAAE,IAAI,EAA+D;OASrE,EAAE,aAAa,EAAyC;OAExD,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,OAAQ,SAAQ,WAAW;IAAxC;;QACE,SAAI,GAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"objects.mjs","sourceRoot":"","sources":["../../src/resources/objects/objects.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAIf,KAAK,OAAO;OACZ,EAAE,IAAI,EAA+D;OASrE,EAAE,aAAa,EAAyC;OAExD,EAAE,IAAI,EAA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B,EACjB,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CACxB,IAAI,CAAA,eAAe,UAAU,IAAI,QAAQ,iBAAiB,SAAS,EAAE,EACrE,OAAO,CACR,CAAC;IACJ,CAAC;CACF;AAqWD,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC"}
|
package/resources/objects.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("./objects/index.js"), exports);
|
|
19
6
|
//# sourceMappingURL=objects.js.map
|
package/resources/objects.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objects.js","sourceRoot":"","sources":["../src/resources/objects.ts"],"names":[],"mappings":";AAAA,sFAAsF
|
|
1
|
+
{"version":3,"file":"objects.js","sourceRoot":"","sources":["../src/resources/objects.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,6DAAgC"}
|