@zavudev/sdk 0.30.0 → 0.38.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 (305) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/client.d.mts +28 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +28 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js +25 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs +25 -1
  9. package/client.mjs.map +1 -1
  10. package/internal/utils/env.js +2 -2
  11. package/internal/utils/env.js.map +1 -1
  12. package/internal/utils/env.mjs +2 -2
  13. package/internal/utils/env.mjs.map +1 -1
  14. package/package.json +1 -1
  15. package/resources/balance.d.mts +33 -0
  16. package/resources/balance.d.mts.map +1 -0
  17. package/resources/balance.d.ts +33 -0
  18. package/resources/balance.d.ts.map +1 -0
  19. package/resources/balance.js +16 -0
  20. package/resources/balance.js.map +1 -0
  21. package/resources/balance.mjs +12 -0
  22. package/resources/balance.mjs.map +1 -0
  23. package/resources/broadcasts/broadcasts.d.mts +31 -1
  24. package/resources/broadcasts/broadcasts.d.mts.map +1 -1
  25. package/resources/broadcasts/broadcasts.d.ts +31 -1
  26. package/resources/broadcasts/broadcasts.d.ts.map +1 -1
  27. package/resources/broadcasts/broadcasts.js +28 -0
  28. package/resources/broadcasts/broadcasts.js.map +1 -1
  29. package/resources/broadcasts/broadcasts.mjs +28 -0
  30. package/resources/broadcasts/broadcasts.mjs.map +1 -1
  31. package/resources/broadcasts/index.d.mts +1 -1
  32. package/resources/broadcasts/index.d.mts.map +1 -1
  33. package/resources/broadcasts/index.d.ts +1 -1
  34. package/resources/broadcasts/index.d.ts.map +1 -1
  35. package/resources/broadcasts/index.js.map +1 -1
  36. package/resources/broadcasts/index.mjs.map +1 -1
  37. package/resources/contacts/channels.d.mts +127 -0
  38. package/resources/contacts/channels.d.mts.map +1 -0
  39. package/resources/contacts/channels.d.ts +127 -0
  40. package/resources/contacts/channels.d.ts.map +1 -0
  41. package/resources/contacts/channels.js +76 -0
  42. package/resources/contacts/channels.js.map +1 -0
  43. package/resources/contacts/channels.mjs +72 -0
  44. package/resources/contacts/channels.mjs.map +1 -0
  45. package/resources/contacts/contacts.d.mts +262 -0
  46. package/resources/contacts/contacts.d.mts.map +1 -0
  47. package/resources/contacts/contacts.d.ts +262 -0
  48. package/resources/contacts/contacts.d.ts.map +1 -0
  49. package/resources/contacts/contacts.js +118 -0
  50. package/resources/contacts/contacts.js.map +1 -0
  51. package/resources/contacts/contacts.mjs +113 -0
  52. package/resources/contacts/contacts.mjs.map +1 -0
  53. package/resources/contacts/index.d.mts +3 -0
  54. package/resources/contacts/index.d.mts.map +1 -0
  55. package/resources/contacts/index.d.ts +3 -0
  56. package/resources/contacts/index.d.ts.map +1 -0
  57. package/resources/contacts/index.js +9 -0
  58. package/resources/contacts/index.js.map +1 -0
  59. package/resources/contacts/index.mjs +4 -0
  60. package/resources/contacts/index.mjs.map +1 -0
  61. package/resources/contacts.d.mts +1 -144
  62. package/resources/contacts.d.mts.map +1 -1
  63. package/resources/contacts.d.ts +1 -144
  64. package/resources/contacts.d.ts.map +1 -1
  65. package/resources/contacts.js +2 -31
  66. package/resources/contacts.js.map +1 -1
  67. package/resources/contacts.mjs +1 -29
  68. package/resources/contacts.mjs.map +1 -1
  69. package/resources/exports.d.mts +101 -0
  70. package/resources/exports.d.mts.map +1 -0
  71. package/resources/exports.d.ts +101 -0
  72. package/resources/exports.d.ts.map +1 -0
  73. package/resources/exports.js +53 -0
  74. package/resources/exports.js.map +1 -0
  75. package/resources/exports.mjs +49 -0
  76. package/resources/exports.mjs.map +1 -0
  77. package/resources/index.d.mts +10 -2
  78. package/resources/index.d.mts.map +1 -1
  79. package/resources/index.d.ts +10 -2
  80. package/resources/index.d.ts.map +1 -1
  81. package/resources/index.js +18 -2
  82. package/resources/index.js.map +1 -1
  83. package/resources/index.mjs +9 -1
  84. package/resources/index.mjs.map +1 -1
  85. package/resources/invitations.d.mts +133 -0
  86. package/resources/invitations.d.mts.map +1 -0
  87. package/resources/invitations.d.ts +133 -0
  88. package/resources/invitations.d.ts.map +1 -0
  89. package/resources/invitations.js +67 -0
  90. package/resources/invitations.js.map +1 -0
  91. package/resources/invitations.mjs +63 -0
  92. package/resources/invitations.mjs.map +1 -0
  93. package/resources/messages.d.mts +37 -4
  94. package/resources/messages.d.mts.map +1 -1
  95. package/resources/messages.d.ts +37 -4
  96. package/resources/messages.d.ts.map +1 -1
  97. package/resources/number-10dlc/brands.d.mts +258 -0
  98. package/resources/number-10dlc/brands.d.mts.map +1 -0
  99. package/resources/number-10dlc/brands.d.ts +258 -0
  100. package/resources/number-10dlc/brands.d.ts.map +1 -0
  101. package/resources/number-10dlc/brands.js +132 -0
  102. package/resources/number-10dlc/brands.js.map +1 -0
  103. package/resources/number-10dlc/brands.mjs +128 -0
  104. package/resources/number-10dlc/brands.mjs.map +1 -0
  105. package/resources/number-10dlc/campaigns/campaigns.d.mts +223 -0
  106. package/resources/number-10dlc/campaigns/campaigns.d.mts.map +1 -0
  107. package/resources/number-10dlc/campaigns/campaigns.d.ts +223 -0
  108. package/resources/number-10dlc/campaigns/campaigns.d.ts.map +1 -0
  109. package/resources/number-10dlc/campaigns/campaigns.js +133 -0
  110. package/resources/number-10dlc/campaigns/campaigns.js.map +1 -0
  111. package/resources/number-10dlc/campaigns/campaigns.mjs +128 -0
  112. package/resources/number-10dlc/campaigns/campaigns.mjs.map +1 -0
  113. package/resources/number-10dlc/campaigns/index.d.mts +3 -0
  114. package/resources/number-10dlc/campaigns/index.d.mts.map +1 -0
  115. package/resources/number-10dlc/campaigns/index.d.ts +3 -0
  116. package/resources/number-10dlc/campaigns/index.d.ts.map +1 -0
  117. package/resources/number-10dlc/campaigns/index.js +9 -0
  118. package/resources/number-10dlc/campaigns/index.js.map +1 -0
  119. package/resources/number-10dlc/campaigns/index.mjs +4 -0
  120. package/resources/number-10dlc/campaigns/index.mjs.map +1 -0
  121. package/resources/number-10dlc/campaigns/phone-numbers.d.mts +79 -0
  122. package/resources/number-10dlc/campaigns/phone-numbers.d.mts.map +1 -0
  123. package/resources/number-10dlc/campaigns/phone-numbers.d.ts +79 -0
  124. package/resources/number-10dlc/campaigns/phone-numbers.d.ts.map +1 -0
  125. package/resources/number-10dlc/campaigns/phone-numbers.js +59 -0
  126. package/resources/number-10dlc/campaigns/phone-numbers.js.map +1 -0
  127. package/resources/number-10dlc/campaigns/phone-numbers.mjs +55 -0
  128. package/resources/number-10dlc/campaigns/phone-numbers.mjs.map +1 -0
  129. package/resources/number-10dlc/campaigns.d.mts +2 -0
  130. package/resources/number-10dlc/campaigns.d.mts.map +1 -0
  131. package/resources/number-10dlc/campaigns.d.ts +2 -0
  132. package/resources/number-10dlc/campaigns.d.ts.map +1 -0
  133. package/resources/number-10dlc/campaigns.js +6 -0
  134. package/resources/number-10dlc/campaigns.js.map +1 -0
  135. package/resources/number-10dlc/campaigns.mjs +3 -0
  136. package/resources/number-10dlc/campaigns.mjs.map +1 -0
  137. package/resources/number-10dlc/index.d.mts +4 -0
  138. package/resources/number-10dlc/index.d.mts.map +1 -0
  139. package/resources/number-10dlc/index.d.ts +4 -0
  140. package/resources/number-10dlc/index.d.ts.map +1 -0
  141. package/resources/number-10dlc/index.js +11 -0
  142. package/resources/number-10dlc/index.js.map +1 -0
  143. package/resources/number-10dlc/index.mjs +5 -0
  144. package/resources/number-10dlc/index.mjs.map +1 -0
  145. package/resources/number-10dlc/number-10dlc.d.mts +14 -0
  146. package/resources/number-10dlc/number-10dlc.d.mts.map +1 -0
  147. package/resources/number-10dlc/number-10dlc.d.ts +14 -0
  148. package/resources/number-10dlc/number-10dlc.d.ts.map +1 -0
  149. package/resources/number-10dlc/number-10dlc.js +21 -0
  150. package/resources/number-10dlc/number-10dlc.js.map +1 -0
  151. package/resources/number-10dlc/number-10dlc.mjs +16 -0
  152. package/resources/number-10dlc/number-10dlc.mjs.map +1 -0
  153. package/resources/number-10dlc.d.mts +2 -0
  154. package/resources/number-10dlc.d.mts.map +1 -0
  155. package/resources/number-10dlc.d.ts +2 -0
  156. package/resources/number-10dlc.d.ts.map +1 -0
  157. package/resources/number-10dlc.js +6 -0
  158. package/resources/number-10dlc.js.map +1 -0
  159. package/resources/number-10dlc.mjs +3 -0
  160. package/resources/number-10dlc.mjs.map +1 -0
  161. package/resources/plan.d.mts +43 -0
  162. package/resources/plan.d.mts.map +1 -0
  163. package/resources/plan.d.ts +43 -0
  164. package/resources/plan.d.ts.map +1 -0
  165. package/resources/plan.js +16 -0
  166. package/resources/plan.js.map +1 -0
  167. package/resources/plan.mjs +12 -0
  168. package/resources/plan.mjs.map +1 -0
  169. package/resources/senders/agent/agent.d.mts +4 -4
  170. package/resources/senders/agent/agent.d.mts.map +1 -1
  171. package/resources/senders/agent/agent.d.ts +4 -4
  172. package/resources/senders/agent/agent.d.ts.map +1 -1
  173. package/resources/senders/agent/agent.js.map +1 -1
  174. package/resources/senders/agent/agent.mjs.map +1 -1
  175. package/resources/senders/agent/flows.d.mts +40 -114
  176. package/resources/senders/agent/flows.d.mts.map +1 -1
  177. package/resources/senders/agent/flows.d.ts +40 -114
  178. package/resources/senders/agent/flows.d.ts.map +1 -1
  179. package/resources/senders/agent/index.d.mts +2 -2
  180. package/resources/senders/agent/index.d.mts.map +1 -1
  181. package/resources/senders/agent/index.d.ts +2 -2
  182. package/resources/senders/agent/index.d.ts.map +1 -1
  183. package/resources/senders/agent/index.js.map +1 -1
  184. package/resources/senders/agent/index.mjs.map +1 -1
  185. package/resources/senders/agent/tools.d.mts +15 -47
  186. package/resources/senders/agent/tools.d.mts.map +1 -1
  187. package/resources/senders/agent/tools.d.ts +15 -47
  188. package/resources/senders/agent/tools.d.ts.map +1 -1
  189. package/resources/senders/index.d.mts +1 -0
  190. package/resources/senders/index.d.mts.map +1 -1
  191. package/resources/senders/index.d.ts +1 -0
  192. package/resources/senders/index.d.ts.map +1 -1
  193. package/resources/senders/index.js +3 -1
  194. package/resources/senders/index.js.map +1 -1
  195. package/resources/senders/index.mjs +1 -0
  196. package/resources/senders/index.mjs.map +1 -1
  197. package/resources/senders/senders.d.mts +17 -1
  198. package/resources/senders/senders.d.mts.map +1 -1
  199. package/resources/senders/senders.d.ts +17 -1
  200. package/resources/senders/senders.d.ts.map +1 -1
  201. package/resources/senders/senders.js +4 -0
  202. package/resources/senders/senders.js.map +1 -1
  203. package/resources/senders/senders.mjs +4 -0
  204. package/resources/senders/senders.mjs.map +1 -1
  205. package/resources/senders/whatsapp-sync.d.mts +134 -0
  206. package/resources/senders/whatsapp-sync.d.mts.map +1 -0
  207. package/resources/senders/whatsapp-sync.d.ts +134 -0
  208. package/resources/senders/whatsapp-sync.d.ts.map +1 -0
  209. package/resources/senders/whatsapp-sync.js +56 -0
  210. package/resources/senders/whatsapp-sync.js.map +1 -0
  211. package/resources/senders/whatsapp-sync.mjs +52 -0
  212. package/resources/senders/whatsapp-sync.mjs.map +1 -0
  213. package/resources/sub-accounts/api-keys.d.mts +85 -0
  214. package/resources/sub-accounts/api-keys.d.mts.map +1 -0
  215. package/resources/sub-accounts/api-keys.d.ts +85 -0
  216. package/resources/sub-accounts/api-keys.d.ts.map +1 -0
  217. package/resources/sub-accounts/api-keys.js +53 -0
  218. package/resources/sub-accounts/api-keys.js.map +1 -0
  219. package/resources/sub-accounts/api-keys.mjs +49 -0
  220. package/resources/sub-accounts/api-keys.mjs.map +1 -0
  221. package/resources/sub-accounts/index.d.mts +3 -0
  222. package/resources/sub-accounts/index.d.mts.map +1 -0
  223. package/resources/sub-accounts/index.d.ts +3 -0
  224. package/resources/sub-accounts/index.d.ts.map +1 -0
  225. package/resources/sub-accounts/index.js +9 -0
  226. package/resources/sub-accounts/index.js.map +1 -0
  227. package/resources/sub-accounts/index.mjs +4 -0
  228. package/resources/sub-accounts/index.mjs.map +1 -0
  229. package/resources/sub-accounts/sub-accounts.d.mts +168 -0
  230. package/resources/sub-accounts/sub-accounts.d.mts.map +1 -0
  231. package/resources/sub-accounts/sub-accounts.d.ts +168 -0
  232. package/resources/sub-accounts/sub-accounts.d.ts.map +1 -0
  233. package/resources/sub-accounts/sub-accounts.js +94 -0
  234. package/resources/sub-accounts/sub-accounts.js.map +1 -0
  235. package/resources/sub-accounts/sub-accounts.mjs +89 -0
  236. package/resources/sub-accounts/sub-accounts.mjs.map +1 -0
  237. package/resources/sub-accounts.d.mts +2 -0
  238. package/resources/sub-accounts.d.mts.map +1 -0
  239. package/resources/sub-accounts.d.ts +2 -0
  240. package/resources/sub-accounts.d.ts.map +1 -0
  241. package/resources/sub-accounts.js +6 -0
  242. package/resources/sub-accounts.js.map +1 -0
  243. package/resources/sub-accounts.mjs +3 -0
  244. package/resources/sub-accounts.mjs.map +1 -0
  245. package/resources/templates.d.mts +42 -2
  246. package/resources/templates.d.mts.map +1 -1
  247. package/resources/templates.d.ts +42 -2
  248. package/resources/templates.d.ts.map +1 -1
  249. package/resources/urls.d.mts +88 -0
  250. package/resources/urls.d.mts.map +1 -0
  251. package/resources/urls.d.ts +88 -0
  252. package/resources/urls.d.ts.map +1 -0
  253. package/resources/urls.js +55 -0
  254. package/resources/urls.js.map +1 -0
  255. package/resources/urls.mjs +51 -0
  256. package/resources/urls.mjs.map +1 -0
  257. package/resources/usage.d.mts +36 -0
  258. package/resources/usage.d.mts.map +1 -0
  259. package/resources/usage.d.ts +36 -0
  260. package/resources/usage.d.ts.map +1 -0
  261. package/resources/usage.js +16 -0
  262. package/resources/usage.js.map +1 -0
  263. package/resources/usage.mjs +12 -0
  264. package/resources/usage.mjs.map +1 -0
  265. package/src/client.ts +130 -6
  266. package/src/internal/utils/env.ts +2 -2
  267. package/src/resources/balance.ts +43 -0
  268. package/src/resources/broadcasts/broadcasts.ts +40 -0
  269. package/src/resources/broadcasts/index.ts +2 -0
  270. package/src/resources/contacts/channels.ts +177 -0
  271. package/src/resources/contacts/contacts.ts +360 -0
  272. package/src/resources/contacts/index.ts +22 -0
  273. package/src/resources/contacts.ts +1 -196
  274. package/src/resources/exports.ts +141 -0
  275. package/src/resources/index.ts +51 -1
  276. package/src/resources/invitations.ts +188 -0
  277. package/src/resources/messages.ts +43 -3
  278. package/src/resources/number-10dlc/brands.ts +377 -0
  279. package/src/resources/number-10dlc/campaigns/campaigns.ts +349 -0
  280. package/src/resources/number-10dlc/campaigns/index.ts +23 -0
  281. package/src/resources/number-10dlc/campaigns/phone-numbers.ts +123 -0
  282. package/src/resources/number-10dlc/campaigns.ts +3 -0
  283. package/src/resources/number-10dlc/index.ts +30 -0
  284. package/src/resources/number-10dlc/number-10dlc.ts +71 -0
  285. package/src/resources/number-10dlc.ts +3 -0
  286. package/src/resources/plan.ts +62 -0
  287. package/src/resources/senders/agent/agent.ts +6 -0
  288. package/src/resources/senders/agent/flows.ts +44 -126
  289. package/src/resources/senders/agent/index.ts +3 -0
  290. package/src/resources/senders/agent/tools.ts +13 -50
  291. package/src/resources/senders/index.ts +9 -0
  292. package/src/resources/senders/senders.ts +38 -1
  293. package/src/resources/senders/whatsapp-sync.ts +175 -0
  294. package/src/resources/sub-accounts/api-keys.ts +126 -0
  295. package/src/resources/sub-accounts/index.ts +22 -0
  296. package/src/resources/sub-accounts/sub-accounts.ts +246 -0
  297. package/src/resources/sub-accounts.ts +3 -0
  298. package/src/resources/templates.ts +51 -2
  299. package/src/resources/urls.ts +125 -0
  300. package/src/resources/usage.ts +48 -0
  301. package/src/version.ts +1 -1
  302. package/version.d.mts +1 -1
  303. package/version.d.ts +1 -1
  304. package/version.js +1 -1
  305. package/version.mjs +1 -1
