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