@knocklabs/node 1.29.1 → 1.31.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.
Files changed (222) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/client.d.mts +31 -15
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +31 -15
  5. package/client.d.ts.map +1 -1
  6. package/client.js +41 -43
  7. package/client.js.map +1 -1
  8. package/client.mjs +41 -43
  9. package/client.mjs.map +1 -1
  10. package/internal/tslib.js +17 -17
  11. package/internal/utils/env.js +2 -2
  12. package/internal/utils/env.js.map +1 -1
  13. package/internal/utils/env.mjs +2 -2
  14. package/internal/utils/env.mjs.map +1 -1
  15. package/internal/utils/query.d.mts +7 -0
  16. package/internal/utils/query.d.mts.map +1 -0
  17. package/internal/utils/query.d.ts +7 -0
  18. package/internal/utils/query.d.ts.map +1 -0
  19. package/internal/utils/query.js +32 -0
  20. package/internal/utils/query.js.map +1 -0
  21. package/internal/utils/query.mjs +28 -0
  22. package/internal/utils/query.mjs.map +1 -0
  23. package/internal/utils.d.mts +1 -0
  24. package/internal/utils.d.ts +1 -0
  25. package/internal/utils.js +1 -0
  26. package/internal/utils.js.map +1 -1
  27. package/internal/utils.mjs +1 -0
  28. package/package.json +12 -1
  29. package/resources/audiences.d.mts +3 -0
  30. package/resources/audiences.d.mts.map +1 -1
  31. package/resources/audiences.d.ts +3 -0
  32. package/resources/audiences.d.ts.map +1 -1
  33. package/resources/audiences.js +3 -0
  34. package/resources/audiences.js.map +1 -1
  35. package/resources/audiences.mjs +3 -0
  36. package/resources/audiences.mjs.map +1 -1
  37. package/resources/bulk-operations.d.mts +3 -0
  38. package/resources/bulk-operations.d.mts.map +1 -1
  39. package/resources/bulk-operations.d.ts +3 -0
  40. package/resources/bulk-operations.d.ts.map +1 -1
  41. package/resources/bulk-operations.js +3 -0
  42. package/resources/bulk-operations.js.map +1 -1
  43. package/resources/bulk-operations.mjs +3 -0
  44. package/resources/bulk-operations.mjs.map +1 -1
  45. package/resources/channels/bulk.d.mts +3 -0
  46. package/resources/channels/bulk.d.mts.map +1 -1
  47. package/resources/channels/bulk.d.ts +3 -0
  48. package/resources/channels/bulk.d.ts.map +1 -1
  49. package/resources/channels/bulk.js +3 -0
  50. package/resources/channels/bulk.js.map +1 -1
  51. package/resources/channels/bulk.mjs +3 -0
  52. package/resources/channels/bulk.mjs.map +1 -1
  53. package/resources/index.d.mts +1 -0
  54. package/resources/index.d.mts.map +1 -1
  55. package/resources/index.d.ts +1 -0
  56. package/resources/index.d.ts.map +1 -1
  57. package/resources/index.js +3 -1
  58. package/resources/index.js.map +1 -1
  59. package/resources/index.mjs +1 -0
  60. package/resources/index.mjs.map +1 -1
  61. package/resources/messages/batch.d.mts +3 -0
  62. package/resources/messages/batch.d.mts.map +1 -1
  63. package/resources/messages/batch.d.ts +3 -0
  64. package/resources/messages/batch.d.ts.map +1 -1
  65. package/resources/messages/batch.js +3 -0
  66. package/resources/messages/batch.js.map +1 -1
  67. package/resources/messages/batch.mjs +3 -0
  68. package/resources/messages/batch.mjs.map +1 -1
  69. package/resources/messages/messages.d.mts +4 -1
  70. package/resources/messages/messages.d.mts.map +1 -1
  71. package/resources/messages/messages.d.ts +4 -1
  72. package/resources/messages/messages.d.ts.map +1 -1
  73. package/resources/messages/messages.js +3 -0
  74. package/resources/messages/messages.js.map +1 -1
  75. package/resources/messages/messages.mjs +3 -0
  76. package/resources/messages/messages.mjs.map +1 -1
  77. package/resources/objects/bulk.d.mts +3 -0
  78. package/resources/objects/bulk.d.mts.map +1 -1
  79. package/resources/objects/bulk.d.ts +3 -0
  80. package/resources/objects/bulk.d.ts.map +1 -1
  81. package/resources/objects/bulk.js +3 -0
  82. package/resources/objects/bulk.js.map +1 -1
  83. package/resources/objects/bulk.mjs +3 -0
  84. package/resources/objects/bulk.mjs.map +1 -1
  85. package/resources/objects/objects.d.mts +16 -0
  86. package/resources/objects/objects.d.mts.map +1 -1
  87. package/resources/objects/objects.d.ts +16 -0
  88. package/resources/objects/objects.d.ts.map +1 -1
  89. package/resources/objects/objects.js +21 -0
  90. package/resources/objects/objects.js.map +1 -1
  91. package/resources/objects/objects.mjs +21 -0
  92. package/resources/objects/objects.mjs.map +1 -1
  93. package/resources/providers/ms-teams.d.mts +3 -0
  94. package/resources/providers/ms-teams.d.mts.map +1 -1
  95. package/resources/providers/ms-teams.d.ts +3 -0
  96. package/resources/providers/ms-teams.d.ts.map +1 -1
  97. package/resources/providers/ms-teams.js +3 -0
  98. package/resources/providers/ms-teams.js.map +1 -1
  99. package/resources/providers/ms-teams.mjs +3 -0
  100. package/resources/providers/ms-teams.mjs.map +1 -1
  101. package/resources/providers/slack.d.mts +3 -0
  102. package/resources/providers/slack.d.mts.map +1 -1
  103. package/resources/providers/slack.d.ts +3 -0
  104. package/resources/providers/slack.d.ts.map +1 -1
  105. package/resources/providers/slack.js +3 -0
  106. package/resources/providers/slack.js.map +1 -1
  107. package/resources/providers/slack.mjs +3 -0
  108. package/resources/providers/slack.mjs.map +1 -1
  109. package/resources/schedules/bulk.d.mts +3 -0
  110. package/resources/schedules/bulk.d.mts.map +1 -1
  111. package/resources/schedules/bulk.d.ts +3 -0
  112. package/resources/schedules/bulk.d.ts.map +1 -1
  113. package/resources/schedules/bulk.js +3 -0
  114. package/resources/schedules/bulk.js.map +1 -1
  115. package/resources/schedules/bulk.mjs +3 -0
  116. package/resources/schedules/bulk.mjs.map +1 -1
  117. package/resources/schedules/schedules.d.mts +3 -0
  118. package/resources/schedules/schedules.d.mts.map +1 -1
  119. package/resources/schedules/schedules.d.ts +3 -0
  120. package/resources/schedules/schedules.d.ts.map +1 -1
  121. package/resources/schedules/schedules.js +3 -0
  122. package/resources/schedules/schedules.js.map +1 -1
  123. package/resources/schedules/schedules.mjs +3 -0
  124. package/resources/schedules/schedules.mjs.map +1 -1
  125. package/resources/shared.d.mts +1 -1
  126. package/resources/shared.d.mts.map +1 -1
  127. package/resources/shared.d.ts +1 -1
  128. package/resources/shared.d.ts.map +1 -1
  129. package/resources/tenants/bulk.d.mts +3 -0
  130. package/resources/tenants/bulk.d.mts.map +1 -1
  131. package/resources/tenants/bulk.d.ts +3 -0
  132. package/resources/tenants/bulk.d.ts.map +1 -1
  133. package/resources/tenants/bulk.js +3 -0
  134. package/resources/tenants/bulk.js.map +1 -1
  135. package/resources/tenants/bulk.mjs +3 -0
  136. package/resources/tenants/bulk.mjs.map +1 -1
  137. package/resources/tenants/tenants.d.mts +3 -0
  138. package/resources/tenants/tenants.d.mts.map +1 -1
  139. package/resources/tenants/tenants.d.ts +3 -0
  140. package/resources/tenants/tenants.d.ts.map +1 -1
  141. package/resources/tenants/tenants.js +3 -0
  142. package/resources/tenants/tenants.js.map +1 -1
  143. package/resources/tenants/tenants.mjs +3 -0
  144. package/resources/tenants/tenants.mjs.map +1 -1
  145. package/resources/users/bulk.d.mts +3 -0
  146. package/resources/users/bulk.d.mts.map +1 -1
  147. package/resources/users/bulk.d.ts +3 -0
  148. package/resources/users/bulk.d.ts.map +1 -1
  149. package/resources/users/bulk.js +3 -0
  150. package/resources/users/bulk.js.map +1 -1
  151. package/resources/users/bulk.mjs +3 -0
  152. package/resources/users/bulk.mjs.map +1 -1
  153. package/resources/users/feeds.d.mts +3 -0
  154. package/resources/users/feeds.d.mts.map +1 -1
  155. package/resources/users/feeds.d.ts +3 -0
  156. package/resources/users/feeds.d.ts.map +1 -1
  157. package/resources/users/feeds.js +3 -0
  158. package/resources/users/feeds.js.map +1 -1
  159. package/resources/users/feeds.mjs +3 -0
  160. package/resources/users/feeds.mjs.map +1 -1
  161. package/resources/users/guides.d.mts +7 -0
  162. package/resources/users/guides.d.mts.map +1 -1
  163. package/resources/users/guides.d.ts +7 -0
  164. package/resources/users/guides.d.ts.map +1 -1
  165. package/resources/users/guides.js +3 -0
  166. package/resources/users/guides.js.map +1 -1
  167. package/resources/users/guides.mjs +3 -0
  168. package/resources/users/guides.mjs.map +1 -1
  169. package/resources/users/users.d.mts +12 -0
  170. package/resources/users/users.d.mts.map +1 -1
  171. package/resources/users/users.d.ts +12 -0
  172. package/resources/users/users.d.ts.map +1 -1
  173. package/resources/users/users.js +17 -0
  174. package/resources/users/users.js.map +1 -1
  175. package/resources/users/users.mjs +17 -0
  176. package/resources/users/users.mjs.map +1 -1
  177. package/resources/workflow-recipient-runs.d.mts +202 -0
  178. package/resources/workflow-recipient-runs.d.mts.map +1 -0
  179. package/resources/workflow-recipient-runs.d.ts +202 -0
  180. package/resources/workflow-recipient-runs.d.ts.map +1 -0
  181. package/resources/workflow-recipient-runs.js +43 -0
  182. package/resources/workflow-recipient-runs.js.map +1 -0
  183. package/resources/workflow-recipient-runs.mjs +39 -0
  184. package/resources/workflow-recipient-runs.mjs.map +1 -0
  185. package/resources/workflows.d.mts +3 -0
  186. package/resources/workflows.d.mts.map +1 -1
  187. package/resources/workflows.d.ts +3 -0
  188. package/resources/workflows.d.ts.map +1 -1
  189. package/resources/workflows.js +3 -0
  190. package/resources/workflows.js.map +1 -1
  191. package/resources/workflows.mjs +3 -0
  192. package/resources/workflows.mjs.map +1 -1
  193. package/src/client.ts +60 -49
  194. package/src/internal/utils/env.ts +2 -2
  195. package/src/internal/utils/query.ts +31 -0
  196. package/src/internal/utils.ts +1 -0
  197. package/src/resources/audiences.ts +3 -0
  198. package/src/resources/bulk-operations.ts +3 -0
  199. package/src/resources/channels/bulk.ts +3 -0
  200. package/src/resources/index.ts +8 -0
  201. package/src/resources/messages/batch.ts +3 -0
  202. package/src/resources/messages/messages.ts +4 -0
  203. package/src/resources/objects/bulk.ts +3 -0
  204. package/src/resources/objects/objects.ts +27 -0
  205. package/src/resources/providers/ms-teams.ts +3 -0
  206. package/src/resources/providers/slack.ts +3 -0
  207. package/src/resources/schedules/bulk.ts +3 -0
  208. package/src/resources/schedules/schedules.ts +3 -0
  209. package/src/resources/shared.ts +1 -0
  210. package/src/resources/tenants/bulk.ts +3 -0
  211. package/src/resources/tenants/tenants.ts +3 -0
  212. package/src/resources/users/bulk.ts +3 -0
  213. package/src/resources/users/feeds.ts +3 -0
  214. package/src/resources/users/guides.ts +8 -0
  215. package/src/resources/users/users.ts +18 -0
  216. package/src/resources/workflow-recipient-runs.ts +255 -0
  217. package/src/resources/workflows.ts +3 -0
  218. package/src/version.ts +1 -1
  219. package/version.d.mts +1 -1
  220. package/version.d.ts +1 -1
  221. package/version.js +1 -1
  222. package/version.mjs +1 -1