@@ -1,198 +1,3 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../core/resource';
4
- import { APIPromise } from '../core/api-promise';
5
- import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
6
- import { RequestOptions } from '../internal/request-options';
7
- import { path } from '../internal/utils/path';
8
-
9
- export class Contacts extends APIResource {
10
- /**
11
- * Get contact
12
- */
13
- retrieve(contactID: string, options?: RequestOptions): APIPromise<Contact> {
14
- return this._client.get(path`/v1/contacts/${contactID}`, options);
15
- }
16
-
17
- /**
18
- * Update contact
19
- */
20
- update(contactID: string, body: ContactUpdateParams, options?: RequestOptions): APIPromise<Contact> {
21
- return this._client.patch(path`/v1/contacts/${contactID}`, { body, ...options });
22
- }
23
-
24
- /**
25
- * List contacts with their communication channels.
26
- */
27
- list(
28
- query: ContactListParams | null | undefined = {},
29
- options?: RequestOptions,
30
- ): PagePromise<ContactsCursor, Contact> {
31
- return this._client.getAPIList('/v1/contacts', Cursor<Contact>, { query, ...options });
32
- }
33
-
34
- /**
35
- * Get contact by phone number
36
- */
37
- retrieveByPhone(phoneNumber: string, options?: RequestOptions): APIPromise<Contact> {
38
- return this._client.get(path`/v1/contacts/phone/${phoneNumber}`, options);
39
- }
40
- }
41
-
42
- export type ContactsCursor = Cursor<Contact>;
43
-
44
- export interface Contact {
45
- id: string;
46
-
47
- /**
48
- * List of available messaging channels for this contact.
49
- */
50
- availableChannels: Array<string>;
51
-
52
- createdAt: string;
53
-
54
- metadata: { [key: string]: string };
55
-
56
- /**
57
- * Whether this contact has been verified.
58
- */
59
- verified: boolean;
60
-
61
- /**
62
- * All communication channels for this contact.
63
- */
64
- channels?: Array<Contact.Channel>;
65
-
66
- countryCode?: string;
67
-
68
- /**
69
- * Preferred channel for this contact.
70
- */
71
- defaultChannel?: 'sms' | 'whatsapp' | 'telegram' | 'email' | 'instagram' | 'voice';
72
-
73
- /**
74
- * Display name for the contact.
75
- */
76
- displayName?: string;
77
-
78
- /**
79
- * DEPRECATED: Use primaryPhone instead. Primary phone number in E.164 format.
80
- */
81
- phoneNumber?: string;
82
-
83
- /**
84
- * Primary email address.
85
- */
86
- primaryEmail?: string;
87
-
88
- /**
89
- * Primary phone number in E.164 format.
90
- */
91
- primaryPhone?: string;
92
-
93
- /**
94
- * Contact's WhatsApp profile name. Only available for WhatsApp contacts.
95
- */
96
- profileName?: string | null;
97
-
98
- /**
99
- * ID of a contact suggested for merging.
100
- */
101
- suggestedMergeWith?: string;
102
-
103
- updatedAt?: string;
104
- }
105
-
106
- export namespace Contact {
107
- /**
108
- * A communication channel for a contact.
109
- */
110
- export interface Channel {
111
- id: string;
112
-
113
- /**
114
- * Channel type.
115
- */
116
- channel: 'sms' | 'whatsapp' | 'email' | 'telegram' | 'voice';
117
-
118
- createdAt: string;
119
-
120
- /**
121
- * Channel identifier (phone number or email address).
122
- */
123
- identifier: string;
124
-
125
- /**
126
- * Whether this is the primary channel for its type.
127
- */
128
- isPrimary: boolean;
129
-
130
- /**
131
- * Whether this channel has been verified.
132
- */
133
- verified: boolean;
134
-
135
- /**
136
- * ISO country code for phone numbers.
137
- */
138
- countryCode?: string;
139
-
140
- /**
141
- * Optional label for the channel.
142
- */
143
- label?: string;
144
-
145
- /**
146
- * Last time a message was received on this channel.
147
- */
148
- lastInboundAt?: string;
149
-
150
- metadata?: { [key: string]: string };
151
-
152
- /**
153
- * Delivery metrics for this channel.
154
- */
155
- metrics?: Channel.Metrics;
156
-
157
- updatedAt?: string;
158
- }
159
-
160
- export namespace Channel {
161
- /**
162
- * Delivery metrics for this channel.
163
- */
164
- export interface Metrics {
165
- avgDeliveryTimeMs?: number;
166
-
167
- failureCount?: number;
168
-
169
- lastSuccessAt?: string;
170
-
171
- successCount?: number;
172
-
173
- totalAttempts?: number;
174
- }
175
- }
176
- }
177
-
178
- export interface ContactUpdateParams {
179
- /**
180
- * Preferred channel for this contact. Set to null to clear.
181
- */
182
- defaultChannel?: 'sms' | 'whatsapp' | 'telegram' | 'email' | 'instagram' | 'voice' | null;
183
-
184
- metadata?: { [key: string]: string };
185
- }
186
-
187
- export interface ContactListParams extends CursorParams {
188
- phoneNumber?: string;
189
- }
190
-
191
- export declare namespace Contacts {
192
- export {
193
- type Contact as Contact,
194
- type ContactsCursor as ContactsCursor,
195
- type ContactUpdateParams as ContactUpdateParams,
196
- type ContactListParams as ContactListParams,
197
- };
198
- }
3
+ export * from './contacts/index';
@@ -0,0 +1,141 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
6
+ import { RequestOptions } from '../internal/request-options';
7
+ import { path } from '../internal/utils/path';
8
+
9
+ export class Exports extends APIResource {
10
+ /**
11
+ * Create a new data export job. The export will be processed asynchronously and
12
+ * the download URL will be available when status is 'completed'. Export links
13
+ * expire after 24 hours.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const _export = await client.exports.create({
18
+ * dataTypes: ['messages', 'conversations'],
19
+ * dateFrom: '2024-01-01T00:00:00Z',
20
+ * dateTo: '2024-12-31T23:59:59Z',
21
+ * });
22
+ * ```
23
+ */
24
+ create(body: ExportCreateParams, options?: RequestOptions): APIPromise<ExportCreateResponse> {
25
+ return this._client.post('/v1/exports', { body, ...options });
26
+ }
27
+
28
+ /**
29
+ * Get details of a specific data export, including download URL when completed.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const _export = await client.exports.retrieve('exportId');
34
+ * ```
35
+ */
36
+ retrieve(exportID: string, options?: RequestOptions): APIPromise<ExportRetrieveResponse> {
37
+ return this._client.get(path`/v1/exports/${exportID}`, options);
38
+ }
39
+
40
+ /**
41
+ * List data exports for this project.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * // Automatically fetches more pages as needed.
46
+ * for await (const dataExport of client.exports.list()) {
47
+ * // ...
48
+ * }
49
+ * ```
50
+ */
51
+ list(
52
+ query: ExportListParams | null | undefined = {},
53
+ options?: RequestOptions,
54
+ ): PagePromise<DataExportsCursor, DataExport> {
55
+ return this._client.getAPIList('/v1/exports', Cursor<DataExport>, { query, ...options });
56
+ }
57
+ }
58
+
59
+ export type DataExportsCursor = Cursor<DataExport>;
60
+
61
+ export interface DataExport {
62
+ id: string;
63
+
64
+ createdAt: string;
65
+
66
+ dataTypes: Array<'messages' | 'conversations' | 'webhookDeliveries' | 'agentExecutions' | 'activities'>;
67
+
68
+ /**
69
+ * When the export download link expires (24 hours after creation).
70
+ */
71
+ expiresAt: string;
72
+
73
+ /**
74
+ * Status of a data export job.
75
+ */
76
+ status: 'pending' | 'processing' | 'completed' | 'failed';
77
+
78
+ completedAt?: string | null;
79
+
80
+ dateFrom?: string | null;
81
+
82
+ dateTo?: string | null;
83
+
84
+ /**
85
+ * URL to download the export file. Only available when status is 'completed'.
86
+ */
87
+ downloadUrl?: string | null;
88
+
89
+ /**
90
+ * Error message if the export failed.
91
+ */
92
+ errorMessage?: string | null;
93
+
94
+ /**
95
+ * Size of the export file in bytes.
96
+ */
97
+ fileSize?: number | null;
98
+ }
99
+
100
+ export interface ExportCreateResponse {
101
+ export: DataExport;
102
+ }
103
+
104
+ export interface ExportRetrieveResponse {
105
+ export: DataExport;
106
+ }
107
+
108
+ export interface ExportCreateParams {
109
+ /**
110
+ * List of data types to include in the export.
111
+ */
112
+ dataTypes: Array<'messages' | 'conversations' | 'webhookDeliveries' | 'agentExecutions' | 'activities'>;
113
+
114
+ /**
115
+ * Start date for data to export (inclusive).
116
+ */
117
+ dateFrom?: string;
118
+
119
+ /**
120
+ * End date for data to export (inclusive).
121
+ */
122
+ dateTo?: string;
123
+ }
124
+
125
+ export interface ExportListParams extends CursorParams {
126
+ /**
127
+ * Status of a data export job.
128
+ */
129
+ status?: 'pending' | 'processing' | 'completed' | 'failed';
130
+ }
131
+
132
+ export declare namespace Exports {
133
+ export {
134
+ type DataExport as DataExport,
135
+ type ExportCreateResponse as ExportCreateResponse,
136
+ type ExportRetrieveResponse as ExportRetrieveResponse,
137
+ type DataExportsCursor as DataExportsCursor,
138
+ type ExportCreateParams as ExportCreateParams,
139
+ type ExportListParams as ExportListParams,
140
+ };
141
+ }
@@ -10,6 +10,7 @@ export {
10
10
  type AddressListParams,
11
11
  type AddressesCursor,
12
12
  } from './addresses';
