@izapai/sdk 0.0.0 → 0.4.1

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 (91) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +173 -1
  3. package/dist/client.d.ts +20 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +41 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/errors.d.ts +41 -0
  8. package/dist/errors.d.ts.map +1 -0
  9. package/dist/errors.js +67 -0
  10. package/dist/errors.js.map +1 -0
  11. package/dist/generated/client/client.gen.d.ts +3 -0
  12. package/dist/generated/client/client.gen.d.ts.map +1 -0
  13. package/dist/generated/client/client.gen.js +217 -0
  14. package/dist/generated/client/client.gen.js.map +1 -0
  15. package/dist/generated/client/index.d.ts +11 -0
  16. package/dist/generated/client/index.d.ts.map +1 -0
  17. package/dist/generated/client/index.js +7 -0
  18. package/dist/generated/client/index.js.map +1 -0
  19. package/dist/generated/client/types.gen.d.ts +121 -0
  20. package/dist/generated/client/types.gen.d.ts.map +1 -0
  21. package/dist/generated/client/types.gen.js +3 -0
  22. package/dist/generated/client/types.gen.js.map +1 -0
  23. package/dist/generated/client/utils.gen.d.ts +38 -0
  24. package/dist/generated/client/utils.gen.d.ts.map +1 -0
  25. package/dist/generated/client/utils.gen.js +229 -0
  26. package/dist/generated/client/utils.gen.js.map +1 -0
  27. package/dist/generated/client.gen.d.ts +13 -0
  28. package/dist/generated/client.gen.d.ts.map +1 -0
  29. package/dist/generated/client.gen.js +4 -0
  30. package/dist/generated/client.gen.js.map +1 -0
  31. package/dist/generated/core/auth.gen.d.ts +26 -0
  32. package/dist/generated/core/auth.gen.d.ts.map +1 -0
  33. package/dist/generated/core/auth.gen.js +15 -0
  34. package/dist/generated/core/auth.gen.js.map +1 -0
  35. package/dist/generated/core/bodySerializer.gen.d.ts +26 -0
  36. package/dist/generated/core/bodySerializer.gen.d.ts.map +1 -0
  37. package/dist/generated/core/bodySerializer.gen.js +58 -0
  38. package/dist/generated/core/bodySerializer.gen.js.map +1 -0
  39. package/dist/generated/core/params.gen.d.ts +44 -0
  40. package/dist/generated/core/params.gen.d.ts.map +1 -0
  41. package/dist/generated/core/params.gen.js +110 -0
  42. package/dist/generated/core/params.gen.js.map +1 -0
  43. package/dist/generated/core/pathSerializer.gen.d.ts +34 -0
  44. package/dist/generated/core/pathSerializer.gen.d.ts.map +1 -0
  45. package/dist/generated/core/pathSerializer.gen.js +107 -0
  46. package/dist/generated/core/pathSerializer.gen.js.map +1 -0
  47. package/dist/generated/core/queryKeySerializer.gen.d.ts +19 -0
  48. package/dist/generated/core/queryKeySerializer.gen.d.ts.map +1 -0
  49. package/dist/generated/core/queryKeySerializer.gen.js +93 -0
  50. package/dist/generated/core/queryKeySerializer.gen.js.map +1 -0
  51. package/dist/generated/core/serverSentEvents.gen.d.ts +72 -0
  52. package/dist/generated/core/serverSentEvents.gen.d.ts.map +1 -0
  53. package/dist/generated/core/serverSentEvents.gen.js +133 -0
  54. package/dist/generated/core/serverSentEvents.gen.js.map +1 -0
  55. package/dist/generated/core/types.gen.d.ts +84 -0
  56. package/dist/generated/core/types.gen.d.ts.map +1 -0
  57. package/dist/generated/core/types.gen.js +3 -0
  58. package/dist/generated/core/types.gen.js.map +1 -0
  59. package/dist/generated/core/utils.gen.d.ts +20 -0
  60. package/dist/generated/core/utils.gen.d.ts.map +1 -0
  61. package/dist/generated/core/utils.gen.js +88 -0
  62. package/dist/generated/core/utils.gen.js.map +1 -0
  63. package/dist/generated/index.d.ts +3 -0
  64. package/dist/generated/index.d.ts.map +1 -0
  65. package/dist/generated/index.js +3 -0
  66. package/dist/generated/index.js.map +1 -0
  67. package/dist/generated/sdk.gen.d.ts +474 -0
  68. package/dist/generated/sdk.gen.d.ts.map +1 -0
  69. package/dist/generated/sdk.gen.js +1035 -0
  70. package/dist/generated/sdk.gen.js.map +1 -0
  71. package/dist/generated/types.gen.d.ts +6277 -0
  72. package/dist/generated/types.gen.d.ts.map +1 -0
  73. package/dist/generated/types.gen.js +3 -0
  74. package/dist/generated/types.gen.js.map +1 -0
  75. package/dist/index.d.ts +8 -0
  76. package/dist/index.d.ts.map +1 -0
  77. package/dist/index.js +7 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/retry.d.ts +18 -0
  80. package/dist/retry.d.ts.map +1 -0
  81. package/dist/retry.js +84 -0
  82. package/dist/retry.js.map +1 -0
  83. package/dist/version.d.ts +2 -0
  84. package/dist/version.d.ts.map +1 -0
  85. package/dist/version.js +2 -0
  86. package/dist/version.js.map +1 -0
  87. package/dist/webhooks.d.ts +127 -0
  88. package/dist/webhooks.d.ts.map +1 -0
  89. package/dist/webhooks.js +153 -0
  90. package/dist/webhooks.js.map +1 -0
  91. package/package.json +58 -3