@@ -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
 
@@ -33,6 +33,7 @@ export interface Condition {
33
33
  | 'is_timestamp_on_or_after_date'
34
34
  | 'is_timestamp_before_date'
35
35
  | 'is_timestamp_between'
36
+ | 'is_between'
36
37
  | 'is_audience_member'
37
38
  | 'is_not_audience_member';
38
39
 
@@ -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>;
@@ -0,0 +1,255 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import * as RecipientsAPI from './recipients/recipients';
5
+ import { APIPromise } from '../core/api-promise';
6
+ import { ItemsCursor, type ItemsCursorParams, PagePromise } from '../core/pagination';
7
+ import { RequestOptions } from '../internal/request-options';
8
+ import { path } from '../internal/utils/path';
9
+
10
+ /**
11
+ * A workflow run represents an individual execution of a workflow for a specific recipient.
12
+ */
13
+ export class WorkflowRecipientRuns extends APIResource {
14
+ /**
15
+ * Returns a paginated list of workflow recipient runs for the current environment.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * // Automatically fetches more pages as needed.
20
+ * for await (const workflowRecipientRun of client.workflowRecipientRuns.list()) {
21
+ * // ...
22
+ * }
23
+ * ```
24
+ */
25
+ list(
26
+ query: WorkflowRecipientRunListParams | null | undefined = {},
27
+ options?: RequestOptions,
28
+ ): PagePromise<WorkflowRecipientRunsItemsCursor, WorkflowRecipientRun> {
29
+ return this._client.getAPIList('/v1/workflow_recipient_runs', ItemsCursor<WorkflowRecipientRun>, {
30
+ query,
31
+ ...options,
32
+ });
33
+ }
34
+
35
+ /**
36
+ * Returns a single workflow recipient run with its associated events.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const workflowRecipientRunDetail =
41
+ * await client.workflowRecipientRuns.get('id');
42
+ * ```
43
+ */
44
+ get(id: string, options?: RequestOptions): APIPromise<WorkflowRecipientRunDetail> {
45
+ return this._client.get(path`/v1/workflow_recipient_runs/${id}`, options);
46
+ }
47
+ }
48
+
49
+ export type WorkflowRecipientRunsItemsCursor = ItemsCursor<WorkflowRecipientRun>;
50
+
51
+ /**
52
+ * A workflow recipient run represents an individual execution of a workflow for a
53
+ * specific recipient.
54
+ */
55
+ export interface WorkflowRecipientRun {
56
+ /**
57
+ * The unique identifier for the workflow recipient run (per-recipient).
58
+ */
59
+ id: string;
60
+
61
+ /**
62
+ * The typename of the schema.
63
+ */
64
+ __typename: string;
65
+
66
+ /**
67
+ * Timestamp when the resource was created.
68
+ */
69
+ inserted_at: string;
70
+
71
+ /**
72
+ * A reference to a recipient, either a user identifier (string) or an object
73
+ * reference (ID, collection).
74
+ */
75
+ recipient: RecipientsAPI.RecipientReference;
76
+
77
+ /**
78
+ * The current status of the workflow recipient run. One of `queued`, `processing`,
79
+ * `paused`, `completed`, or `cancelled`.
80
+ */
81
+ status: 'queued' | 'processing' | 'paused' | 'completed' | 'cancelled';
82
+
83
+ /**
84
+ * Describes how the workflow was triggered.
85
+ */
86
+ trigger_source: WorkflowRecipientRun.TriggerSource;
87
+
88
+ /**
89
+ * The timestamp when the resource was last updated.
90
+ */
91
+ updated_at: string;
92
+
93
+ /**
94
+ * The key of the workflow that was executed.
95
+ */
96
+ workflow: string;
97
+
98
+ /**
99
+ * The identifier for the top-level workflow run shared across all recipients in a
100
+ * single trigger.
101
+ */
102
+ workflow_run_id: string;
103
+
104
+ /**
105
+ * A recipient of a notification, which is either a user or an object.
106
+ */
107
+ actor?: RecipientsAPI.Recipient | null;
108
+
109
+ /**
110
+ * The number of errors encountered during the workflow recipient run.
111
+ */
112
+ error_count?: number;
113
+
114
+ /**
115
+ * The tenant associated with the workflow recipient run.
116
+ */
117
+ tenant?: string | null;
118
+ }
119
+
120
+ export namespace WorkflowRecipientRun {
121
+ /**
122
+ * Describes how the workflow was triggered.
123
+ */
124
+ export interface TriggerSource {
125
+ /**
126
+ * The type of trigger source. One of `api`, `audience`, `schedule`, `broadcast`,
127
+ * `workflow_step`, `integration`, or `rehearsal`.
128
+ */
129
+ type: 'api' | 'audience' | 'schedule' | 'broadcast' | 'workflow_step' | 'integration' | 'rehearsal';
130
+
131
+ /**
132
+ * The key of the audience that triggered the workflow.
133
+ */
134
+ audience_key?: string | null;
135
+
136
+ /**
137
+ * The cancellation key provided when the workflow was triggered via the API.
138
+ */
139
+ cancellation_key?: string | null;
140
+
141
+ /**
142
+ * The ID of the schedule that triggered the workflow.
143
+ */
144
+ schedule_id?: string | null;
145
+ }
146
+ }
147
+
148
+ /**
149
+ * A single workflow recipient run with its events.
150
+ */
151
+ export interface WorkflowRecipientRunDetail extends WorkflowRecipientRun {
152
+ /**
153
+ * A list of events that occurred during the workflow recipient run.
154
+ */
155
+ events: Array<WorkflowRecipientRunEvent>;
156
+ }
157
+
158
+ /**
159
+ * An event that occurred during a workflow recipient run.
160
+ */
161
+ export interface WorkflowRecipientRunEvent {
162
+ /**
163
+ * The unique identifier for the event.
164
+ */
165
+ id: string;
166
+
167
+ /**
168
+ * The typename of the schema.
169
+ */
170
+ __typename: string;
171
+
172
+ /**
173
+ * The type of event that occurred.
174
+ */
175
+ event: string;
176
+
177
+ /**
178
+ * Timestamp when the resource was created.
179
+ */
180
+ inserted_at: string;
181
+
182
+ /**
183
+ * Whether the event represents a successful or error state.
184
+ */
185
+ status: 'ok' | 'error';
186
+
187
+ /**
188
+ * The attempt number of the workflow recipient run event. Increments for each
189
+ * retry.
190
+ */
191
+ attempt?: number;
192
+
193
+ /**
194
+ * Event-specific data associated with the event.
195
+ */
196
+ data?: { [key: string]: unknown } | null;
197
+
198
+ /**
199
+ * The reference of the workflow step associated with this event.
200
+ */
201
+ step_ref?: string | null;
202
+
203
+ /**
204
+ * The type of workflow step associated with this event.
205
+ */
206
+ step_type?: string | null;
207
+ }
208
+
209
+ export interface WorkflowRecipientRunListParams extends ItemsCursorParams {
210
+ /**
211
+ * Limits the results to workflow recipient runs started before the given date.
212
+ */
213
+ ending_at?: string;
214
+
215
+ /**
216
+ * Limits the results to workflow recipient runs that have errors.
217
+ */
218
+ has_errors?: boolean;
219
+
220
+ /**
221
+ * Limits the results to workflow recipient runs for the given recipient. Accepts a
222
+ * user ID string or an object reference with `id` and `collection`.
223
+ */
224
+ recipient?: RecipientsAPI.RecipientReference;
225
+
226
+ /**
227
+ * Limits the results to workflow recipient runs started after the given date.
228
+ */
229
+ starting_at?: string;
230
+
231
+ /**
232
+ * Limits the results to workflow recipient runs with the given status.
233
+ */
234
+ status?: Array<'queued' | 'processing' | 'paused' | 'completed' | 'cancelled'>;
235
+
236
+ /**
237
+ * Limits the results to workflow recipient runs for the given tenant.
238
+ */
239
+ tenant?: string;
240
+
241
+ /**
242
+ * Limits the results to workflow recipient runs for the given workflow key.
243
+ */
244
+ workflow?: string;
245
+ }
246
+
247
+ export declare namespace WorkflowRecipientRuns {
248
+ export {
249
+ type WorkflowRecipientRun as WorkflowRecipientRun,
250
+ type WorkflowRecipientRunDetail as WorkflowRecipientRunDetail,
251
+ type WorkflowRecipientRunEvent as WorkflowRecipientRunEvent,
252
+ type WorkflowRecipientRunsItemsCursor as WorkflowRecipientRunsItemsCursor,
253
+ type WorkflowRecipientRunListParams as WorkflowRecipientRunListParams,
254
+ };
255
+ }
@@ -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.29.1'; // x-release-please-version
1
+ export const VERSION = '1.31.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.29.1";
1
+ export declare const VERSION = "1.31.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.29.1";
1
+ export declare const VERSION = "1.31.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.29.1'; // x-release-please-version
4
+ exports.VERSION = '1.31.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.29.1'; // x-release-please-version
1
+ export const VERSION = '1.31.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map