telnyx 7.21.0 → 7.22.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 (259) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/client.d.mts +7 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +7 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/ai/ai.d.mts +2 -2
  12. package/resources/ai/ai.d.mts.map +1 -1
  13. package/resources/ai/ai.d.ts +2 -2
  14. package/resources/ai/ai.d.ts.map +1 -1
  15. package/resources/ai/ai.js.map +1 -1
  16. package/resources/ai/ai.mjs.map +1 -1
  17. package/resources/ai/assistants/assistants.d.mts +152 -1
  18. package/resources/ai/assistants/assistants.d.mts.map +1 -1
  19. package/resources/ai/assistants/assistants.d.ts +152 -1
  20. package/resources/ai/assistants/assistants.d.ts.map +1 -1
  21. package/resources/ai/assistants/assistants.js.map +1 -1
  22. package/resources/ai/assistants/assistants.mjs.map +1 -1
  23. package/resources/ai/assistants/index.d.mts +1 -1
  24. package/resources/ai/assistants/index.d.mts.map +1 -1
  25. package/resources/ai/assistants/index.d.ts +1 -1
  26. package/resources/ai/assistants/index.d.ts.map +1 -1
  27. package/resources/ai/assistants/index.js.map +1 -1
  28. package/resources/ai/assistants/index.mjs.map +1 -1
  29. package/resources/ai/assistants/versions.d.mts +25 -0
  30. package/resources/ai/assistants/versions.d.mts.map +1 -1
  31. package/resources/ai/assistants/versions.d.ts +25 -0
  32. package/resources/ai/assistants/versions.d.ts.map +1 -1
  33. package/resources/ai/chat.d.mts +61 -22
  34. package/resources/ai/chat.d.mts.map +1 -1
  35. package/resources/ai/chat.d.ts +61 -22
  36. package/resources/ai/chat.d.ts.map +1 -1
  37. package/resources/ai/index.d.mts +1 -1
  38. package/resources/ai/index.d.mts.map +1 -1
  39. package/resources/ai/index.d.ts +1 -1
  40. package/resources/ai/index.d.ts.map +1 -1
  41. package/resources/ai/index.js.map +1 -1
  42. package/resources/ai/index.mjs.map +1 -1
  43. package/resources/ai/openai/chat.d.mts +61 -22
  44. package/resources/ai/openai/chat.d.mts.map +1 -1
  45. package/resources/ai/openai/chat.d.ts +61 -22
  46. package/resources/ai/openai/chat.d.ts.map +1 -1
  47. package/resources/compute/compute.d.mts +10 -0
  48. package/resources/compute/compute.d.mts.map +1 -0
  49. package/resources/compute/compute.d.ts +10 -0
  50. package/resources/compute/compute.d.ts.map +1 -0
  51. package/resources/compute/compute.js +17 -0
  52. package/resources/compute/compute.js.map +1 -0
  53. package/resources/compute/compute.mjs +12 -0
  54. package/resources/compute/compute.mjs.map +1 -0
  55. package/resources/compute/funcs.d.mts +179 -0
  56. package/resources/compute/funcs.d.mts.map +1 -0
  57. package/resources/compute/funcs.d.ts +179 -0
  58. package/resources/compute/funcs.d.ts.map +1 -0
  59. package/resources/compute/funcs.js +41 -0
  60. package/resources/compute/funcs.js.map +1 -0
  61. package/resources/compute/funcs.mjs +37 -0
  62. package/resources/compute/funcs.mjs.map +1 -0
  63. package/resources/compute/index.d.mts +3 -0
  64. package/resources/compute/index.d.mts.map +1 -0
  65. package/resources/compute/index.d.ts +3 -0
  66. package/resources/compute/index.d.ts.map +1 -0
  67. package/resources/compute/index.js +9 -0
  68. package/resources/compute/index.js.map +1 -0
  69. package/resources/compute/index.mjs +4 -0
  70. package/resources/compute/index.mjs.map +1 -0
  71. package/resources/compute.d.mts +2 -0
  72. package/resources/compute.d.mts.map +1 -0
  73. package/resources/compute.d.ts +2 -0
  74. package/resources/compute.d.ts.map +1 -0
  75. package/resources/compute.js +6 -0
  76. package/resources/compute.js.map +1 -0
  77. package/resources/compute.mjs +3 -0
  78. package/resources/compute.mjs.map +1 -0
  79. package/resources/credential-connections/credential-connections.d.mts +4 -1
  80. package/resources/credential-connections/credential-connections.d.mts.map +1 -1
  81. package/resources/credential-connections/credential-connections.d.ts +4 -1
  82. package/resources/credential-connections/credential-connections.d.ts.map +1 -1
  83. package/resources/credential-connections/credential-connections.js.map +1 -1
  84. package/resources/credential-connections/credential-connections.mjs.map +1 -1
  85. package/resources/email-inboxes/drafts.d.mts +7 -0
  86. package/resources/email-inboxes/drafts.d.mts.map +1 -1
  87. package/resources/email-inboxes/drafts.d.ts +7 -0
  88. package/resources/email-inboxes/drafts.d.ts.map +1 -1
  89. package/resources/email-messages/email-messages.d.mts +7 -3
  90. package/resources/email-messages/email-messages.d.mts.map +1 -1
  91. package/resources/email-messages/email-messages.d.ts +7 -3
  92. package/resources/email-messages/email-messages.d.ts.map +1 -1
  93. package/resources/email-messages/email-messages.js +3 -1
  94. package/resources/email-messages/email-messages.js.map +1 -1
  95. package/resources/email-messages/email-messages.mjs +3 -1
  96. package/resources/email-messages/email-messages.mjs.map +1 -1
  97. package/resources/fqdn-connections/fqdn-authentication.d.mts +4 -1
  98. package/resources/fqdn-connections/fqdn-authentication.d.mts.map +1 -1
  99. package/resources/fqdn-connections/fqdn-authentication.d.ts +4 -1
  100. package/resources/fqdn-connections/fqdn-authentication.d.ts.map +1 -1
  101. package/resources/fqdn-connections/fqdn-connections.d.mts +4 -1
  102. package/resources/fqdn-connections/fqdn-connections.d.mts.map +1 -1
  103. package/resources/fqdn-connections/fqdn-connections.d.ts +4 -1
  104. package/resources/fqdn-connections/fqdn-connections.d.ts.map +1 -1
  105. package/resources/fqdn-connections/fqdn-connections.js.map +1 -1
  106. package/resources/fqdn-connections/fqdn-connections.mjs.map +1 -1
  107. package/resources/index.d.mts +3 -2
  108. package/resources/index.d.mts.map +1 -1
  109. package/resources/index.d.ts +3 -2
  110. package/resources/index.d.ts.map +1 -1
  111. package/resources/index.js +6 -4
  112. package/resources/index.js.map +1 -1
  113. package/resources/index.mjs +1 -0
  114. package/resources/index.mjs.map +1 -1
  115. package/resources/messages/messages.d.mts +79 -6
  116. package/resources/messages/messages.d.mts.map +1 -1
  117. package/resources/messages/messages.d.ts +79 -6
  118. package/resources/messages/messages.d.ts.map +1 -1
  119. package/resources/messages/messages.js.map +1 -1
  120. package/resources/messages/messages.mjs.map +1 -1
  121. package/resources/messaging-profiles/index.d.mts +1 -1
  122. package/resources/messaging-profiles/index.d.mts.map +1 -1
  123. package/resources/messaging-profiles/index.d.ts +1 -1
  124. package/resources/messaging-profiles/index.d.ts.map +1 -1
  125. package/resources/messaging-profiles/index.js.map +1 -1
  126. package/resources/messaging-profiles/index.mjs.map +1 -1
  127. package/resources/messaging-profiles/messaging-profiles.d.mts +34 -1
  128. package/resources/messaging-profiles/messaging-profiles.d.mts.map +1 -1
  129. package/resources/messaging-profiles/messaging-profiles.d.ts +34 -1
  130. package/resources/messaging-profiles/messaging-profiles.d.ts.map +1 -1
  131. package/resources/messaging-profiles/messaging-profiles.js.map +1 -1
  132. package/resources/messaging-profiles/messaging-profiles.mjs.map +1 -1
  133. package/resources/uac-connections/uac-connections.d.mts +9 -2
  134. package/resources/uac-connections/uac-connections.d.mts.map +1 -1
  135. package/resources/uac-connections/uac-connections.d.ts +9 -2
  136. package/resources/uac-connections/uac-connections.d.ts.map +1 -1
  137. package/resources/uac-connections/uac-connections.js.map +1 -1
  138. package/resources/uac-connections/uac-connections.mjs.map +1 -1
  139. package/resources/webhooks.d.mts +129 -3
  140. package/resources/webhooks.d.mts.map +1 -1
  141. package/resources/webhooks.d.ts +129 -3
  142. package/resources/webhooks.d.ts.map +1 -1
  143. package/resources/whatsapp/business-accounts/phone-numbers.d.mts +33 -0
  144. package/resources/whatsapp/business-accounts/phone-numbers.d.mts.map +1 -1
  145. package/resources/whatsapp/business-accounts/phone-numbers.d.ts +33 -0
  146. package/resources/whatsapp/business-accounts/phone-numbers.d.ts.map +1 -1
  147. package/resources/whatsapp/index.d.mts +1 -1
  148. package/resources/whatsapp/index.d.mts.map +1 -1
  149. package/resources/whatsapp/index.d.ts +1 -1
  150. package/resources/whatsapp/index.d.ts.map +1 -1
  151. package/resources/whatsapp/index.js.map +1 -1
  152. package/resources/whatsapp/index.mjs.map +1 -1
  153. package/resources/whatsapp/phone-numbers/index.d.mts +1 -1
  154. package/resources/whatsapp/phone-numbers/index.d.mts.map +1 -1
  155. package/resources/whatsapp/phone-numbers/index.d.ts +1 -1
  156. package/resources/whatsapp/phone-numbers/index.d.ts.map +1 -1
  157. package/resources/whatsapp/phone-numbers/index.js.map +1 -1
  158. package/resources/whatsapp/phone-numbers/index.mjs.map +1 -1
  159. package/resources/whatsapp/phone-numbers/phone-numbers.d.mts +147 -1
  160. package/resources/whatsapp/phone-numbers/phone-numbers.d.mts.map +1 -1
  161. package/resources/whatsapp/phone-numbers/phone-numbers.d.ts +147 -1
  162. package/resources/whatsapp/phone-numbers/phone-numbers.d.ts.map +1 -1
  163. package/resources/whatsapp/phone-numbers/phone-numbers.js +16 -0
  164. package/resources/whatsapp/phone-numbers/phone-numbers.js.map +1 -1
  165. package/resources/whatsapp/phone-numbers/phone-numbers.mjs +16 -0
  166. package/resources/whatsapp/phone-numbers/phone-numbers.mjs.map +1 -1
  167. package/resources/whatsapp/whatsapp.d.mts +2 -2
  168. package/resources/whatsapp/whatsapp.d.mts.map +1 -1
  169. package/resources/whatsapp/whatsapp.d.ts +2 -2
  170. package/resources/whatsapp/whatsapp.d.ts.map +1 -1
  171. package/resources/whatsapp/whatsapp.js.map +1 -1
  172. package/resources/whatsapp/whatsapp.mjs.map +1 -1
  173. package/resources/x402/credit-account/credit-account.d.mts +226 -0
  174. package/resources/x402/credit-account/credit-account.d.mts.map +1 -0
  175. package/resources/x402/credit-account/credit-account.d.ts +226 -0
  176. package/resources/x402/credit-account/credit-account.d.ts.map +1 -0
  177. package/resources/x402/credit-account/credit-account.js +66 -0
  178. package/resources/x402/credit-account/credit-account.js.map +1 -0
  179. package/resources/x402/credit-account/credit-account.mjs +61 -0
  180. package/resources/x402/credit-account/credit-account.mjs.map +1 -0
  181. package/resources/x402/credit-account/index.d.mts +3 -0
  182. package/resources/x402/credit-account/index.d.mts.map +1 -0
  183. package/resources/x402/credit-account/index.d.ts +3 -0
  184. package/resources/x402/credit-account/index.d.ts.map +1 -0
  185. package/resources/x402/credit-account/index.js +9 -0
  186. package/resources/x402/credit-account/index.js.map +1 -0
  187. package/resources/x402/credit-account/index.mjs +4 -0
  188. package/resources/x402/credit-account/index.mjs.map +1 -0
  189. package/resources/x402/credit-account/payments.d.mts +90 -0
  190. package/resources/x402/credit-account/payments.d.mts.map +1 -0
  191. package/resources/x402/credit-account/payments.d.ts +90 -0
  192. package/resources/x402/credit-account/payments.d.ts.map +1 -0
  193. package/resources/x402/credit-account/payments.js +47 -0
  194. package/resources/x402/credit-account/payments.js.map +1 -0
  195. package/resources/x402/credit-account/payments.mjs +43 -0
  196. package/resources/x402/credit-account/payments.mjs.map +1 -0
  197. package/resources/x402/credit-account.d.mts +1 -221
  198. package/resources/x402/credit-account.d.mts.map +1 -1
  199. package/resources/x402/credit-account.d.ts +1 -221
  200. package/resources/x402/credit-account.d.ts.map +1 -1
  201. package/resources/x402/credit-account.js +2 -54
  202. package/resources/x402/credit-account.js.map +1 -1
  203. package/resources/x402/credit-account.mjs +1 -52
  204. package/resources/x402/credit-account.mjs.map +1 -1
  205. package/resources/x402/index.d.mts +1 -1
  206. package/resources/x402/index.d.mts.map +1 -1
  207. package/resources/x402/index.d.ts +1 -1
  208. package/resources/x402/index.d.ts.map +1 -1
  209. package/resources/x402/index.js +2 -2
  210. package/resources/x402/index.js.map +1 -1
  211. package/resources/x402/index.mjs +1 -1
  212. package/resources/x402/index.mjs.map +1 -1
  213. package/resources/x402/x402.d.mts +2 -2
  214. package/resources/x402/x402.d.mts.map +1 -1
  215. package/resources/x402/x402.d.ts +2 -2
  216. package/resources/x402/x402.d.ts.map +1 -1
  217. package/resources/x402/x402.js +2 -2
  218. package/resources/x402/x402.js.map +1 -1
  219. package/resources/x402/x402.mjs +2 -2
  220. package/resources/x402/x402.mjs.map +1 -1
  221. package/src/client.ts +11 -0
  222. package/src/resources/ai/ai.ts +2 -0
  223. package/src/resources/ai/assistants/assistants.ts +173 -0
  224. package/src/resources/ai/assistants/index.ts +1 -0
  225. package/src/resources/ai/assistants/versions.ts +27 -0
  226. package/src/resources/ai/chat.ts +69 -23
  227. package/src/resources/ai/index.ts +1 -0
  228. package/src/resources/ai/openai/chat.ts +69 -23
  229. package/src/resources/compute/compute.ts +37 -0
  230. package/src/resources/compute/funcs.ts +298 -0
  231. package/src/resources/compute/index.ts +15 -0
  232. package/src/resources/compute.ts +3 -0
  233. package/src/resources/credential-connections/credential-connections.ts +4 -1
  234. package/src/resources/email-inboxes/drafts.ts +8 -0
  235. package/src/resources/email-messages/email-messages.ts +7 -2
  236. package/src/resources/fqdn-connections/fqdn-authentication.ts +4 -1
  237. package/src/resources/fqdn-connections/fqdn-connections.ts +4 -1
  238. package/src/resources/index.ts +4 -0
  239. package/src/resources/messages/messages.ts +89 -6
  240. package/src/resources/messaging-profiles/index.ts +1 -0
  241. package/src/resources/messaging-profiles/messaging-profiles.ts +39 -0
  242. package/src/resources/uac-connections/uac-connections.ts +9 -2
  243. package/src/resources/webhooks.ts +177 -2
  244. package/src/resources/whatsapp/business-accounts/phone-numbers.ts +52 -0
  245. package/src/resources/whatsapp/index.ts +1 -0
  246. package/src/resources/whatsapp/phone-numbers/index.ts +1 -0
  247. package/src/resources/whatsapp/phone-numbers/phone-numbers.ts +222 -0
  248. package/src/resources/whatsapp/whatsapp.ts +2 -0
  249. package/src/resources/x402/credit-account/credit-account.ts +312 -0
  250. package/src/resources/x402/credit-account/index.ts +16 -0
  251. package/src/resources/x402/credit-account/payments.ts +126 -0
  252. package/src/resources/x402/credit-account.ts +1 -290
  253. package/src/resources/x402/index.ts +1 -1
  254. package/src/resources/x402/x402.ts +2 -2
  255. package/src/version.ts +1 -1
  256. package/version.d.mts +1 -1
  257. package/version.d.ts +1 -1
  258. package/version.js +1 -1
  259. package/version.mjs +1 -1