@@ -0,0 +1,1035 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+ import { client } from './client.gen.js';
3
+ import { formDataBodySerializer } from './client/index.js';
4
+ class HeyApiClient {
5
+ client;
6
+ constructor(args) {
7
+ this.client = args?.client ?? client;
8
+ }
9
+ }
10
+ class HeyApiRegistry {
11
+ defaultKey = 'default';
12
+ instances = new Map();
13
+ get(key) {
14
+ const instance = this.instances.get(key ?? this.defaultKey);
15
+ if (!instance) {
16
+ throw new Error(`No SDK client found. Create one with "new IzapApi()" to fix this error.`);
17
+ }
18
+ return instance;
19
+ }
20
+ set(value, key) {
21
+ this.instances.set(key ?? this.defaultKey, value);
22
+ }
23
+ }
24
+ export class IzapApi extends HeyApiClient {
25
+ static __registry = new HeyApiRegistry();
26
+ constructor(args) {
27
+ super(args);
28
+ IzapApi.__registry.set(this, args?.key);
29
+ }
30
+ /**
31
+ * Introspect the presented credential
32
+ *
33
+ * Resolves the credential on the request to its principal, or returns `401` if it is not valid. Accepts a JWT, a session cookie, a personal access token or a business API key — use it to confirm that a token is still good and who it belongs to.
34
+ */
35
+ introspectToken(options) {
36
+ return (options?.client ?? this.client).get({
37
+ security: [{ scheme: 'bearer', type: 'http' }],
38
+ url: '/api/v1/auth/token/introspect',
39
+ ...options
40
+ });
41
+ }
42
+ /**
43
+ * Create a business
44
+ *
45
+ * Creates a business together with its default settings, assistant and credentials. The authenticated user becomes its owner.
46
+ */
47
+ createBusiness(options) {
48
+ return (options.client ?? this.client).post({
49
+ security: [{ scheme: 'bearer', type: 'http' }],
50
+ url: '/api/v1/businesses',
51
+ ...options,
52
+ headers: {
53
+ 'Content-Type': 'application/json',
54
+ ...options.headers
55
+ }
56
+ });
57
+ }
58
+ /**
59
+ * Retrieve an assistant's contact filter
60
+ *
61
+ * Returns which contacts may trigger the assistant: the filter mode, and the numbers on its allowlist and blocklist. Messages from a contact the filter excludes are still received and stored, but the assistant is never invoked for them — no AI reply, greeting or off-hours message is sent.
62
+ */
63
+ getAssistantContactFilter(options) {
64
+ return (options.client ?? this.client).get({
65
+ security: [{ scheme: 'bearer', type: 'http' }],
66
+ url: '/api/v1/businesses/chatbots/{chatbot_id}/contact-filter',
67
+ ...options
68
+ });
69
+ }
70
+ /**
71
+ * Set an assistant's contact filter mode
72
+ *
73
+ * Chooses who may trigger the assistant: `off` (everyone), `allowlist` (only the numbers on the allowlist) or `blocklist` (everyone except the numbers on the blocklist). Takes effect on the next inbound message. Both lists are kept when the mode changes; an empty allowlist silences the assistant for every contact.
74
+ */
75
+ setAssistantContactFilterMode(options) {
76
+ return (options.client ?? this.client).put({
77
+ security: [{ scheme: 'bearer', type: 'http' }],
78
+ url: '/api/v1/businesses/chatbots/{chatbot_id}/contact-filter',
79
+ ...options,
80
+ headers: {
81
+ 'Content-Type': 'application/json',
82
+ ...options.headers
83
+ }
84
+ });
85
+ }
86
+ /**
87
+ * Add contacts to an assistant's contact filter
88
+ *
89
+ * Adds up to 500 phone numbers to the allowlist or blocklist in one call. Numbers are stored in canonical E.164 form, so different spellings of one number are one entry. Adding a number that is already listed is not an error; the response reports it separately, along with any input that is not a usable phone number.
90
+ */
91
+ addAssistantContactFilterEntries(options) {
92
+ return (options.client ?? this.client).post({
93
+ security: [{ scheme: 'bearer', type: 'http' }],
94
+ url: '/api/v1/businesses/chatbots/{chatbot_id}/contact-filter/entries',
95
+ ...options,
96
+ headers: {
97
+ 'Content-Type': 'application/json',
98
+ ...options.headers
99
+ }
100
+ });
101
+ }
102
+ /**
103
+ * Remove a contact from an assistant's contact filter
104
+ *
105
+ * Removes one entry from the list it is on. Takes effect on the next inbound message.
106
+ */
107
+ deleteAssistantContactFilterEntry(options) {
108
+ return (options.client ?? this.client).delete({
109
+ security: [{ scheme: 'bearer', type: 'http' }],
110
+ url: '/api/v1/businesses/chatbots/{chatbot_id}/contact-filter/entries/{entry_id}',
111
+ ...options
112
+ });
113
+ }
114
+ /**
115
+ * Retrieve a business
116
+ *
117
+ * Returns the business profile, including its opening hours, menus and assistants. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
118
+ */
119
+ getCurrentBusiness(options) {
120
+ return (options?.client ?? this.client).get({
121
+ security: [{ scheme: 'bearer', type: 'http' }],
122
+ url: '/api/v1/businesses/current',
123
+ ...options
124
+ });
125
+ }
126
+ /**
127
+ * Update a business
128
+ *
129
+ * Partially updates the business profile. Only the fields present in the request body are changed. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
130
+ */
131
+ updateCurrentBusiness(options) {
132
+ return (options.client ?? this.client).patch({
133
+ security: [{ scheme: 'bearer', type: 'http' }],
134
+ url: '/api/v1/businesses/current',
135
+ ...options,
136
+ headers: {
137
+ 'Content-Type': 'application/json',
138
+ ...options.headers
139
+ }
140
+ });
141
+ }
142
+ /**
143
+ * Retrieve opening hours
144
+ *
145
+ * Returns the opening hours grouped per weekday. These are the hours the assistant uses to decide whether the business is currently open. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
146
+ */
147
+ getCurrentBusinessHours(options) {
148
+ return (options?.client ?? this.client).get({
149
+ security: [{ scheme: 'bearer', type: 'http' }],
150
+ url: '/api/v1/businesses/hours',
151
+ ...options
152
+ });
153
+ }
154
+ /**
155
+ * Replace opening hours
156
+ *
157
+ * Replaces the whole week's opening hours in one call — a weekday omitted from the request is treated as closed. Changes take effect on live conversations immediately. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
158
+ */
159
+ updateCurrentBusinessHours(options) {
160
+ return (options.client ?? this.client).put({
161
+ security: [{ scheme: 'bearer', type: 'http' }],
162
+ url: '/api/v1/businesses/hours',
163
+ ...options,
164
+ headers: {
165
+ 'Content-Type': 'application/json',
166
+ ...options.headers
167
+ }
168
+ });
169
+ }
170
+ /**
171
+ * List library documents
172
+ *
173
+ * Returns the library documents and videos of the authenticated user's business, newest first, paged with `limit` and `offset`.
174
+ */
175
+ listBusinessLibraryDocuments(options) {
176
+ return (options?.client ?? this.client).get({
177
+ security: [{ scheme: 'bearer', type: 'http' }],
178
+ url: '/api/v1/businesses/library/documents',
179
+ ...options
180
+ });
181
+ }
182
+ /**
183
+ * Upload a library document
184
+ *
185
+ * Uploads a document or video to the library of the authenticated user's business so it can later be attached to messages. PDF, DOCX and MP4 are accepted; the type is read from the file's content, not its name.
186
+ */
187
+ uploadBusinessLibraryDocument(options) {
188
+ return (options.client ?? this.client).post({
189
+ ...formDataBodySerializer,
190
+ security: [{ scheme: 'bearer', type: 'http' }],
191
+ url: '/api/v1/businesses/library/documents',
192
+ ...options,
193
+ headers: {
194
+ 'Content-Type': null,
195
+ ...options.headers
196
+ }
197
+ });
198
+ }
199
+ /**
200
+ * Delete a library document
201
+ *
202
+ * Removes a document from the library. Messages already sent that referenced it are unaffected.
203
+ */
204
+ deleteBusinessLibraryDocument(options) {
205
+ return (options.client ?? this.client).delete({
206
+ security: [{ scheme: 'bearer', type: 'http' }],
207
+ url: '/api/v1/businesses/library/documents/{document_id}',
208
+ ...options
209
+ });
210
+ }
211
+ /**
212
+ * List library images
213
+ *
214
+ * Returns the library images of the authenticated user's business, newest first, paged with `limit` and `offset`.
215
+ */
216
+ listBusinessLibraryImages(options) {
217
+ return (options?.client ?? this.client).get({
218
+ security: [{ scheme: 'bearer', type: 'http' }],
219
+ url: '/api/v1/businesses/library/images',
220
+ ...options
221
+ });
222
+ }
223
+ /**
224
+ * Upload a library image
225
+ *
226
+ * Uploads an image to the library of the authenticated user's business so it can later be attached to messages. The business is taken from the credential; this operation accepts no business parameter.
227
+ */
228
+ uploadBusinessLibraryImage(options) {
229
+ return (options.client ?? this.client).post({
230
+ ...formDataBodySerializer,
231
+ security: [{ scheme: 'bearer', type: 'http' }],
232
+ url: '/api/v1/businesses/library/images',
233
+ ...options,
234
+ headers: {
235
+ 'Content-Type': null,
236
+ ...options.headers
237
+ }
238
+ });
239
+ }
240
+ /**
241
+ * Delete a library image
242
+ *
243
+ * Removes an image from the library. Messages already sent that referenced it are unaffected.
244
+ */
245
+ deleteBusinessLibraryImage(options) {
246
+ return (options.client ?? this.client).delete({
247
+ security: [{ scheme: 'bearer', type: 'http' }],
248
+ url: '/api/v1/businesses/library/images/{image_id}',
249
+ ...options
250
+ });
251
+ }
252
+ /**
253
+ * List library stickers
254
+ *
255
+ * Returns the library stickers of the authenticated user's business, newest first, paged with `limit` and `offset`.
256
+ */
257
+ listBusinessLibraryStickers(options) {
258
+ return (options?.client ?? this.client).get({
259
+ security: [{ scheme: 'bearer', type: 'http' }],
260
+ url: '/api/v1/businesses/library/stickers',
261
+ ...options
262
+ });
263
+ }
264
+ /**
265
+ * Upload a library sticker
266
+ *
267
+ * Uploads a WhatsApp sticker to the library of the authenticated user's business. It must be a 512x512 WebP of at most 100 KB, or 500 KB when animated. Stickers are kept apart from library images and are sent to customers as WhatsApp stickers, without a caption.
268
+ */
269
+ uploadBusinessLibrarySticker(options) {
270
+ return (options.client ?? this.client).post({
271
+ ...formDataBodySerializer,
272
+ security: [{ scheme: 'bearer', type: 'http' }],
273
+ url: '/api/v1/businesses/library/stickers',
274
+ ...options,
275
+ headers: {
276
+ 'Content-Type': null,
277
+ ...options.headers
278
+ }
279
+ });
280
+ }
281
+ /**
282
+ * Delete a library sticker
283
+ *
284
+ * Removes a sticker from the library. Copies already delivered on WhatsApp are unaffected, but the inbox can no longer show the sticker in earlier messages.
285
+ */
286
+ deleteBusinessLibrarySticker(options) {
287
+ return (options.client ?? this.client).delete({
288
+ security: [{ scheme: 'bearer', type: 'http' }],
289
+ url: '/api/v1/businesses/library/stickers/{sticker_id}',
290
+ ...options
291
+ });
292
+ }
293
+ /**
294
+ * List the business menus
295
+ *
296
+ * Returns the product catalog menus published by the business named in the `business-id` header.
297
+ */
298
+ listBusinessMenus(options) {
299
+ return (options?.client ?? this.client).get({
300
+ security: [{ scheme: 'bearer', type: 'http' }],
301
+ url: '/api/v1/businesses/menus',
302
+ ...options
303
+ });
304
+ }
305
+ /**
306
+ * Create a menu
307
+ *
308
+ * Creates a product catalog menu for the business named in the `business-id` header.
309
+ */
310
+ createBusinessMenu(options) {
311
+ return (options.client ?? this.client).post({
312
+ security: [{ scheme: 'bearer', type: 'http' }],
313
+ url: '/api/v1/businesses/menus',
314
+ ...options,
315
+ headers: {
316
+ 'Content-Type': 'application/json',
317
+ ...options.headers
318
+ }
319
+ });
320
+ }
321
+ /**
322
+ * Update a menu
323
+ *
324
+ * Replaces the contents of an existing menu.
325
+ */
326
+ updateBusinessMenu(options) {
327
+ return (options.client ?? this.client).put({
328
+ security: [{ scheme: 'bearer', type: 'http' }],
329
+ url: '/api/v1/businesses/menus/{menu_id}',
330
+ ...options,
331
+ headers: {
332
+ 'Content-Type': 'application/json',
333
+ ...options.headers
334
+ }
335
+ });
336
+ }
337
+ /**
338
+ * List WhatsApp Cloud numbers
339
+ *
340
+ * Returns the WhatsApp Cloud numbers connected to the business, along with the assistant bound to each. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
341
+ */
342
+ listCurrentWhatsAppNumbers(options) {
343
+ return (options?.client ?? this.client).get({
344
+ security: [{ scheme: 'bearer', type: 'http' }],
345
+ url: '/api/v1/businesses/whatsapp_cloud/numbers',
346
+ ...options
347
+ });
348
+ }
349
+ /**
350
+ * Remove a number from iZap
351
+ *
352
+ * Disconnects a WhatsApp Cloud number from the platform: it stops reaching any assistant and its stored credentials are discarded. The number itself stays registered at Meta and can be connected again later. Conversation history is kept. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
353
+ */
354
+ deleteCurrentWhatsAppNumber(options) {
355
+ return (options.client ?? this.client).delete({
356
+ security: [{ scheme: 'bearer', type: 'http' }],
357
+ url: '/api/v1/businesses/whatsapp_cloud/numbers/{number_id}',
358
+ ...options
359
+ });
360
+ }
361
+ /**
362
+ * Bind an assistant to a number
363
+ *
364
+ * Points a connected number at one of the business's assistants. Inbound messages to that number are answered by the assistant bound here. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
365
+ */
366
+ setCurrentWhatsAppNumberAssistant(options) {
367
+ return (options.client ?? this.client).put({
368
+ security: [{ scheme: 'bearer', type: 'http' }],
369
+ url: '/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/assistant',
370
+ ...options,
371
+ headers: {
372
+ 'Content-Type': 'application/json',
373
+ ...options.headers
374
+ }
375
+ });
376
+ }
377
+ /**
378
+ * Revoke iZap's access to a number at Meta
379
+ *
380
+ * Revokes iZap's access to the number at Meta and removes it from the platform. Unlike `deleteCurrentWhatsAppNumber`, which only disconnects the number from iZap, this also unsubscribes from the WhatsApp Business Account's webhooks at Meta and optionally deregisters the number from Cloud API entirely (`deregister`). Reconnecting requires a full Embedded Signup run. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
381
+ */
382
+ disconnectCurrentWhatsAppNumber(options) {
383
+ return (options.client ?? this.client).post({
384
+ security: [{ scheme: 'bearer', type: 'http' }],
385
+ url: '/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/disconnect',
386
+ ...options,
387
+ headers: {
388
+ 'Content-Type': 'application/json',
389
+ ...options.headers
390
+ }
391
+ });
392
+ }
393
+ /**
394
+ * Read a number's live status at Meta
395
+ *
396
+ * Fetches the number's current quality rating, verification state and status directly from Meta. Read-only. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
397
+ */
398
+ getCurrentWhatsAppNumberLiveStatus(options) {
399
+ return (options.client ?? this.client).get({
400
+ security: [{ scheme: 'bearer', type: 'http' }],
401
+ url: '/api/v1/businesses/whatsapp_cloud/numbers/{number_id}/live',
402
+ ...options
403
+ });
404
+ }
405
+ /**
406
+ * Register a WhatsApp Cloud number
407
+ *
408
+ * Exchanges an Embedded Signup code and registers the WhatsApp Business Account in the background. Returns `202` with a `task_id`; poll the registration task until its status is `completed` or `failed`. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
409
+ */
410
+ registerCurrentWhatsAppNumber(options) {
411
+ return (options.client ?? this.client).post({
412
+ security: [{ scheme: 'bearer', type: 'http' }],
413
+ url: '/api/v1/businesses/whatsapp_cloud/register',
414
+ ...options,
415
+ headers: {
416
+ 'Content-Type': 'application/json',
417
+ ...options.headers
418
+ }
419
+ });
420
+ }
421
+ /**
422
+ * Check a number registration task
423
+ *
424
+ * Returns the progress of an asynchronous number registration. Read-only and safe to poll. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
425
+ */
426
+ getCurrentWhatsAppNumberRegistrationTask(options) {
427
+ return (options.client ?? this.client).get({
428
+ security: [{ scheme: 'bearer', type: 'http' }],
429
+ url: '/api/v1/businesses/whatsapp_cloud/register/tasks/{task_id}',
430
+ ...options
431
+ });
432
+ }
433
+ /**
434
+ * Send the product catalog
435
+ *
436
+ * Sends an interactive catalog message to a WhatsApp recipient. The catalog is the one linked to the business's WhatsApp Business Account in Meta's Commerce Manager. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
437
+ */
438
+ sendCurrentWhatsAppCatalog(options) {
439
+ return (options.client ?? this.client).post({
440
+ security: [{ scheme: 'bearer', type: 'http' }],
441
+ url: '/api/v1/businesses/whatsapp_cloud/send_catalog',
442
+ ...options,
443
+ headers: {
444
+ 'Content-Type': 'application/json',
445
+ ...options.headers
446
+ }
447
+ });
448
+ }
449
+ /**
450
+ * Read WhatsApp Business Account details
451
+ *
452
+ * Fetches business-verification details for the WhatsApp Business Account from Meta. The values are account-level, so they are the same for every number under the business. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
453
+ */
454
+ getCurrentWhatsAppBusinessAccountInfo(options) {
455
+ return (options?.client ?? this.client).get({
456
+ security: [{ scheme: 'bearer', type: 'http' }],
457
+ url: '/api/v1/businesses/whatsapp_cloud/waba_info',
458
+ ...options
459
+ });
460
+ }
461
+ /**
462
+ * List a business's chats
463
+ *
464
+ * Returns the business's conversations with paging, and optional filters for kind and assistant. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
465
+ */
466
+ listCurrentBusinessChats(options) {
467
+ return (options?.client ?? this.client).get({
468
+ security: [{ scheme: 'bearer', type: 'http' }],
469
+ url: '/api/v1/chats',
470
+ ...options
471
+ });
472
+ }
473
+ /**
474
+ * Create a sandbox chat
475
+ *
476
+ * Creates a trainer sandbox conversation for the business named in the `business-id` header. Sandbox chats exercise an assistant without messaging a real customer, and a business with no connected WhatsApp number may keep only a limited number of them.
477
+ */
478
+ createChat(options) {
479
+ return (options.client ?? this.client).post({
480
+ security: [{ scheme: 'bearer', type: 'http' }],
481
+ url: '/api/v1/chats',
482
+ ...options,
483
+ headers: {
484
+ 'Content-Type': 'application/json',
485
+ ...options.headers
486
+ }
487
+ });
488
+ }
489
+ /**
490
+ * Start a conversation with a template
491
+ *
492
+ * Adds a contact by international phone number (E.164, leading `+`) and opens the conversation by sending an approved WhatsApp template. An existing contact with the same number is reused. Pass `whatsapp_number_id` when the business has more than one WhatsApp number. The business is taken from the `business-id` header.
493
+ */
494
+ startTemplateConversation(options) {
495
+ return (options.client ?? this.client).post({
496
+ security: [{ scheme: 'bearer', type: 'http' }],
497
+ url: '/api/v1/chats/template-conversations',
498
+ ...options,
499
+ headers: {
500
+ 'Content-Type': 'application/json',
501
+ ...options.headers
502
+ }
503
+ });
504
+ }
505
+ /**
506
+ * Delete a chat
507
+ *
508
+ * Deletes the conversation. Deleting one that is already deleted returns `410`.
509
+ */
510
+ deleteChat(options) {
511
+ return (options.client ?? this.client).delete({
512
+ security: [{ scheme: 'bearer', type: 'http' }],
513
+ url: '/api/v1/chats/{chat_id}',
514
+ ...options
515
+ });
516
+ }
517
+ /**
518
+ * List a chat's messages
519
+ *
520
+ * Returns the conversation's messages newest first, with paging. Each message carries its author, content, timestamp and delivery status. Any chat id belonging to the conversation may be used.
521
+ */
522
+ listChatMessages(options) {
523
+ return (options.client ?? this.client).get({
524
+ security: [{ scheme: 'bearer', type: 'http' }],
525
+ url: '/api/v1/chats/{chat_id}/messages',
526
+ ...options
527
+ });
528
+ }
529
+ /**
530
+ * Send a message to a chat
531
+ *
532
+ * Sends a message as a human agent and stores it on the conversation. The assistant does not reply to messages sent this way. Attachments are supported.
533
+ */
534
+ sendChatMessage(options) {
535
+ return (options.client ?? this.client).post({
536
+ security: [{ scheme: 'bearer', type: 'http' }],
537
+ url: '/api/v1/chats/{chat_id}/messages',
538
+ ...options,
539
+ headers: {
540
+ 'Content-Type': 'application/json',
541
+ ...options.headers
542
+ }
543
+ });
544
+ }
545
+ /**
546
+ * Send a template message to a chat
547
+ *
548
+ * Sends an approved WhatsApp template into the conversation. This is the only way to reach a customer outside the 24-hour customer-service window. A rendered copy is stored so agents see what was sent.
549
+ */
550
+ sendChatTemplateMessage(options) {
551
+ return (options.client ?? this.client).post({
552
+ security: [{ scheme: 'bearer', type: 'http' }],
553
+ url: '/api/v1/chats/{chat_id}/messages/template',
554
+ ...options,
555
+ headers: {
556
+ 'Content-Type': 'application/json',
557
+ ...options.headers
558
+ }
559
+ });
560
+ }
561
+ /**
562
+ * Retrieve a message's details
563
+ *
564
+ * Returns one message with its delivery details, optionally including the replies generated in the same exchange. This operation only reads; it uses `POST` for historical reasons. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
565
+ */
566
+ getCurrentBusinessChatMessageDetails(options) {
567
+ return (options.client ?? this.client).post({
568
+ security: [{ scheme: 'bearer', type: 'http' }],
569
+ url: '/api/v1/chats/{chat_id}/messages/{message_id}',
570
+ ...options
571
+ });
572
+ }
573
+ /**
574
+ * Pause the assistant on a chat
575
+ *
576
+ * Stops the assistant answering automatically on this conversation so a human can take over. Incoming messages are still received and stored.
577
+ */
578
+ pauseChatAssistant(options) {
579
+ return (options.client ?? this.client).post({
580
+ security: [{ scheme: 'bearer', type: 'http' }],
581
+ url: '/api/v1/chats/{chat_id}/pause',
582
+ ...options,
583
+ headers: {
584
+ 'Content-Type': 'application/json',
585
+ ...options.headers
586
+ }
587
+ });
588
+ }
589
+ /**
590
+ * Check whether the assistant is paused
591
+ *
592
+ * Reports whether automatic replies are currently paused on the conversation, and until when.
593
+ */
594
+ getChatPauseStatus(options) {
595
+ return (options.client ?? this.client).get({
596
+ security: [{ scheme: 'bearer', type: 'http' }],
597
+ url: '/api/v1/chats/{chat_id}/pause-status',
598
+ ...options
599
+ });
600
+ }
601
+ /**
602
+ * Mark a chat as read
603
+ *
604
+ * Marks the conversation read for the whole team as of now. Read state is shared between agents rather than tracked per agent, and the timestamp is stamped server-side.
605
+ */
606
+ markChatRead(options) {
607
+ return (options.client ?? this.client).put({
608
+ security: [{ scheme: 'bearer', type: 'http' }],
609
+ url: '/api/v1/chats/{chat_id}/read',
610
+ ...options
611
+ });
612
+ }
613
+ /**
614
+ * Snooze a chat
615
+ *
616
+ * Snoozes the conversation until the given instant, or wakes it by sending `null`. Like read state, snoozing applies to the whole team.
617
+ */
618
+ snoozeChat(options) {
619
+ return (options.client ?? this.client).put({
620
+ security: [{ scheme: 'bearer', type: 'http' }],
621
+ url: '/api/v1/chats/{chat_id}/snooze',
622
+ ...options,
623
+ headers: {
624
+ 'Content-Type': 'application/json',
625
+ ...options.headers
626
+ }
627
+ });
628
+ }
629
+ /**
630
+ * Set a chat's status
631
+ *
632
+ * Sets the conversation's status — the value the inbox filters on. The status is held against the business/customer pair, so it survives a conversation being closed and reopened.
633
+ */
634
+ setChatStatus(options) {
635
+ return (options.client ?? this.client).put({
636
+ security: [{ scheme: 'bearer', type: 'http' }],
637
+ url: '/api/v1/chats/{chat_id}/status',
638
+ ...options,
639
+ headers: {
640
+ 'Content-Type': 'application/json',
641
+ ...options.headers
642
+ }
643
+ });
644
+ }
645
+ /**
646
+ * Resume the assistant on a chat
647
+ *
648
+ * Hands the conversation back to the assistant, which resumes answering incoming messages automatically.
649
+ */
650
+ resumeChatAssistant(options) {
651
+ return (options.client ?? this.client).post({
652
+ security: [{ scheme: 'bearer', type: 'http' }],
653
+ url: '/api/v1/chats/{chat_id}/unpause',
654
+ ...options
655
+ });
656
+ }
657
+ /**
658
+ * Upload an attachment
659
+ *
660
+ * Uploads a file to be attached to a message on this conversation, and returns the stored reference to pass when sending that message.
661
+ */
662
+ uploadChatAttachment(options) {
663
+ return (options.client ?? this.client).post({
664
+ ...formDataBodySerializer,
665
+ security: [{ scheme: 'bearer', type: 'http' }],
666
+ url: '/api/v1/chats/{chat_id}/upload',
667
+ ...options,
668
+ headers: {
669
+ 'Content-Type': null,
670
+ ...options.headers
671
+ }
672
+ });
673
+ }
674
+ /**
675
+ * List contacts
676
+ *
677
+ * Returns the contacts for the business in the `business-id` header. Use `search` to match by name, phone or email, `chatbot_id` to narrow the list to one assistant, and `page` / `page_size` to page through the result.
678
+ */
679
+ listContacts(options) {
680
+ return (options?.client ?? this.client).get({
681
+ security: [{ scheme: 'bearer', type: 'http' }],
682
+ url: '/api/v1/contacts',
683
+ ...options
684
+ });
685
+ }
686
+ /**
687
+ * Create a contact
688
+ *
689
+ * Creates a contact for the business in the `business-id` header. The phone number is fixed after creation; use the update operation for the name, email, tags and notes.
690
+ */
691
+ createContact(options) {
692
+ return (options.client ?? this.client).post({
693
+ security: [{ scheme: 'bearer', type: 'http' }],
694
+ url: '/api/v1/contacts',
695
+ ...options,
696
+ headers: {
697
+ 'Content-Type': 'application/json',
698
+ ...options.headers
699
+ }
700
+ });
701
+ }
702
+ /**
703
+ * Import contacts
704
+ *
705
+ * Creates or updates contacts from a list of rows for the business in the `business-id` header. Invalid rows are skipped and reported with their 0-based index in the `rows` array; valid rows are still applied.
706
+ */
707
+ importContacts(options) {
708
+ return (options.client ?? this.client).post({
709
+ security: [{ scheme: 'bearer', type: 'http' }],
710
+ url: '/api/v1/contacts/import',
711
+ ...options,
712
+ headers: {
713
+ 'Content-Type': 'application/json',
714
+ ...options.headers
715
+ }
716
+ });
717
+ }
718
+ /**
719
+ * Retrieve a contact
720
+ *
721
+ * Returns one contact, including the conversations that belong to it. A contact from another business returns `404` rather than leaking that it exists.
722
+ */
723
+ getContact(options) {
724
+ return (options.client ?? this.client).get({
725
+ security: [{ scheme: 'bearer', type: 'http' }],
726
+ url: '/api/v1/contacts/{contact_id}',
727
+ ...options
728
+ });
729
+ }
730
+ /**
731
+ * Update a contact
732
+ *
733
+ * Partially updates a contact's name, email, tags or notes. The phone number cannot be changed after the contact is created.
734
+ */
735
+ updateContact(options) {
736
+ return (options.client ?? this.client).patch({
737
+ security: [{ scheme: 'bearer', type: 'http' }],
738
+ url: '/api/v1/contacts/{contact_id}',
739
+ ...options,
740
+ headers: {
741
+ 'Content-Type': 'application/json',
742
+ ...options.headers
743
+ }
744
+ });
745
+ }
746
+ /**
747
+ * List personal access tokens
748
+ *
749
+ * Returns the personal access tokens belonging to the authenticated user. Only metadata is returned; a token's value is never readable after it is created.
750
+ */
751
+ listApiTokens(options) {
752
+ return (options?.client ?? this.client).get({
753
+ security: [{ scheme: 'bearer', type: 'http' }],
754
+ url: '/api/v1/me/api-tokens',
755
+ ...options
756
+ });
757
+ }
758
+ /**
759
+ * Create a personal access token
760
+ *
761
+ * Issues a new personal access token for the authenticated user. The token value appears exactly once, in this response — store it before discarding the response, because it cannot be retrieved again.
762
+ */
763
+ createApiToken(options) {
764
+ return (options.client ?? this.client).post({
765
+ security: [{ scheme: 'bearer', type: 'http' }],
766
+ url: '/api/v1/me/api-tokens',
767
+ ...options,
768
+ headers: {
769
+ 'Content-Type': 'application/json',
770
+ ...options.headers
771
+ }
772
+ });
773
+ }
774
+ /**
775
+ * Revoke a personal access token
776
+ *
777
+ * Revokes the token immediately. Every later request presenting it is rejected.
778
+ */
779
+ revokeApiToken(options) {
780
+ return (options.client ?? this.client).delete({
781
+ security: [{ scheme: 'bearer', type: 'http' }],
782
+ url: '/api/v1/me/api-tokens/{token_id}',
783
+ ...options
784
+ });
785
+ }
786
+ /**
787
+ * List transmissions
788
+ *
789
+ * Returns the business's bulk sends, newest first. Archived rows are omitted unless `status=archived` is passed. Optionally filter by any other status.
790
+ */
791
+ listTransmissions(options) {
792
+ return (options?.client ?? this.client).get({
793
+ security: [{ scheme: 'bearer', type: 'http' }],
794
+ url: '/api/v1/transmissions',
795
+ ...options
796
+ });
797
+ }
798
+ /**
799
+ * Preview a transmission
800
+ *
801
+ * Validates the recipient list and template and stores the result as a draft, without sending anything. Review the draft, then confirm it to dispatch.
802
+ */
803
+ previewTransmission(options) {
804
+ return (options.client ?? this.client).post({
805
+ security: [{ scheme: 'bearer', type: 'http' }],
806
+ url: '/api/v1/transmissions/preview',
807
+ ...options,
808
+ headers: {
809
+ 'Content-Type': 'application/json',
810
+ ...options.headers
811
+ }
812
+ });
813
+ }
814
+ /**
815
+ * Retrieve a transmission
816
+ *
817
+ * Returns one transmission with its current status and per-recipient counts.
818
+ */
819
+ getTransmission(options) {
820
+ return (options.client ?? this.client).get({
821
+ security: [{ scheme: 'bearer', type: 'http' }],
822
+ url: '/api/v1/transmissions/{transmission_id}',
823
+ ...options
824
+ });
825
+ }
826
+ /**
827
+ * Archive a transmission
828
+ *
829
+ * Hides a draft or cancelled transmission from the default list without deleting it. Idempotent for already-archived rows. Does not send or confirm; confirming an archived transmission is rejected.
830
+ */
831
+ archiveTransmission(options) {
832
+ return (options.client ?? this.client).post({
833
+ security: [{ scheme: 'bearer', type: 'http' }],
834
+ url: '/api/v1/transmissions/{transmission_id}/archive',
835
+ ...options
836
+ });
837
+ }
838
+ /**
839
+ * Cancel a transmission
840
+ *
841
+ * Cancels a transmission that has not finished. Cancelling one that already completed, failed or was cancelled is a no-op that returns its current status. A send in progress stops cooperatively, so messages already dispatched are still delivered.
842
+ */
843
+ cancelTransmission(options) {
844
+ return (options.client ?? this.client).post({
845
+ security: [{ scheme: 'bearer', type: 'http' }],
846
+ url: '/api/v1/transmissions/{transmission_id}/cancel',
847
+ ...options
848
+ });
849
+ }
850
+ /**
851
+ * Confirm and dispatch a transmission
852
+ *
853
+ * Releases a draft transmission for delivery. **This sends real messages to real recipients and cannot be undone.**
854
+ */
855
+ confirmTransmission(options) {
856
+ return (options.client ?? this.client).post({
857
+ security: [{ scheme: 'bearer', type: 'http' }],
858
+ url: '/api/v1/transmissions/{transmission_id}/confirm',
859
+ ...options
860
+ });
861
+ }
862
+ /**
863
+ * List webhook endpoints
864
+ *
865
+ * Returns the webhook endpoints registered for the business, newest first. Signing secrets are never included — a secret is readable only in the response that creates or rotates it. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
866
+ */
867
+ listCurrentWebhookEndpoints(options) {
868
+ return (options?.client ?? this.client).get({
869
+ security: [{ scheme: 'bearer', type: 'http' }],
870
+ url: '/api/v1/webhook-endpoints',
871
+ ...options
872
+ });
873
+ }
874
+ /**
875
+ * Register a webhook endpoint
876
+ *
877
+ * Registers a URL to receive signed event deliveries and returns it along with its signing secret. **The secret is shown exactly once** — store it now; afterwards you can only rotate it. The URL must be a publicly resolvable HTTPS address, and every entry in `subscribed_events` must be a known event type. Requires a plan that includes event webhooks. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
878
+ */
879
+ createCurrentWebhookEndpoint(options) {
880
+ return (options.client ?? this.client).post({
881
+ security: [{ scheme: 'bearer', type: 'http' }],
882
+ url: '/api/v1/webhook-endpoints',
883
+ ...options,
884
+ headers: {
885
+ 'Content-Type': 'application/json',
886
+ ...options.headers
887
+ }
888
+ });
889
+ }
890
+ /**
891
+ * Resend a delivery
892
+ *
893
+ * Queues a past delivery to be sent again. The stored request body is replayed byte for byte, so the original signature still verifies. Responds `202` once queued; the send itself happens in the background. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
894
+ */
895
+ resendCurrentWebhookDelivery(options) {
896
+ return (options.client ?? this.client).post({
897
+ security: [{ scheme: 'bearer', type: 'http' }],
898
+ url: '/api/v1/webhook-endpoints/deliveries/{delivery_id}/resend',
899
+ ...options
900
+ });
901
+ }
902
+ /**
903
+ * Delete a webhook endpoint
904
+ *
905
+ * Removes the endpoint and stops delivering to it. Past deliveries are retained. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
906
+ */
907
+ deleteCurrentWebhookEndpoint(options) {
908
+ return (options.client ?? this.client).delete({
909
+ security: [{ scheme: 'bearer', type: 'http' }],
910
+ url: '/api/v1/webhook-endpoints/{endpoint_id}',
911
+ ...options
912
+ });
913
+ }
914
+ /**
915
+ * Update a webhook endpoint
916
+ *
917
+ * Changes an endpoint's URL, label, subscribed events or enabled state; omitted fields are left alone. Re-enabling an endpoint also clears the consecutive-failure streak that auto-disabled it, so a single later failure will not disable it again. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
918
+ */
919
+ updateCurrentWebhookEndpoint(options) {
920
+ return (options.client ?? this.client).patch({
921
+ security: [{ scheme: 'bearer', type: 'http' }],
922
+ url: '/api/v1/webhook-endpoints/{endpoint_id}',
923
+ ...options,
924
+ headers: {
925
+ 'Content-Type': 'application/json',
926
+ ...options.headers
927
+ }
928
+ });
929
+ }
930
+ /**
931
+ * Rotate an endpoint's signing secret
932
+ *
933
+ * Issues a new signing secret and returns it. **The previous secret stops verifying immediately** and there is no overlap window, so deploy the new one to your receiver before rotating. The business is taken from the `business-id` header rather than the URL; the path-scoped form of this operation is deprecated.
934
+ */
935
+ rotateCurrentWebhookSigningSecret(options) {
936
+ return (options.client ?? this.client).post({
937
+ security: [{ scheme: 'bearer', type: 'http' }],
938
+ url: '/api/v1/webhook-endpoints/{endpoint_id}/rotate-secret',
939
+ ...options
940
+ });
941
+ }
942
+ /**
943
+ * List message templates
944
+ *
945
+ * Returns the business's WhatsApp message templates, optionally filtered by review status.
946
+ */
947
+ listWhatsAppTemplates(options) {
948
+ return (options?.client ?? this.client).get({
949
+ security: [{ scheme: 'bearer', type: 'http' }],
950
+ url: '/api/v1/whatsapp_templates',
951
+ ...options
952
+ });
953
+ }
954
+ /**
955
+ * Create a message template
956
+ *
957
+ * Creates a template as a local draft. A draft cannot be used for sending until it has been submitted to Meta and approved.
958
+ */
959
+ createWhatsAppTemplate(options) {
960
+ return (options.client ?? this.client).post({
961
+ security: [{ scheme: 'bearer', type: 'http' }],
962
+ url: '/api/v1/whatsapp_templates',
963
+ ...options,
964
+ headers: {
965
+ 'Content-Type': 'application/json',
966
+ ...options.headers
967
+ }
968
+ });
969
+ }
970
+ /**
971
+ * Sync template status from Meta
972
+ *
973
+ * Pulls the current review status of the business's templates from Meta and updates the stored copies, so templates approved or rejected on Meta's side become visible here.
974
+ */
975
+ syncWhatsAppTemplates(options) {
976
+ return (options?.client ?? this.client).post({
977
+ security: [{ scheme: 'bearer', type: 'http' }],
978
+ url: '/api/v1/whatsapp_templates/sync',
979
+ ...options
980
+ });
981
+ }
982
+ /**
983
+ * Delete a message template
984
+ *
985
+ * Deletes the template. Messages already sent with it are unaffected.
986
+ */
987
+ deleteWhatsAppTemplate(options) {
988
+ return (options.client ?? this.client).delete({
989
+ security: [{ scheme: 'bearer', type: 'http' }],
990
+ url: '/api/v1/whatsapp_templates/{template_id}',
991
+ ...options
992
+ });
993
+ }
994
+ /**
995
+ * Retrieve a message template
996
+ *
997
+ * Returns one template, including its body, variables and current review status.
998
+ */
999
+ getWhatsAppTemplate(options) {
1000
+ return (options.client ?? this.client).get({
1001
+ security: [{ scheme: 'bearer', type: 'http' }],
1002
+ url: '/api/v1/whatsapp_templates/{template_id}',
1003
+ ...options
1004
+ });
1005
+ }
1006
+ /**
1007
+ * Update a message template
1008
+ *
1009
+ * Updates a template. Its content can only be changed while the template is still a local draft or has been rejected — an approved template has to be replaced by a new one.
1010
+ */
1011
+ updateWhatsAppTemplate(options) {
1012
+ return (options.client ?? this.client).patch({
1013
+ security: [{ scheme: 'bearer', type: 'http' }],
1014
+ url: '/api/v1/whatsapp_templates/{template_id}',
1015
+ ...options,
1016
+ headers: {
1017
+ 'Content-Type': 'application/json',
1018
+ ...options.headers
1019
+ }
1020
+ });
1021
+ }
1022
+ /**
1023
+ * Submit a template for review
1024
+ *
1025
+ * Submits the template to Meta for approval. Review is asynchronous — poll the template, or sync from Meta, to see the outcome.
1026
+ */
1027
+ submitWhatsAppTemplate(options) {
1028
+ return (options.client ?? this.client).post({
1029
+ security: [{ scheme: 'bearer', type: 'http' }],
1030
+ url: '/api/v1/whatsapp_templates/{template_id}/submit',
1031
+ ...options
1032
+ });
1033
+ }
1034
+ }
1035
+ //# sourceMappingURL=sdk.gen.js.map