@knocklabs/node 1.29.1 → 1.30.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 +56 -0
- package/client.d.mts +25 -15
- package/client.d.mts.map +1 -1
- package/client.d.ts +25 -15
- package/client.d.ts.map +1 -1
- package/client.js +35 -43
- package/client.js.map +1 -1
- package/client.mjs +35 -43
- package/client.mjs.map +1 -1
- package/internal/tslib.js +17 -17
- package/internal/utils/env.js +2 -2
- package/internal/utils/env.js.map +1 -1
- package/internal/utils/env.mjs +2 -2
- package/internal/utils/env.mjs.map +1 -1
- package/internal/utils/query.d.mts +7 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +7 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +32 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +28 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils.d.mts +1 -0
- package/internal/utils.d.ts +1 -0
- package/internal/utils.js +1 -0
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs +1 -0
- package/package.json +12 -1
- package/resources/audiences.d.mts +3 -0
- package/resources/audiences.d.mts.map +1 -1
- package/resources/audiences.d.ts +3 -0
- package/resources/audiences.d.ts.map +1 -1
- package/resources/audiences.js +3 -0
- package/resources/audiences.js.map +1 -1
- package/resources/audiences.mjs +3 -0
- package/resources/audiences.mjs.map +1 -1
- package/resources/bulk-operations.d.mts +3 -0
- package/resources/bulk-operations.d.mts.map +1 -1
- package/resources/bulk-operations.d.ts +3 -0
- package/resources/bulk-operations.d.ts.map +1 -1
- package/resources/bulk-operations.js +3 -0
- package/resources/bulk-operations.js.map +1 -1
- package/resources/bulk-operations.mjs +3 -0
- package/resources/bulk-operations.mjs.map +1 -1
- package/resources/channels/bulk.d.mts +3 -0
- package/resources/channels/bulk.d.mts.map +1 -1
- package/resources/channels/bulk.d.ts +3 -0
- package/resources/channels/bulk.d.ts.map +1 -1
- package/resources/channels/bulk.js +3 -0
- package/resources/channels/bulk.js.map +1 -1
- package/resources/channels/bulk.mjs +3 -0
- package/resources/channels/bulk.mjs.map +1 -1
- package/resources/messages/batch.d.mts +3 -0
- package/resources/messages/batch.d.mts.map +1 -1
- package/resources/messages/batch.d.ts +3 -0
- package/resources/messages/batch.d.ts.map +1 -1
- package/resources/messages/batch.js +3 -0
- package/resources/messages/batch.js.map +1 -1
- package/resources/messages/batch.mjs +3 -0
- package/resources/messages/batch.mjs.map +1 -1
- package/resources/messages/messages.d.mts +4 -1
- package/resources/messages/messages.d.mts.map +1 -1
- package/resources/messages/messages.d.ts +4 -1
- package/resources/messages/messages.d.ts.map +1 -1
- package/resources/messages/messages.js +3 -0
- package/resources/messages/messages.js.map +1 -1
- package/resources/messages/messages.mjs +3 -0
- package/resources/messages/messages.mjs.map +1 -1
- package/resources/objects/bulk.d.mts +3 -0
- package/resources/objects/bulk.d.mts.map +1 -1
- package/resources/objects/bulk.d.ts +3 -0
- package/resources/objects/bulk.d.ts.map +1 -1
- package/resources/objects/bulk.js +3 -0
- package/resources/objects/bulk.js.map +1 -1
- package/resources/objects/bulk.mjs +3 -0
- package/resources/objects/bulk.mjs.map +1 -1
- package/resources/objects/objects.d.mts +16 -0
- package/resources/objects/objects.d.mts.map +1 -1
- package/resources/objects/objects.d.ts +16 -0
- package/resources/objects/objects.d.ts.map +1 -1
- package/resources/objects/objects.js +21 -0
- package/resources/objects/objects.js.map +1 -1
- package/resources/objects/objects.mjs +21 -0
- package/resources/objects/objects.mjs.map +1 -1
- package/resources/providers/ms-teams.d.mts +3 -0
- package/resources/providers/ms-teams.d.mts.map +1 -1
- package/resources/providers/ms-teams.d.ts +3 -0
- package/resources/providers/ms-teams.d.ts.map +1 -1
- package/resources/providers/ms-teams.js +3 -0
- package/resources/providers/ms-teams.js.map +1 -1
- package/resources/providers/ms-teams.mjs +3 -0
- package/resources/providers/ms-teams.mjs.map +1 -1
- package/resources/providers/slack.d.mts +3 -0
- package/resources/providers/slack.d.mts.map +1 -1
- package/resources/providers/slack.d.ts +3 -0
- package/resources/providers/slack.d.ts.map +1 -1
- package/resources/providers/slack.js +3 -0
- package/resources/providers/slack.js.map +1 -1
- package/resources/providers/slack.mjs +3 -0
- package/resources/providers/slack.mjs.map +1 -1
- package/resources/schedules/bulk.d.mts +3 -0
- package/resources/schedules/bulk.d.mts.map +1 -1
- package/resources/schedules/bulk.d.ts +3 -0
- package/resources/schedules/bulk.d.ts.map +1 -1
- package/resources/schedules/bulk.js +3 -0
- package/resources/schedules/bulk.js.map +1 -1
- package/resources/schedules/bulk.mjs +3 -0
- package/resources/schedules/bulk.mjs.map +1 -1
- package/resources/schedules/schedules.d.mts +3 -0
- package/resources/schedules/schedules.d.mts.map +1 -1
- package/resources/schedules/schedules.d.ts +3 -0
- package/resources/schedules/schedules.d.ts.map +1 -1
- package/resources/schedules/schedules.js +3 -0
- package/resources/schedules/schedules.js.map +1 -1
- package/resources/schedules/schedules.mjs +3 -0
- package/resources/schedules/schedules.mjs.map +1 -1
- package/resources/shared.d.mts +1 -1
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +1 -1
- package/resources/shared.d.ts.map +1 -1
- package/resources/tenants/bulk.d.mts +3 -0
- package/resources/tenants/bulk.d.mts.map +1 -1
- package/resources/tenants/bulk.d.ts +3 -0
- package/resources/tenants/bulk.d.ts.map +1 -1
- package/resources/tenants/bulk.js +3 -0
- package/resources/tenants/bulk.js.map +1 -1
- package/resources/tenants/bulk.mjs +3 -0
- package/resources/tenants/bulk.mjs.map +1 -1
- package/resources/tenants/tenants.d.mts +3 -0
- package/resources/tenants/tenants.d.mts.map +1 -1
- package/resources/tenants/tenants.d.ts +3 -0
- package/resources/tenants/tenants.d.ts.map +1 -1
- package/resources/tenants/tenants.js +3 -0
- package/resources/tenants/tenants.js.map +1 -1
- package/resources/tenants/tenants.mjs +3 -0
- package/resources/tenants/tenants.mjs.map +1 -1
- package/resources/users/bulk.d.mts +3 -0
- package/resources/users/bulk.d.mts.map +1 -1
- package/resources/users/bulk.d.ts +3 -0
- package/resources/users/bulk.d.ts.map +1 -1
- package/resources/users/bulk.js +3 -0
- package/resources/users/bulk.js.map +1 -1
- package/resources/users/bulk.mjs +3 -0
- package/resources/users/bulk.mjs.map +1 -1
- package/resources/users/feeds.d.mts +3 -0
- package/resources/users/feeds.d.mts.map +1 -1
- package/resources/users/feeds.d.ts +3 -0
- package/resources/users/feeds.d.ts.map +1 -1
- package/resources/users/feeds.js +3 -0
- package/resources/users/feeds.js.map +1 -1
- package/resources/users/feeds.mjs +3 -0
- package/resources/users/feeds.mjs.map +1 -1
- package/resources/users/guides.d.mts +7 -0
- package/resources/users/guides.d.mts.map +1 -1
- package/resources/users/guides.d.ts +7 -0
- package/resources/users/guides.d.ts.map +1 -1
- package/resources/users/guides.js +3 -0
- package/resources/users/guides.js.map +1 -1
- package/resources/users/guides.mjs +3 -0
- package/resources/users/guides.mjs.map +1 -1
- package/resources/users/users.d.mts +12 -0
- package/resources/users/users.d.mts.map +1 -1
- package/resources/users/users.d.ts +12 -0
- package/resources/users/users.d.ts.map +1 -1
- package/resources/users/users.js +17 -0
- package/resources/users/users.js.map +1 -1
- package/resources/users/users.mjs +17 -0
- package/resources/users/users.mjs.map +1 -1
- package/resources/workflows.d.mts +3 -0
- package/resources/workflows.d.mts.map +1 -1
- package/resources/workflows.d.ts +3 -0
- package/resources/workflows.d.ts.map +1 -1
- package/resources/workflows.js +3 -0
- package/resources/workflows.js.map +1 -1
- package/resources/workflows.mjs +3 -0
- package/resources/workflows.mjs.map +1 -1
- package/src/client.ts +38 -49
- package/src/internal/utils/env.ts +2 -2
- package/src/internal/utils/query.ts +31 -0
- package/src/internal/utils.ts +1 -0
- package/src/resources/audiences.ts +3 -0
- package/src/resources/bulk-operations.ts +3 -0
- package/src/resources/channels/bulk.ts +3 -0
- package/src/resources/messages/batch.ts +3 -0
- package/src/resources/messages/messages.ts +4 -0
- package/src/resources/objects/bulk.ts +3 -0
- package/src/resources/objects/objects.ts +27 -0
- package/src/resources/providers/ms-teams.ts +3 -0
- package/src/resources/providers/slack.ts +3 -0
- package/src/resources/schedules/bulk.ts +3 -0
- package/src/resources/schedules/schedules.ts +3 -0
- package/src/resources/shared.ts +1 -0
- package/src/resources/tenants/bulk.ts +3 -0
- package/src/resources/tenants/tenants.ts +3 -0
- package/src/resources/users/bulk.ts +3 -0
- package/src/resources/users/feeds.ts +3 -0
- package/src/resources/users/guides.ts +8 -0
- package/src/resources/users/users.ts +18 -0
- package/src/resources/workflows.ts +3 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -9,6 +9,9 @@ import { Guides, } from "./guides.mjs";
|
|
|
9
9
|
import { EntriesCursor, ItemsCursor, } from "../../core/pagination.mjs";
|
|
10
10
|
import { buildHeaders } from "../../internal/headers.mjs";
|
|
11
11
|
import { path } from "../../internal/utils/path.mjs";
|
|
12
|
+
/**
|
|
13
|
+
* A user is an individual from your system, represented in Knock. They are most commonly a recipient of a notification.
|
|
14
|
+
*/
|
|
12
15
|
export class Users extends APIResource {
|
|
13
16
|
constructor() {
|
|
14
17
|
super(...arguments);
|
|
@@ -275,6 +278,20 @@ export class Users extends APIResource {
|
|
|
275
278
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
276
279
|
});
|
|
277
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* Unsets the preference set for the user, removing it entirely.
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* ```ts
|
|
286
|
+
* await client.users.unsetPreferences('user_id', 'default');
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
unsetPreferences(userID, id, options) {
|
|
290
|
+
return this._client.delete(path `/v1/users/${userID}/preferences/${id}`, {
|
|
291
|
+
...options,
|
|
292
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
293
|
+
});
|
|
294
|
+
}
|
|
278
295
|
}
|
|
279
296
|
Users.Feeds = Feeds;
|
|
280
297
|
Users.Guides = Guides;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.mjs","sourceRoot":"","sources":["../../src/resources/users/users.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAWf,KAAK,OAAO;OACZ,EAAE,IAAI,EAAkE;OACxE,KAAK,QAAQ;OACb,EAKL,KAAK,GACN;OACM,KAAK,SAAS;OACd,EASL,MAAM,GACP;OAEM,EACL,aAAa,EAEb,WAAW,GAGZ;OACM,EAAE,YAAY,EAAE;OAEhB,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;OAWf,KAAK,OAAO;OACZ,EAAE,IAAI,EAAkE;OACxE,KAAK,QAAQ;OACb,EAKL,KAAK,GACN;OACM,KAAK,SAAS;OACd,EASL,MAAM,GACP;OAEM,EACL,aAAa,EAEb,WAAW,GAGZ;OACM,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf;;GAEG;AACH,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,I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MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AA8dD,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;AACpB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;AACtB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC"}
|
|
@@ -3,6 +3,9 @@ import * as RecipientsAPI from "./recipients/recipients.mjs";
|
|
|
3
3
|
import * as TenantsAPI from "./tenants/tenants.mjs";
|
|
4
4
|
import { APIPromise } from "../core/api-promise.mjs";
|
|
5
5
|
import { RequestOptions } from "../internal/request-options.mjs";
|
|
6
|
+
/**
|
|
7
|
+
* A workflow is a structured set of steps that is triggered to produce notifications sent over channels.
|
|
8
|
+
*/
|
|
6
9
|
export declare class Workflows extends APIResource {
|
|
7
10
|
/**
|
|
8
11
|
* When invoked for a workflow using a specific workflow key and cancellation key,
|
|
@@ -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;OAEd,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,IAAI,CAAC;IAQ3F;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,WAAW,uBAAuB;IACtC;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB;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CACL,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,qBAAqB,EAC3B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,uBAAuB,CAAC;CAGvC;AAED;;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;;;;;OAKG;IACH,IAAI,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAEzC;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC,mBAAmB,GAAG,IAAI,CAAC;CAChD;AAED,MAAM,CAAC,OAAO,WAAW,SAAS,CAAC;IACjC,OAAO,EACL,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,qBAAqB,IAAI,qBAAqB,GACpD,CAAC;CACH"}
|
package/resources/workflows.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ import * as RecipientsAPI from "./recipients/recipients.js";
|
|
|
3
3
|
import * as TenantsAPI from "./tenants/tenants.js";
|
|
4
4
|
import { APIPromise } from "../core/api-promise.js";
|
|
5
5
|
import { RequestOptions } from "../internal/request-options.js";
|
|
6
|
+
/**
|
|
7
|
+
* A workflow is a structured set of steps that is triggered to produce notifications sent over channels.
|
|
8
|
+
*/
|
|
6
9
|
export declare class Workflows extends APIResource {
|
|
7
10
|
/**
|
|
8
11
|
* When invoked for a workflow using a specific workflow key and cancellation key,
|
|
@@ -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;OAEd,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,IAAI,CAAC;IAQ3F;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,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;;;;;OAKG;I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K,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;;;;;OAKG;IACH,IAAI,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAEzC;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC,mBAAmB,GAAG,IAAI,CAAC;CAChD;AAED,MAAM,CAAC,OAAO,WAAW,SAAS,CAAC;IACjC,OAAO,EACL,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,qBAAqB,IAAI,qBAAqB,GACpD,CAAC;CACH"}
|
package/resources/workflows.js
CHANGED
|
@@ -5,6 +5,9 @@ exports.Workflows = void 0;
|
|
|
5
5
|
const resource_1 = require("../core/resource.js");
|
|
6
6
|
const headers_1 = require("../internal/headers.js");
|
|
7
7
|
const path_1 = require("../internal/utils/path.js");
|
|
8
|
+
/**
|
|
9
|
+
* A workflow is a structured set of steps that is triggered to produce notifications sent over channels.
|
|
10
|
+
*/
|
|
8
11
|
class Workflows extends resource_1.APIResource {
|
|
9
12
|
/**
|
|
10
13
|
* When invoked for a workflow using a specific workflow key and cancellation key,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.js","sourceRoot":"","sources":["../src/resources/workflows.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,oDAAmD;AAEnD,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,EAA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AC;CACF;AA1DD,8BA0DC"}
|
package/resources/workflows.mjs
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { APIResource } from "../core/resource.mjs";
|
|
3
3
|
import { buildHeaders } from "../internal/headers.mjs";
|
|
4
4
|
import { path } from "../internal/utils/path.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* A workflow is a structured set of steps that is triggered to produce notifications sent over channels.
|
|
7
|
+
*/
|
|
5
8
|
export class Workflows extends APIResource {
|
|
6
9
|
/**
|
|
7
10
|
* When invoked for a workflow using a specific workflow key and cancellation key,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.mjs","sourceRoot":"","sources":["../src/resources/workflows.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAIf,EAAE,YAAY,EAAE;OAEhB,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;YAC1D,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,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"}
|
|
1
|
+
{"version":3,"file":"workflows.mjs","sourceRoot":"","sources":["../src/resources/workflows.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAIf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf;;GAEG;AACH,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;YAC1D,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,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/src/client.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type { APIResponseProps } from './internal/parse';
|
|
|
11
11
|
import { getPlatformHeaders } from './internal/detect-platform';
|
|
12
12
|
import * as Shims from './internal/shims';
|
|
13
13
|
import * as Opts from './internal/request-options';
|
|
14
|
-
import
|
|
14
|
+
import { stringifyQuery } from './internal/utils/query';
|
|
15
15
|
import { VERSION } from './version';
|
|
16
16
|
import * as Errors from './core/error';
|
|
17
17
|
import * as Pagination from './core/pagination';
|
|
@@ -332,47 +332,8 @@ export class Knock {
|
|
|
332
332
|
return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]);
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
*
|
|
338
|
-
* We need to handle two types of arrays differently:
|
|
339
|
-
* 1. Simple arrays (primitives) → use 'brackets' format: `tags[]=tag1&tags[]=tag2`
|
|
340
|
-
* 2. Arrays of objects → use 'indices' format: `objects[0][id]=1&objects[0][collection]=teams`
|
|
341
|
-
*
|
|
342
|
-
* Why we can't use a single arrayFormat for everything:
|
|
343
|
-
* If we used 'indices' for simple arrays, `include: ["preferences"]` would serialize as
|
|
344
|
-
* `include[0]=preferences`, which the backend incorrectly parses as a map `{"0": "preferences"}`
|
|
345
|
-
* instead of an array `["preferences"]`.
|
|
346
|
-
*
|
|
347
|
-
* By separating them, we ensure the backend receives the correct data structure for each type.
|
|
348
|
-
*/
|
|
349
|
-
protected stringifyQuery(query: Record<string, unknown>): string {
|
|
350
|
-
// Separate arrays of objects from other parameters
|
|
351
|
-
// Arrays of objects need 'indices' format (e.g., objects[0][id]=1)
|
|
352
|
-
// Simple arrays need 'brackets' format (e.g., tags[]=tag1)
|
|
353
|
-
const objectArrays: Record<string, unknown> = {};
|
|
354
|
-
const otherParams: Record<string, unknown> = {};
|
|
355
|
-
|
|
356
|
-
for (const key in query) {
|
|
357
|
-
const value = query[key];
|
|
358
|
-
if (Array.isArray(value) && value.length > 0 && typeof value[0] === 'object' && value[0] !== null) {
|
|
359
|
-
objectArrays[key] = value;
|
|
360
|
-
} else {
|
|
361
|
-
otherParams[key] = value;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
// Stringify other params with 'brackets' format for simple arrays
|
|
366
|
-
const otherParamsString = qs.stringify(otherParams, { arrayFormat: 'brackets' });
|
|
367
|
-
|
|
368
|
-
// Stringify object arrays with 'indices' format
|
|
369
|
-
const objectArraysString = qs.stringify(objectArrays, { arrayFormat: 'indices' });
|
|
370
|
-
|
|
371
|
-
// Combine both parts
|
|
372
|
-
if (otherParamsString && objectArraysString) {
|
|
373
|
-
return `${otherParamsString}&${objectArraysString}`;
|
|
374
|
-
}
|
|
375
|
-
return otherParamsString || objectArraysString;
|
|
335
|
+
protected stringifyQuery(query: Record<string, unknown> | object): string {
|
|
336
|
+
return stringifyQuery(query);
|
|
376
337
|
}
|
|
377
338
|
|
|
378
339
|
private getUserAgent(): string {
|
|
@@ -404,12 +365,16 @@ export class Knock {
|
|
|
404
365
|
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
|
|
405
366
|
|
|
406
367
|
const defaultQuery = this.defaultQuery();
|
|
407
|
-
|
|
408
|
-
|
|
368
|
+
const pathQuery: Record<string, string> = {};
|
|
369
|
+
url.searchParams.forEach((value, key) => {
|
|
370
|
+
pathQuery[key] = value;
|
|
371
|
+
});
|
|
372
|
+
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
|
|
373
|
+
query = { ...pathQuery, ...defaultQuery, ...query };
|
|
409
374
|
}
|
|
410
375
|
|
|
411
376
|
if (typeof query === 'object' && query && !Array.isArray(query)) {
|
|
412
|
-
url.search = this.stringifyQuery(query
|
|
377
|
+
url.search = this.stringifyQuery(query);
|
|
413
378
|
}
|
|
414
379
|
|
|
415
380
|
return url.toString();
|
|
@@ -738,9 +703,9 @@ export class Knock {
|
|
|
738
703
|
}
|
|
739
704
|
}
|
|
740
705
|
|
|
741
|
-
// If the API asks us to wait a certain amount of time
|
|
742
|
-
//
|
|
743
|
-
if (
|
|
706
|
+
// If the API asks us to wait a certain amount of time, just do what it
|
|
707
|
+
// says, but otherwise calculate a default
|
|
708
|
+
if (timeoutMillis === undefined) {
|
|
744
709
|
const maxRetries = options.maxRetries ?? this.maxRetries;
|
|
745
710
|
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
|
|
746
711
|
}
|
|
@@ -873,7 +838,7 @@ export class Knock {
|
|
|
873
838
|
) {
|
|
874
839
|
return {
|
|
875
840
|
bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
|
|
876
|
-
body: this.stringifyQuery(body
|
|
841
|
+
body: this.stringifyQuery(body),
|
|
877
842
|
};
|
|
878
843
|
} else {
|
|
879
844
|
return this.#encoder({ body, headers });
|
|
@@ -900,16 +865,40 @@ export class Knock {
|
|
|
900
865
|
static toFile = Uploads.toFile;
|
|
901
866
|
|
|
902
867
|
recipients: API.Recipients = new API.Recipients(this);
|
|
868
|
+
/**
|
|
869
|
+
* A user is an individual from your system, represented in Knock. They are most commonly a recipient of a notification.
|
|
870
|
+
*/
|
|
903
871
|
users: API.Users = new API.Users(this);
|
|
872
|
+
/**
|
|
873
|
+
* An object represents a resource in your system that you want to map into Knock.
|
|
874
|
+
*/
|
|
904
875
|
objects: API.Objects = new API.Objects(this);
|
|
876
|
+
/**
|
|
877
|
+
* A tenant represents a top-level entity from your system, like a company, organization, account, or workspace.
|
|
878
|
+
*/
|
|
905
879
|
tenants: API.Tenants = new API.Tenants(this);
|
|
880
|
+
/**
|
|
881
|
+
* A bulk operation is a set of changes applied across zero or more records triggered via a call to the Knock API and performed asynchronously.
|
|
882
|
+
*/
|
|
906
883
|
bulkOperations: API.BulkOperations = new API.BulkOperations(this);
|
|
884
|
+
/**
|
|
885
|
+
* A message sent to a single recipient on a channel.
|
|
886
|
+
*/
|
|
907
887
|
messages: API.Messages = new API.Messages(this);
|
|
908
888
|
providers: API.Providers = new API.Providers(this);
|
|
909
889
|
integrations: API.Integrations = new API.Integrations(this);
|
|
890
|
+
/**
|
|
891
|
+
* A workflow is a structured set of steps that is triggered to produce notifications sent over channels.
|
|
892
|
+
*/
|
|
910
893
|
workflows: API.Workflows = new API.Workflows(this);
|
|
894
|
+
/**
|
|
895
|
+
* A schedule is a per-recipient, timezone-aware configuration for when to invoke a workflow.
|
|
896
|
+
*/
|
|
911
897
|
schedules: API.Schedules = new API.Schedules(this);
|
|
912
898
|
channels: API.Channels = new API.Channels(this);
|
|
899
|
+
/**
|
|
900
|
+
* An Audience is a segment of users.
|
|
901
|
+
*/
|
|
913
902
|
audiences: API.Audiences = new API.Audiences(this);
|
|
914
903
|
}
|
|
915
904
|
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export const readEnv = (env: string): string | undefined => {
|
|
11
11
|
if (typeof (globalThis as any).process !== 'undefined') {
|
|
12
|
-
return (globalThis as any).process.env?.[env]?.trim()
|
|
12
|
+
return (globalThis as any).process.env?.[env]?.trim() || undefined;
|
|
13
13
|
}
|
|
14
14
|
if (typeof (globalThis as any).Deno !== 'undefined') {
|
|
15
|
-
return (globalThis as any).Deno.env?.get?.(env)?.trim();
|
|
15
|
+
return (globalThis as any).Deno.env?.get?.(env)?.trim() || undefined;
|
|
16
16
|
}
|
|
17
17
|
return undefined;
|
|
18
18
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import * as qs from '../qs/stringify';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Stringify query parameters with smart array handling:
|
|
7
|
+
* 1. Simple arrays → 'brackets' format: `tags[]=tag1&tags[]=tag2`
|
|
8
|
+
* 2. Arrays of objects → 'indices' format: `objects[0][id]=1&objects[0][collection]=teams`
|
|
9
|
+
*/
|
|
10
|
+
export function stringifyQuery(query: object | Record<string, unknown>): string {
|
|
11
|
+
const record = query as Record<string, unknown>;
|
|
12
|
+
const objectArrays: Record<string, unknown> = {};
|
|
13
|
+
const otherParams: Record<string, unknown> = {};
|
|
14
|
+
|
|
15
|
+
for (const key in record) {
|
|
16
|
+
const value = record[key];
|
|
17
|
+
if (Array.isArray(value) && value.length > 0 && typeof value[0] === 'object' && value[0] !== null) {
|
|
18
|
+
objectArrays[key] = value;
|
|
19
|
+
} else {
|
|
20
|
+
otherParams[key] = value;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const otherParamsString = qs.stringify(otherParams, { arrayFormat: 'brackets' });
|
|
25
|
+
const objectArraysString = qs.stringify(objectArrays, { arrayFormat: 'indices' });
|
|
26
|
+
|
|
27
|
+
if (otherParamsString && objectArraysString) {
|
|
28
|
+
return `${otherParamsString}&${objectArraysString}`;
|
|
29
|
+
}
|
|
30
|
+
return otherParamsString || objectArraysString;
|
|
31
|
+
}
|
package/src/internal/utils.ts
CHANGED
|
@@ -8,6 +8,9 @@ import { buildHeaders } from '../internal/headers';
|
|
|
8
8
|
import { RequestOptions } from '../internal/request-options';
|
|
9
9
|
import { path } from '../internal/utils/path';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* An Audience is a segment of users.
|
|
13
|
+
*/
|
|
11
14
|
export class Audiences extends APIResource {
|
|
12
15
|
/**
|
|
13
16
|
* Adds one or more members to the specified audience.
|
|
@@ -5,6 +5,9 @@ import { APIPromise } from '../core/api-promise';
|
|
|
5
5
|
import { RequestOptions } from '../internal/request-options';
|
|
6
6
|
import { path } from '../internal/utils/path';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A bulk operation is a set of changes applied across zero or more records triggered via a call to the Knock API and performed asynchronously.
|
|
10
|
+
*/
|
|
8
11
|
export class BulkOperations extends APIResource {
|
|
9
12
|
/**
|
|
10
13
|
* Retrieves a bulk operation (if it exists) and displays the current state of it.
|
|
@@ -6,6 +6,9 @@ import { APIPromise } from '../../core/api-promise';
|
|
|
6
6
|
import { RequestOptions } from '../../internal/request-options';
|
|
7
7
|
import { path } from '../../internal/utils/path';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* A bulk operation is a set of changes applied across zero or more records triggered via a call to the Knock API and performed asynchronously.
|
|
11
|
+
*/
|
|
9
12
|
export class Bulk extends APIResource {
|
|
10
13
|
/**
|
|
11
14
|
* Bulk update the status of messages for a specific channel. The channel is
|
|
@@ -5,6 +5,9 @@ import * as MessagesAPI from './messages';
|
|
|
5
5
|
import { APIPromise } from '../../core/api-promise';
|
|
6
6
|
import { RequestOptions } from '../../internal/request-options';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A message sent to a single recipient on a channel.
|
|
10
|
+
*/
|
|
8
11
|
export class Batch extends APIResource {
|
|
9
12
|
/**
|
|
10
13
|
* Marks the given messages as archived. Archived messages are hidden from the
|
|
@@ -27,6 +27,9 @@ import { ItemsCursor, type ItemsCursorParams, PagePromise } from '../../core/pag
|
|
|
27
27
|
import { RequestOptions } from '../../internal/request-options';
|
|
28
28
|
import { path } from '../../internal/utils/path';
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* A message sent to a single recipient on a channel.
|
|
32
|
+
*/
|
|
30
33
|
export class Messages extends APIResource {
|
|
31
34
|
batch: BatchAPI.Batch = new BatchAPI.Batch(this._client);
|
|
32
35
|
|
|
@@ -658,6 +661,7 @@ export interface MessageEvent {
|
|
|
658
661
|
type:
|
|
659
662
|
| 'message.archived'
|
|
660
663
|
| 'message.bounced'
|
|
664
|
+
| 'message.created'
|
|
661
665
|
| 'message.delivered'
|
|
662
666
|
| 'message.delivery_attempted'
|
|
663
667
|
| 'message.interacted'
|
|
@@ -9,6 +9,9 @@ import { APIPromise } from '../../core/api-promise';
|
|
|
9
9
|
import { RequestOptions } from '../../internal/request-options';
|
|
10
10
|
import { path } from '../../internal/utils/path';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* A bulk operation is a set of changes applied across zero or more records triggered via a call to the Knock API and performed asynchronously.
|
|
14
|
+
*/
|
|
12
15
|
export class Bulk extends APIResource {
|
|
13
16
|
/**
|
|
14
17
|
* Bulk deletes objects from the specified collection.
|
|
@@ -31,6 +31,9 @@ import { buildHeaders } from '../../internal/headers';
|
|
|
31
31
|
import { RequestOptions } from '../../internal/request-options';
|
|
32
32
|
import { path } from '../../internal/utils/path';
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* An object represents a resource in your system that you want to map into Knock.
|
|
36
|
+
*/
|
|
34
37
|
export class Objects extends APIResource {
|
|
35
38
|
bulk: BulkAPI.Bulk = new BulkAPI.Bulk(this._client);
|
|
36
39
|
|
|
@@ -423,6 +426,30 @@ export class Objects extends APIResource {
|
|
|
423
426
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
424
427
|
});
|
|
425
428
|
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Unsets the preference set for the object, removing it entirely.
|
|
432
|
+
*
|
|
433
|
+
* @example
|
|
434
|
+
* ```ts
|
|
435
|
+
* await client.objects.unsetPreferences(
|
|
436
|
+
* 'collection',
|
|
437
|
+
* 'object_id',
|
|
438
|
+
* 'default',
|
|
439
|
+
* );
|
|
440
|
+
* ```
|
|
441
|
+
*/
|
|
442
|
+
unsetPreferences(
|
|
443
|
+
collection: string,
|
|
444
|
+
objectID: string,
|
|
445
|
+
id: string,
|
|
446
|
+
options?: RequestOptions,
|
|
447
|
+
): APIPromise<void> {
|
|
448
|
+
return this._client.delete(path`/v1/objects/${collection}/${objectID}/preferences/${id}`, {
|
|
449
|
+
...options,
|
|
450
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
451
|
+
});
|
|
452
|
+
}
|
|
426
453
|
}
|
|
427
454
|
|
|
428
455
|
export type ObjectsEntriesCursor = EntriesCursor<Object>;
|
|
@@ -6,6 +6,9 @@ import { MsTeamsPagination, type MsTeamsPaginationParams, PagePromise } from '..
|
|
|
6
6
|
import { RequestOptions } from '../../internal/request-options';
|
|
7
7
|
import { path } from '../../internal/utils/path';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* A provider represents a third-party service that Knock integrates with and is configured via a channel.
|
|
11
|
+
*/
|
|
9
12
|
export class MsTeams extends APIResource {
|
|
10
13
|
/**
|
|
11
14
|
* Check if a connection to Microsoft Teams has been authorized for a given
|
|
@@ -6,6 +6,9 @@ import { PagePromise, SlackChannelsCursor, type SlackChannelsCursorParams } from
|
|
|
6
6
|
import { RequestOptions } from '../../internal/request-options';
|
|
7
7
|
import { path } from '../../internal/utils/path';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* A provider represents a third-party service that Knock integrates with and is configured via a channel.
|
|
11
|
+
*/
|
|
9
12
|
export class Slack extends APIResource {
|
|
10
13
|
/**
|
|
11
14
|
* Check if a Slack channel is authenticated.
|
|
@@ -8,6 +8,9 @@ import * as TenantsAPI from '../tenants/tenants';
|
|
|
8
8
|
import { APIPromise } from '../../core/api-promise';
|
|
9
9
|
import { RequestOptions } from '../../internal/request-options';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* A bulk operation is a set of changes applied across zero or more records triggered via a call to the Knock API and performed asynchronously.
|
|
13
|
+
*/
|
|
11
14
|
export class Bulk extends APIResource {
|
|
12
15
|
/**
|
|
13
16
|
* Bulk creates up to 1,000 schedules at a time. This endpoint also handles
|
|
@@ -9,6 +9,9 @@ import { APIPromise } from '../../core/api-promise';
|
|
|
9
9
|
import { EntriesCursor, type EntriesCursorParams, PagePromise } from '../../core/pagination';
|
|
10
10
|
import { RequestOptions } from '../../internal/request-options';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* A schedule is a per-recipient, timezone-aware configuration for when to invoke a workflow.
|
|
14
|
+
*/
|
|
12
15
|
export class Schedules extends APIResource {
|
|
13
16
|
bulk: BulkAPI.Bulk = new BulkAPI.Bulk(this._client);
|
|
14
17
|
|
package/src/resources/shared.ts
CHANGED
|
@@ -6,6 +6,9 @@ import * as TenantsAPI from './tenants';
|
|
|
6
6
|
import { APIPromise } from '../../core/api-promise';
|
|
7
7
|
import { RequestOptions } from '../../internal/request-options';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* A bulk operation is a set of changes applied across zero or more records triggered via a call to the Knock API and performed asynchronously.
|
|
11
|
+
*/
|
|
9
12
|
export class Bulk extends APIResource {
|
|
10
13
|
/**
|
|
11
14
|
* Delete up to 1,000 tenants at a time in a single operation. This operation
|
|
@@ -11,6 +11,9 @@ import { buildHeaders } from '../../internal/headers';
|
|
|
11
11
|
import { RequestOptions } from '../../internal/request-options';
|
|
12
12
|
import { path } from '../../internal/utils/path';
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* A tenant represents a top-level entity from your system, like a company, organization, account, or workspace.
|
|
16
|
+
*/
|
|
14
17
|
export class Tenants extends APIResource {
|
|
15
18
|
bulk: BulkAPI.Bulk = new BulkAPI.Bulk(this._client);
|
|
16
19
|
|
|
@@ -7,6 +7,9 @@ import * as UsersAPI from './users';
|
|
|
7
7
|
import { APIPromise } from '../../core/api-promise';
|
|
8
8
|
import { RequestOptions } from '../../internal/request-options';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* A bulk operation is a set of changes applied across zero or more records triggered via a call to the Knock API and performed asynchronously.
|
|
12
|
+
*/
|
|
10
13
|
export class Bulk extends APIResource {
|
|
11
14
|
/**
|
|
12
15
|
* Permanently deletes up to 1,000 users at a time.
|
|
@@ -8,6 +8,9 @@ import { EntriesCursor, type EntriesCursorParams, PagePromise } from '../../core
|
|
|
8
8
|
import { RequestOptions } from '../../internal/request-options';
|
|
9
9
|
import { path } from '../../internal/utils/path';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* A user is an individual from your system, represented in Knock. They are most commonly a recipient of a notification.
|
|
13
|
+
*/
|
|
11
14
|
export class Feeds extends APIResource {
|
|
12
15
|
/**
|
|
13
16
|
* Returns the feed settings for a user.
|
|
@@ -5,6 +5,9 @@ import { APIPromise } from '../../core/api-promise';
|
|
|
5
5
|
import { RequestOptions } from '../../internal/request-options';
|
|
6
6
|
import { path } from '../../internal/utils/path';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A user is an individual from your system, represented in Knock. They are most commonly a recipient of a notification.
|
|
10
|
+
*/
|
|
8
11
|
export class Guides extends APIResource {
|
|
9
12
|
/**
|
|
10
13
|
* Returns a list of eligible in-app guides for a specific user and channel.
|
|
@@ -193,6 +196,11 @@ export namespace GuideGetChannelResponse {
|
|
|
193
196
|
|
|
194
197
|
channel_id?: string;
|
|
195
198
|
|
|
199
|
+
/**
|
|
200
|
+
* URL to this guide in the Knock dashboard
|
|
201
|
+
*/
|
|
202
|
+
dashboard_url?: string;
|
|
203
|
+
|
|
196
204
|
inserted_at?: string;
|
|
197
205
|
|
|
198
206
|
/**
|
|
@@ -45,6 +45,9 @@ import { buildHeaders } from '../../internal/headers';
|
|
|
45
45
|
import { RequestOptions } from '../../internal/request-options';
|
|
46
46
|
import { path } from '../../internal/utils/path';
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* A user is an individual from your system, represented in Knock. They are most commonly a recipient of a notification.
|
|
50
|
+
*/
|
|
48
51
|
export class Users extends APIResource {
|
|
49
52
|
feeds: FeedsAPI.Feeds = new FeedsAPI.Feeds(this._client);
|
|
50
53
|
guides: GuidesAPI.Guides = new GuidesAPI.Guides(this._client);
|
|
@@ -364,6 +367,21 @@ export class Users extends APIResource {
|
|
|
364
367
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
365
368
|
});
|
|
366
369
|
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Unsets the preference set for the user, removing it entirely.
|
|
373
|
+
*
|
|
374
|
+
* @example
|
|
375
|
+
* ```ts
|
|
376
|
+
* await client.users.unsetPreferences('user_id', 'default');
|
|
377
|
+
* ```
|
|
378
|
+
*/
|
|
379
|
+
unsetPreferences(userID: string, id: string, options?: RequestOptions): APIPromise<void> {
|
|
380
|
+
return this._client.delete(path`/v1/users/${userID}/preferences/${id}`, {
|
|
381
|
+
...options,
|
|
382
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
383
|
+
});
|
|
384
|
+
}
|
|
367
385
|
}
|
|
368
386
|
|
|
369
387
|
export type UsersEntriesCursor = EntriesCursor<User>;
|
|
@@ -8,6 +8,9 @@ import { buildHeaders } from '../internal/headers';
|
|
|
8
8
|
import { RequestOptions } from '../internal/request-options';
|
|
9
9
|
import { path } from '../internal/utils/path';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* A workflow is a structured set of steps that is triggered to produce notifications sent over channels.
|
|
13
|
+
*/
|
|
11
14
|
export class Workflows extends APIResource {
|
|
12
15
|
/**
|
|
13
16
|
* When invoked for a workflow using a specific workflow key and cancellation key,
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '1.
|
|
1
|
+
export const VERSION = '1.30.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.30.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.30.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '1.
|
|
1
|
+
export const VERSION = '1.30.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|