@@ -163,6 +163,26 @@ export class PhoneNumbers extends APIResource {
163
163
  ): APIPromise<PhoneNumberGetResponse> {
164
164
  return this._client.get('/whatsapp/phone_numbers', { query, ...options });
165
165
  }
166
+
167
+ /**
168
+ * Returns one WhatsApp phone number linked to the authenticated Telnyx account.
169
+ * For a coexistence number in the `syncing` state, the response includes
170
+ * `sync_progress`.
171
+ *
172
+ * @example
173
+ * ```ts
174
+ * const response =
175
+ * await client.whatsapp.phoneNumbers.retrievePhoneNumber(
176
+ * 'phone_number',
177
+ * );
178
+ * ```
179
+ */
180
+ retrievePhoneNumber(
181
+ phoneNumber: string,
182
+ options?: RequestOptions,
183
+ ): APIPromise<PhoneNumberRetrievePhoneNumberResponse> {
184
+ return this._client.get(path`/whatsapp/phone_numbers/${phoneNumber}`, options);
185
+ }
166
186
  }
167
187
 
168
188
  export type PhoneNumberListResponsesDefaultFlatPagination = DefaultFlatPagination<PhoneNumberListResponse>;
@@ -170,12 +190,34 @@ export type PhoneNumberListResponsesDefaultFlatPagination = DefaultFlatPaginatio
170
190
  export interface PhoneNumberListResponse {
171
191
  calling_enabled?: boolean;
172
192
 
193
+ /**
194
+ * Current lifecycle state for a coexistence number. This is null for a standard
195
+ * Cloud API number.
196
+ */
197
+ coexistence_state?:
198
+ | 'pending_onboarding'
199
+ | 'sync_pending'
200
+ | 'syncing'
201
+ | 'sync_complete'
202
+ | 'active'
203
+ | 'history_declined'
204
+ | 'sync_deadline_expired'
205
+ | 'offboarded'
206
+ | 'disconnected'
207
+ | null;
208
+
173
209
  created_at?: string;
174
210
 
175
211
  display_name?: string;
176
212
 
177
213
  enabled?: boolean;
178
214
 
215
+ /**
216
+ * Indicates whether the number is connected to both the WhatsApp Business app and
217
+ * Cloud API through WhatsApp Coexistence.
218
+ */
219
+ is_on_biz_app?: boolean;
220
+
179
221
  /**
180
222
  * Phone number in E164 format
181
223
  */
@@ -195,6 +237,18 @@ export interface PhoneNumberListResponse {
195
237
 
196
238
  status?: string;
197
239
 
240
+ /**
241
+ * Deadline for initiating the current coexistence synchronization cycle. This is
242
+ * null when no deadline applies.
243
+ */
244
+ sync_deadline?: string | null;
245
+
246
+ /**
247
+ * Synchronization progress. This object is returned only while a coexistence
248
+ * number is synchronizing.
249
+ */
250
+ sync_progress?: PhoneNumberListResponse.SyncProgress | null;
251
+
198
252
  /**
199
253
  * User ID
200
254
  */
@@ -206,6 +260,24 @@ export interface PhoneNumberListResponse {
206
260
  waba_id?: string;
207
261
  }
208
262
 
263
+ export namespace PhoneNumberListResponse {
264
+ /**
265
+ * Synchronization progress. This object is returned only while a coexistence
266
+ * number is synchronizing.
267
+ */
268
+ export interface SyncProgress {
269
+ contacts_status?: string;
270
+
271
+ history_chunk_order?: number | null;
272
+
273
+ history_phase?: number | null;
274
+
275
+ history_progress?: number | null;
276
+
277
+ history_status?: string;
278
+ }
279
+ }
280
+
209
281
  export interface PhoneNumberGetResponse {
210
282
  data?: Array<PhoneNumberGetResponse.Data>;
211
283
 
@@ -216,12 +288,34 @@ export namespace PhoneNumberGetResponse {
216
288
  export interface Data {
217
289
  calling_enabled?: boolean;
218
290
 
291
+ /**
292
+ * Current lifecycle state for a coexistence number. This is null for a standard
293
+ * Cloud API number.
294
+ */
295
+ coexistence_state?:
296
+ | 'pending_onboarding'
297
+ | 'sync_pending'
298
+ | 'syncing'
299
+ | 'sync_complete'
300
+ | 'active'
301
+ | 'history_declined'
302
+ | 'sync_deadline_expired'
303
+ | 'offboarded'
304
+ | 'disconnected'
305
+ | null;
306
+
219
307
  created_at?: string;
220
308
 
221
309
  display_name?: string;
222
310
 
223
311
  enabled?: boolean;
224
312
 
313
+ /**
314
+ * Indicates whether the number is connected to both the WhatsApp Business app and
315
+ * Cloud API through WhatsApp Coexistence.
316
+ */
317
+ is_on_biz_app?: boolean;
318
+
225
319
  /**
226
320
  * Phone number in E164 format
227
321
  */
@@ -241,6 +335,18 @@ export namespace PhoneNumberGetResponse {
241
335
 
242
336
  status?: string;
243
337
 
338
+ /**
339
+ * Deadline for initiating the current coexistence synchronization cycle. This is
340
+ * null when no deadline applies.
341
+ */
342
+ sync_deadline?: string | null;
343
+
344
+ /**
345
+ * Synchronization progress. This object is returned only while a coexistence
346
+ * number is synchronizing.
347
+ */
348
+ sync_progress?: Data.SyncProgress | null;
349
+
244
350
  /**
245
351
  * User ID
246
352
  */
@@ -251,6 +357,24 @@ export namespace PhoneNumberGetResponse {
251
357
  */
252
358
  waba_id?: string;
253
359
  }
360
+
361
+ export namespace Data {
362
+ /**
363
+ * Synchronization progress. This object is returned only while a coexistence
364
+ * number is synchronizing.
365
+ */
366
+ export interface SyncProgress {
367
+ contacts_status?: string;
368
+
369
+ history_chunk_order?: number | null;
370
+
371
+ history_phase?: number | null;
372
+
373
+ history_progress?: number | null;
374
+
375
+ history_status?: string;
376
+ }
377
+ }
254
378
  }
255
379
 
256
380
  export interface PhoneNumberRetrieveConversationWindowResponse {
@@ -281,6 +405,103 @@ export namespace PhoneNumberRetrieveConversationWindowResponse {
281
405
  }
282
406
  }
283
407
 
408
+ export interface PhoneNumberRetrievePhoneNumberResponse {
409
+ data: PhoneNumberRetrievePhoneNumberResponse.Data;
410
+ }
411
+
412
+ export namespace PhoneNumberRetrievePhoneNumberResponse {
413
+ export interface Data {
414
+ calling_enabled?: boolean;
415
+
416
+ /**
417
+ * Current lifecycle state for a coexistence number. This is null for a standard
418
+ * Cloud API number.
419
+ */
420
+ coexistence_state?:
421
+ | 'pending_onboarding'
422
+ | 'sync_pending'
423
+ | 'syncing'
424
+ | 'sync_complete'
425
+ | 'active'
426
+ | 'history_declined'
427
+ | 'sync_deadline_expired'
428
+ | 'offboarded'
429
+ | 'disconnected'
430
+ | null;
431
+
432
+ created_at?: string;
433
+
434
+ display_name?: string;
435
+
436
+ enabled?: boolean;
437
+
438
+ /**
439
+ * Indicates whether the number is connected to both the WhatsApp Business app and
440
+ * Cloud API through WhatsApp Coexistence.
441
+ */
442
+ is_on_biz_app?: boolean;
443
+
444
+ /**
445
+ * Phone number in E164 format
446
+ */
447
+ phone_number?: string;
448
+
449
+ /**
450
+ * Whatsapp phone number ID
451
+ */
452
+ phone_number_id?: string;
453
+
454
+ /**
455
+ * Whatsapp quality rating
456
+ */
457
+ quality_rating?: string;
458
+
459
+ record_type?: string;
460
+
461
+ status?: string;
462
+
463
+ /**
464
+ * Deadline for initiating the current coexistence synchronization cycle. This is
465
+ * null when no deadline applies.
466
+ */
467
+ sync_deadline?: string | null;
468
+
469
+ /**
470
+ * Synchronization progress. This object is returned only while a coexistence
471
+ * number is synchronizing.
472
+ */
473
+ sync_progress?: Data.SyncProgress | null;
474
+
475
+ /**
476
+ * User ID
477
+ */
478
+ user_id?: string;
479
+
480
+ /**
481
+ * WABA ID of Whatsapp business account
482
+ */
483
+ waba_id?: string;
484
+ }
485
+
486
+ export namespace Data {
487
+ /**
488
+ * Synchronization progress. This object is returned only while a coexistence
489
+ * number is synchronizing.
490
+ */
491
+ export interface SyncProgress {
492
+ contacts_status?: string;
493
+
494
+ history_chunk_order?: number | null;
495
+
496
+ history_phase?: number | null;
497
+
498
+ history_progress?: number | null;
499
+
500
+ history_status?: string;
501
+ }
502
+ }
503
+ }
504
+
284
505
  export interface PhoneNumberListParams extends DefaultFlatPaginationParams {}
285
506
 
286
507
  export interface PhoneNumberResendVerificationParams {
@@ -313,6 +534,7 @@ export declare namespace PhoneNumbers {
313
534
  type PhoneNumberListResponse as PhoneNumberListResponse,
314
535
  type PhoneNumberGetResponse as PhoneNumberGetResponse,
315
536
  type PhoneNumberRetrieveConversationWindowResponse as PhoneNumberRetrieveConversationWindowResponse,
537
+ type PhoneNumberRetrievePhoneNumberResponse as PhoneNumberRetrievePhoneNumberResponse,
316
538
  type PhoneNumberListResponsesDefaultFlatPagination as PhoneNumberListResponsesDefaultFlatPagination,
317
539
  type PhoneNumberListParams as PhoneNumberListParams,
318
540
  type PhoneNumberResendVerificationParams as PhoneNumberResendVerificationParams,
@@ -39,6 +39,7 @@ import {
39
39
  PhoneNumberResendVerificationParams,
40
40
  PhoneNumberRetrieveConversationWindowParams,
41
41
  PhoneNumberRetrieveConversationWindowResponse,
42
+ PhoneNumberRetrievePhoneNumberResponse,
42
43
  PhoneNumberVerifyParams,
43
44
  PhoneNumbers,
44
45
  } from './phone-numbers/phone-numbers';
@@ -83,6 +84,7 @@ export declare namespace Whatsapp {
83
84
  type PhoneNumberListResponse as PhoneNumberListResponse,
84
85
  type PhoneNumberGetResponse as PhoneNumberGetResponse,
85
86
  type PhoneNumberRetrieveConversationWindowResponse as PhoneNumberRetrieveConversationWindowResponse,
87
+ type PhoneNumberRetrievePhoneNumberResponse as PhoneNumberRetrievePhoneNumberResponse,
86
88
  type PhoneNumberListResponsesDefaultFlatPagination as PhoneNumberListResponsesDefaultFlatPagination,
87
89
  type PhoneNumberListParams as PhoneNumberListParams,
88
90
  type PhoneNumberResendVerificationParams as PhoneNumberResendVerificationParams,
@@ -0,0 +1,312 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import * as PaymentsAPI from './payments';
5
+ import {
6
+ PaymentListParams,
7
+ PaymentRetrieveResponse,
8
+ Payments,
9
+ X402TransactionRecord,
10
+ X402TransactionRecordsDefaultFlatPagination,
11
+ } from './payments';
12
+ import { APIPromise } from '../../../core/api-promise';
13
+ import { buildHeaders } from '../../../internal/headers';
14
+ import { RequestOptions } from '../../../internal/request-options';
15
+
16
+ /**
17
+ * Operations for x402 cryptocurrency payment transactions. Fund your Telnyx account using USDC stablecoin payments via the x402 protocol.
18
+ */
19
+ export class CreditAccount extends APIResource {
20
+ payments: PaymentsAPI.Payments = new PaymentsAPI.Payments(this._client);
21
+
22
+ /**
23
+ * Settles an x402 payment using the quote ID and a signed payment authorization.
24
+ * The payment signature can be provided via the `PAYMENT-SIGNATURE` header or the
25
+ * `payment_signature` body parameter. Settlement is idempotent — submitting the
26
+ * same quote ID multiple times returns the existing transaction.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const response = await client.x402.creditAccount.settle({
31
+ * id: 'quote_abc123',
32
+ * payment_signature: '0xabc123...',
33
+ * });
34
+ * ```
35
+ */
36
+ settle(
37
+ params: CreditAccountSettleParams,
38
+ options?: RequestOptions,
39
+ ): APIPromise<CreditAccountSettleResponse> {
40
+ const { header_payment_signature, ...body } = params;
41
+ return this._client.post('/x402/credit_account', {
42
+ body,
43
+ ...options,
44
+ headers: buildHeaders([
45
+ {
46
+ ...(header_payment_signature != null ?
47
+ { 'PAYMENT-SIGNATURE': header_payment_signature }
48
+ : undefined),
49
+ },
50
+ options?.headers,
51
+ ]),
52
+ });
53
+ }
54
+
55
+ /**
56
+ * Creates a payment quote for the specified USD amount. Returns payment details
57
+ * including the x402 payment requirements, network, and expiration time. The quote
58
+ * must be settled before it expires.
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * const response =
63
+ * await client.x402.creditAccount.createQuote({
64
+ * amount_usd: '50.00',
65
+ * });
66
+ * ```
67
+ */
68
+ createQuote(
69
+ body: CreditAccountCreateQuoteParams,
70
+ options?: RequestOptions,
71
+ ): APIPromise<CreditAccountCreateQuoteResponse> {
72
+ return this._client.post('/x402/credit_account/quote', { body, ...options });
73
+ }
74
+ }
75
+
76
+ export interface CreditAccountCreateQuoteResponse {
77
+ data?: CreditAccountCreateQuoteResponse.Data;
78
+ }
79
+
80
+ export namespace CreditAccountCreateQuoteResponse {
81
+ export interface Data {
82
+ /**
83
+ * Unique quote identifier. Use this to settle the payment.
84
+ */
85
+ id?: string;
86
+
87
+ /**
88
+ * The equivalent amount in the payment cryptocurrency's smallest unit (e.g. USDC
89
+ * has 6 decimals, so $50.00 = "50000000").
90
+ */
91
+ amount_crypto?: string;
92
+
93
+ /**
94
+ * The quoted amount in USD.
95
+ */
96
+ amount_usd?: string;
97
+
98
+ /**
99
+ * ISO 8601 timestamp when the quote expires.
100
+ */
101
+ expires_at?: string;
102
+
103
+ /**
104
+ * The blockchain network for the payment in CAIP-2 format (e.g. eip155:8453 for
105
+ * Base).
106
+ */
107
+ network?: string;
108
+
109
+ /**
110
+ * x402 protocol v2 payment requirements. Contains all information needed to
111
+ * construct and sign a payment authorization.
112
+ */
113
+ payment_requirements?: Data.PaymentRequirements;
114
+
115
+ record_type?: 'quote';
116
+ }
117
+
118
+ export namespace Data {
119
+ /**
120
+ * x402 protocol v2 payment requirements. Contains all information needed to
121
+ * construct and sign a payment authorization.
122
+ */
123
+ export interface PaymentRequirements {
124
+ /**
125
+ * Accepted payment schemes. Currently only the `exact` EVM scheme is supported.
126
+ */
127
+ accepts?: Array<PaymentRequirements.Accept>;
128
+
129
+ /**
130
+ * The resource being paid for. Included in the payment signature.
131
+ */
132
+ resource?: PaymentRequirements.Resource;
133
+
134
+ /**
135
+ * x402 protocol version. Currently always 2.
136
+ */
137
+ x402Version?: 2;
138
+ }
139
+
140
+ export namespace PaymentRequirements {
141
+ export interface Accept {
142
+ /**
143
+ * Amount in the token's smallest unit.
144
+ */
145
+ amount?: string;
146
+
147
+ /**
148
+ * Token contract address (e.g. USDC on Base).
149
+ */
150
+ asset?: string;
151
+
152
+ /**
153
+ * Additional scheme-specific parameters including EIP-712 domain info and the
154
+ * facilitator URL.
155
+ */
156
+ extra?: Accept.Extra;
157
+
158
+ /**
159
+ * Maximum time in seconds before the payment authorization expires.
160
+ */
161
+ maxTimeoutSeconds?: number;
162
+
163
+ /**
164
+ * Blockchain network identifier in CAIP-2 format (e.g. "eip155:8453" for Base).
165
+ */
166
+ network?: string;
167
+
168
+ /**
169
+ * Recipient wallet address.
170
+ */
171
+ payTo?: string;
172
+
173
+ /**
174
+ * Payment scheme (e.g. "exact").
175
+ */
176
+ scheme?: string;
177
+ }
178
+
179
+ export namespace Accept {
180
+ /**
181
+ * Additional scheme-specific parameters including EIP-712 domain info and the
182
+ * facilitator URL.
183
+ */
184
+ export interface Extra {
185
+ facilitatorUrl?: string;
186
+
187
+ /**
188
+ * EIP-712 domain name (e.g. "USD Coin").
189
+ */
190
+ name?: string;
191
+
192
+ quoteId?: string;
193
+
194
+ /**
195
+ * EIP-712 domain version.
196
+ */
197
+ version?: string;
198
+ }
199
+ }
200
+
201
+ /**
202
+ * The resource being paid for. Included in the payment signature.
203
+ */
204
+ export interface Resource {
205
+ /**
206
+ * Human-readable description of the payment.
207
+ */
208
+ description?: string;
209
+
210
+ /**
211
+ * MIME type of the resource.
212
+ */
213
+ mimeType?: string;
214
+
215
+ /**
216
+ * Canonical URL of the payment resource.
217
+ */
218
+ url?: string;
219
+ }
220
+ }
221
+ }
222
+ }
223
+
224
+ export interface CreditAccountSettleResponse {
225
+ data?: CreditAccountSettleResponse.Data;
226
+ }
227
+
228
+ export namespace CreditAccountSettleResponse {
229
+ export interface Data {
230
+ /**
231
+ * Unique transaction identifier.
232
+ */
233
+ id?: string;
234
+
235
+ /**
236
+ * The transaction amount in the specified currency.
237
+ */
238
+ amount?: string;
239
+
240
+ /**
241
+ * ISO 8601 timestamp when the transaction was created.
242
+ */
243
+ created_at?: string;
244
+
245
+ /**
246
+ * The currency of the transaction amount (e.g. USD).
247
+ */
248
+ currency?: string;
249
+
250
+ /**
251
+ * The original quote ID associated with this transaction.
252
+ */
253
+ quote_id?: string;
254
+
255
+ record_type?: 'x402_transaction';
256
+
257
+ /**
258
+ * The settlement status of the transaction.
259
+ */
260
+ status?: 'settled';
261
+
262
+ /**
263
+ * The on-chain transaction hash, if available.
264
+ */
265
+ tx_hash?: string | null;
266
+ }
267
+ }
268
+
269
+ export interface CreditAccountSettleParams {
270
+ /**
271
+ * Body param: The quote ID to settle.
272
+ */
273
+ id: string;
274
+
275
+ /**
276
+ * Body param: Base64-encoded signed payment authorization (x402 PaymentPayload).
277
+ * Can alternatively be provided via the PAYMENT-SIGNATURE header.
278
+ */
279
+ payment_signature?: string;
280
+
281
+ /**
282
+ * Header param: Signed payment authorization for the quote. Alternative to
283
+ * providing `payment_signature` in the request body.
284
+ */
285
+ header_payment_signature?: string;
286
+ }
287
+
288
+ export interface CreditAccountCreateQuoteParams {
289
+ /**
290
+ * Amount in USD to fund (minimum 5.00, maximum 10000.00).
291
+ */
292
+ amount_usd: string;
293
+ }
294
+
295
+ CreditAccount.Payments = Payments;
296
+
297
+ export declare namespace CreditAccount {
298
+ export {
299
+ type CreditAccountCreateQuoteResponse as CreditAccountCreateQuoteResponse,
300
+ type CreditAccountSettleResponse as CreditAccountSettleResponse,
301
+ type CreditAccountSettleParams as CreditAccountSettleParams,
302
+ type CreditAccountCreateQuoteParams as CreditAccountCreateQuoteParams,
303
+ };
304
+
305
+ export {
306
+ Payments as Payments,
307
+ type X402TransactionRecord as X402TransactionRecord,
308
+ type PaymentRetrieveResponse as PaymentRetrieveResponse,
309
+ type X402TransactionRecordsDefaultFlatPagination as X402TransactionRecordsDefaultFlatPagination,
310
+ type PaymentListParams as PaymentListParams,
311
+ };
312
+ }
@@ -0,0 +1,16 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ CreditAccount,
5
+ type CreditAccountCreateQuoteResponse,
6
+ type CreditAccountSettleResponse,
7
+ type CreditAccountSettleParams,
8
+ type CreditAccountCreateQuoteParams,
9
+ } from './credit-account';
10
+ export {
11
+ Payments,
12
+ type X402TransactionRecord,
13
+ type PaymentRetrieveResponse,
14
+ type PaymentListParams,
15
+ type X402TransactionRecordsDefaultFlatPagination,
16
+ } from './payments';