13
+ export { Balance, type BalanceRetrieveResponse } from './balance';
13
14
  export {
14
15
  Broadcasts,
15
16
  type Broadcast,
@@ -24,7 +25,9 @@ export {
24
25
  type BroadcastRetrieveResponse,
25
26
  type BroadcastUpdateResponse,
26
27
  type BroadcastCancelResponse,
28
+ type BroadcastEscalateReviewResponse,
27
29
  type BroadcastRescheduleResponse,
30
+ type BroadcastRetryReviewResponse,
28
31
  type BroadcastSendResponse,
29
32
  type BroadcastCreateParams,
30
33
  type BroadcastUpdateParams,
@@ -37,16 +40,38 @@ export {
37
40
  export {
38
41
  Contacts,
39
42
  type Contact,
43
+ type ContactChannel,
44
+ type ContactCreateParams,
40
45
  type ContactUpdateParams,
41
46
  type ContactListParams,
47
+ type ContactMergeParams,
42
48
  type ContactsCursor,
43
- } from './contacts';
49
+ } from './contacts/contacts';
50
+ export {
51
+ Exports,
52
+ type DataExport,
53
+ type ExportCreateResponse,
54
+ type ExportRetrieveResponse,
55
+ type ExportCreateParams,
56
+ type ExportListParams,
57
+ type DataExportsCursor,
58
+ } from './exports';
44
59
  export {
45
60
  Introspect,
46
61
  type LineType,
47
62
  type IntrospectValidatePhoneResponse,
48
63
  type IntrospectValidatePhoneParams,
49
64
  } from './introspect';
65
+ export {
66
+ Invitations,
67
+ type Invitation,
68
+ type InvitationCreateResponse,
69
+ type InvitationRetrieveResponse,
70
+ type InvitationCancelResponse,
71
+ type InvitationCreateParams,
72
+ type InvitationListParams,
73
+ type InvitationsCursor,
74
+ } from './invitations';
50
75
  export {
51
76
  Messages,
52
77
  type Channel,
@@ -60,6 +85,7 @@ export {
60
85
  type MessageSendParams,
61
86
  type MessagesCursor,
62
87
  } from './messages';
88
+ export { Number10dlc } from './number-10dlc/number-10dlc';
63
89
  export {
64
90
  PhoneNumbers,
65
91
  type AvailablePhoneNumber,
@@ -85,6 +111,7 @@ export {
85
111
  type PhoneNumberSearchAvailableParams,
86
112
  type OwnedPhoneNumbersCursor,
87
113
  } from './phone-numbers';
114
+ export { Plan, type PlanRetrieveResponse } from './plan';
88
115
  export {
89
116
  RegulatoryDocuments,
90
117
  type RegulatoryDocument,
@@ -113,6 +140,19 @@ export {
113
140
  type SenderUploadProfilePictureParams,
114
141
  type SendersCursor,
115
142
  } from './senders/senders';
143
+ export {
144
+ SubAccounts,
145
+ type SubAccount,
146
+ type SubAccountCreateResponse,
147
+ type SubAccountRetrieveResponse,
148
+ type SubAccountUpdateResponse,
149
+ type SubAccountDeactivateResponse,
150
+ type SubAccountGetBalanceResponse,
151
+ type SubAccountCreateParams,
152
+ type SubAccountUpdateParams,
153
+ type SubAccountListParams,
154
+ type SubAccountsCursor,
155
+ } from './sub-accounts/sub-accounts';
116
156
  export {
117
157
  Templates,
118
158
  type Template,
@@ -122,3 +162,13 @@ export {
122
162
  type TemplateSubmitParams,
123
163
  type TemplatesCursor,
124
164
  } from './templates';
165
+ export {
166
+ URLs,
167
+ type VerifiedURL,
168
+ type URLRetrieveDetailsResponse,
169
+ type URLSubmitForVerificationResponse,
170
+ type URLListVerifiedParams,
171
+ type URLSubmitForVerificationParams,
172
+ type VerifiedURLsCursor,
173
+ } from './urls';
174
+ export { Usage, type UsageRetrieveResponse } from './usage';
@@ -0,0 +1,188 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
6
+ import { RequestOptions } from '../internal/request-options';
7
+ import { path } from '../internal/utils/path';
8
+
9
+ export class Invitations extends APIResource {
10
+ /**
11
+ * Create a partner invitation link for a client to connect their WhatsApp Business
12
+ * account. The client will complete Meta's embedded signup flow and the resulting
13
+ * sender will be created in your project.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const invitation = await client.invitations.create({
18
+ * clientName: 'Acme Corp',
19
+ * });
20
+ * ```
21
+ */
22
+ create(
23
+ body: InvitationCreateParams | null | undefined = {},
24
+ options?: RequestOptions,
25
+ ): APIPromise<InvitationCreateResponse> {
26
+ return this._client.post('/v1/invitations', { body, ...options });
27
+ }
28
+
29
+ /**
30
+ * Get invitation
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const invitation = await client.invitations.retrieve(
35
+ * 'invitationId',
36
+ * );
37
+ * ```
38
+ */
39
+ retrieve(invitationID: string, options?: RequestOptions): APIPromise<InvitationRetrieveResponse> {
40
+ return this._client.get(path`/v1/invitations/${invitationID}`, options);
41
+ }
42
+
43
+ /**
44
+ * List partner invitations for this project.
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * // Automatically fetches more pages as needed.
49
+ * for await (const invitation of client.invitations.list()) {
50
+ * // ...
51
+ * }
52
+ * ```
53
+ */
54
+ list(
55
+ query: InvitationListParams | null | undefined = {},
56
+ options?: RequestOptions,
57
+ ): PagePromise<InvitationsCursor, Invitation> {
58
+ return this._client.getAPIList('/v1/invitations', Cursor<Invitation>, { query, ...options });
59
+ }
60
+
61
+ /**
62
+ * Cancel an active invitation. The client will no longer be able to use the
63
+ * invitation link.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * const response = await client.invitations.cancel(
68
+ * 'invitationId',
69
+ * );
70
+ * ```
71
+ */
72
+ cancel(invitationID: string, options?: RequestOptions): APIPromise<InvitationCancelResponse> {
73
+ return this._client.post(path`/v1/invitations/${invitationID}/cancel`, options);
74
+ }
75
+ }
76
+
77
+ export type InvitationsCursor = Cursor<Invitation>;
78
+
79
+ export interface Invitation {
80
+ id: string;
81
+
82
+ /**
83
+ * Unique invitation token.
84
+ */
85
+ token: string;
86
+
87
+ createdAt: string;
88
+
89
+ expiresAt: string;
90
+
91
+ /**
92
+ * Current status of the partner invitation.
93
+ */
94
+ status: 'pending' | 'in_progress' | 'completed' | 'expired' | 'cancelled';
95
+
96
+ updatedAt: string;
97
+
98
+ /**
99
+ * Full URL to share with the client.
100
+ */
101
+ url: string;
102
+
103
+ clientEmail?: string | null;
104
+
105
+ clientName?: string | null;
106
+
107
+ clientPhone?: string | null;
108
+
109
+ completedAt?: string | null;
110
+
111
+ /**
112
+ * ID of a pre-assigned Zavu phone number for WhatsApp registration.
113
+ */
114
+ phoneNumberId?: string | null;
115
+
116
+ /**
117
+ * ID of the sender created when invitation is completed.
118
+ */
119
+ senderId?: string | null;
120
+
121
+ startedAt?: string | null;
122
+
123
+ viewedAt?: string | null;
124
+ }
125
+
126
+ export interface InvitationCreateResponse {
127
+ invitation: Invitation;
128
+ }
129
+
130
+ export interface InvitationRetrieveResponse {
131
+ invitation: Invitation;
132
+ }
133
+
134
+ export interface InvitationCancelResponse {
135
+ invitation: Invitation;
136
+ }
137
+
138
+ export interface InvitationCreateParams {
139
+ /**
140
+ * ISO country codes for allowed phone numbers.
141
+ */
142
+ allowedPhoneCountries?: Array<string>;
143
+
144
+ /**
145
+ * Email of the client being invited.
146
+ */
147
+ clientEmail?: string;
148
+
149
+ /**
150
+ * Name of the client being invited.
151
+ */
152
+ clientName?: string;
153
+
154
+ /**
155
+ * Phone number of the client in E.164 format.
156
+ */
157
+ clientPhone?: string;
158
+
159
+ /**
160
+ * Number of days until the invitation expires.
161
+ */
162
+ expiresInDays?: number;
163
+
164
+ /**
165
+ * ID of a Zavu phone number to pre-assign for WhatsApp registration. If provided,
166
+ * the client will use this number instead of their own.
167
+ */
168
+ phoneNumberId?: string;
169
+ }
170
+
171
+ export interface InvitationListParams extends CursorParams {
172
+ /**
173
+ * Current status of the partner invitation.
174
+ */
175
+ status?: 'pending' | 'in_progress' | 'completed' | 'expired' | 'cancelled';
176
+ }
177
+
178
+ export declare namespace Invitations {
179
+ export {
180
+ type Invitation as Invitation,
181
+ type InvitationCreateResponse as InvitationCreateResponse,
182
+ type InvitationRetrieveResponse as InvitationRetrieveResponse,
183
+ type InvitationCancelResponse as InvitationCancelResponse,
184
+ type InvitationsCursor as InvitationsCursor,
185
+ type InvitationCreateParams as InvitationCreateParams,
186
+ type InvitationListParams as InvitationListParams,
187
+ };
188
+ }
@@ -310,6 +310,7 @@ export type MessageStatus =
310
310
  | 'sending'
311
311
  | 'sent'
312
312
  | 'delivered'
313
+ | 'read'
313
314
  | 'failed'
314
315
  | 'received'
315
316
  | 'pending_url_verification';
@@ -364,9 +365,15 @@ export interface MessageSendParams {
364
365
  to: string;
365
366
 
366
367
  /**
367
- * Body param: Delivery channel. Use 'auto' for intelligent routing. If omitted
368
- * with non-text messageType, WhatsApp is used. For email recipients, defaults to
369
- * 'email'.
368
+ * Body param: Email attachments. Only supported when channel is 'email'. Maximum
369
+ * 40MB total size.
370
+ */
371
+ attachments?: Array<MessageSendParams.Attachment>;
372
+
373
+ /**
374
+ * Body param: Delivery channel. Use 'auto' for intelligent routing. If omitted,
375
+ * channel is auto-selected based on sender capabilities and recipient type. For
376
+ * email recipients, defaults to 'email'.
370
377
  */
371
378
  channel?: Channel;
372
379
 
@@ -431,6 +438,39 @@ export interface MessageSendParams {
431
438
  'Zavu-Sender'?: string;
432
439
  }
433
440
 
441
+ export namespace MessageSendParams {
442
+ /**
443
+ * Email attachment. Provide either `content` (base64) or `path` (URL), not both.
444
+ */
445
+ export interface Attachment {
446
+ /**
447
+ * Name of the attached file.
448
+ */
449
+ filename: string;
450
+
451
+ /**
452
+ * Content of the attached file as a Base64-encoded string.
453
+ */
454
+ content?: string;
455
+
456
+ /**
457
+ * Content ID for inline images. Reference in HTML as
458
+ * `<img src="cid:your_content_id">`.
459
+ */
460
+ content_id?: string;
461
+
462
+ /**
463
+ * MIME type of the attachment. If not set, will be derived from the filename.
464
+ */
465
+ content_type?: string;
466
+
467
+ /**
468
+ * URL where the attachment file is hosted. The server will fetch the file.
469
+ */
470
+ path?: string;
471
+ }
472
+ }
473
+
434
474
  export declare namespace Messages {
435
475
  export {
436
476
  type Channel as Channel,