@zavudev/sdk 0.58.1 → 0.59.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 (220) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +18 -0
  3. package/client.d.mts +2 -0
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +2 -0
  6. package/client.d.ts.map +1 -1
  7. package/client.js +2 -0
  8. package/client.js.map +1 -1
  9. package/client.mjs +2 -0
  10. package/client.mjs.map +1 -1
  11. package/package.json +21 -1
  12. package/src/client.ts +2 -0
  13. package/src/types.ts +2 -2
  14. package/src/v2/index.ts +4 -0
  15. package/src/v2/resources/agents/agents.ts +142 -0
  16. package/src/v2/resources/agents/channels.ts +66 -0
  17. package/src/v2/resources/agents/index.ts +18 -0
  18. package/src/v2/resources/agents.ts +3 -0
  19. package/src/v2/resources/campaigns/campaigns.ts +178 -0
  20. package/src/v2/resources/campaigns/index.ts +27 -0
  21. package/src/v2/resources/campaigns/recipients.ts +62 -0
  22. package/src/v2/resources/campaigns.ts +3 -0
  23. package/src/v2/resources/channels.ts +156 -0
  24. package/src/v2/resources/contacts.ts +112 -0
  25. package/src/v2/resources/conversations.ts +89 -0
  26. package/src/v2/resources/email-domains.ts +107 -0
  27. package/src/v2/resources/functions.ts +73 -0
  28. package/src/v2/resources/index.ts +138 -0
  29. package/src/v2/resources/messages.ts +129 -0
  30. package/src/v2/resources/numbers.ts +74 -0
  31. package/src/v2/resources/templates.ts +104 -0
  32. package/src/v2/resources/webhook.ts +102 -0
  33. package/src/v2/types.ts +2412 -0
  34. package/src/v2/v2.ts +315 -0
  35. package/src/v2.ts +3 -0
  36. package/src/version.ts +1 -1
  37. package/types.d.mts +2 -2
  38. package/types.d.mts.map +1 -1
  39. package/types.d.ts +2 -2
  40. package/types.d.ts.map +1 -1
  41. package/v2/index.d.mts +3 -0
  42. package/v2/index.d.mts.map +1 -0
  43. package/v2/index.d.ts +3 -0
  44. package/v2/index.d.ts.map +1 -0
  45. package/v2/index.js +9 -0
  46. package/v2/index.js.map +1 -0
  47. package/v2/index.mjs +4 -0
  48. package/v2/index.mjs.map +1 -0
  49. package/v2/resources/agents/agents.d.mts +81 -0
  50. package/v2/resources/agents/agents.d.mts.map +1 -0
  51. package/v2/resources/agents/agents.d.ts +81 -0
  52. package/v2/resources/agents/agents.d.ts.map +1 -0
  53. package/v2/resources/agents/agents.js +88 -0
  54. package/v2/resources/agents/agents.js.map +1 -0
  55. package/v2/resources/agents/agents.mjs +83 -0
  56. package/v2/resources/agents/agents.mjs.map +1 -0
  57. package/v2/resources/agents/channels.d.mts +39 -0
  58. package/v2/resources/agents/channels.d.mts.map +1 -0
  59. package/v2/resources/agents/channels.d.ts +39 -0
  60. package/v2/resources/agents/channels.d.ts.map +1 -0
  61. package/v2/resources/agents/channels.js +44 -0
  62. package/v2/resources/agents/channels.js.map +1 -0
  63. package/v2/resources/agents/channels.mjs +40 -0
  64. package/v2/resources/agents/channels.mjs.map +1 -0
  65. package/v2/resources/agents/index.d.mts +3 -0
  66. package/v2/resources/agents/index.d.mts.map +1 -0
  67. package/v2/resources/agents/index.d.ts +3 -0
  68. package/v2/resources/agents/index.d.ts.map +1 -0
  69. package/v2/resources/agents/index.js +9 -0
  70. package/v2/resources/agents/index.js.map +1 -0
  71. package/v2/resources/agents/index.mjs +4 -0
  72. package/v2/resources/agents/index.mjs.map +1 -0
  73. package/v2/resources/agents.d.mts +2 -0
  74. package/v2/resources/agents.d.mts.map +1 -0
  75. package/v2/resources/agents.d.ts +2 -0
  76. package/v2/resources/agents.d.ts.map +1 -0
  77. package/v2/resources/agents.js +6 -0
  78. package/v2/resources/agents.js.map +1 -0
  79. package/v2/resources/agents.mjs +3 -0
  80. package/v2/resources/agents.mjs.map +1 -0
  81. package/v2/resources/campaigns/campaigns.d.mts +100 -0
  82. package/v2/resources/campaigns/campaigns.d.mts.map +1 -0
  83. package/v2/resources/campaigns/campaigns.d.ts +100 -0
  84. package/v2/resources/campaigns/campaigns.d.ts.map +1 -0
  85. package/v2/resources/campaigns/campaigns.js +106 -0
  86. package/v2/resources/campaigns/campaigns.js.map +1 -0
  87. package/v2/resources/campaigns/campaigns.mjs +101 -0
  88. package/v2/resources/campaigns/campaigns.mjs.map +1 -0
  89. package/v2/resources/campaigns/index.d.mts +3 -0
  90. package/v2/resources/campaigns/index.d.mts.map +1 -0
  91. package/v2/resources/campaigns/index.d.ts +3 -0
  92. package/v2/resources/campaigns/index.d.ts.map +1 -0
  93. package/v2/resources/campaigns/index.js +9 -0
  94. package/v2/resources/campaigns/index.js.map +1 -0
  95. package/v2/resources/campaigns/index.mjs +4 -0
  96. package/v2/resources/campaigns/index.mjs.map +1 -0
  97. package/v2/resources/campaigns/recipients.d.mts +43 -0
  98. package/v2/resources/campaigns/recipients.d.mts.map +1 -0
  99. package/v2/resources/campaigns/recipients.d.ts +43 -0
  100. package/v2/resources/campaigns/recipients.d.ts.map +1 -0
  101. package/v2/resources/campaigns/recipients.js +41 -0
  102. package/v2/resources/campaigns/recipients.js.map +1 -0
  103. package/v2/resources/campaigns/recipients.mjs +37 -0
  104. package/v2/resources/campaigns/recipients.mjs.map +1 -0
  105. package/v2/resources/campaigns.d.mts +2 -0
  106. package/v2/resources/campaigns.d.mts.map +1 -0
  107. package/v2/resources/campaigns.d.ts +2 -0
  108. package/v2/resources/campaigns.d.ts.map +1 -0
  109. package/v2/resources/campaigns.js +6 -0
  110. package/v2/resources/campaigns.js.map +1 -0
  111. package/v2/resources/campaigns.mjs +3 -0
  112. package/v2/resources/campaigns.mjs.map +1 -0
  113. package/v2/resources/channels.d.mts +101 -0
  114. package/v2/resources/channels.d.mts.map +1 -0
  115. package/v2/resources/channels.d.ts +101 -0
  116. package/v2/resources/channels.d.ts.map +1 -0
  117. package/v2/resources/channels.js +107 -0
  118. package/v2/resources/channels.js.map +1 -0
  119. package/v2/resources/channels.mjs +103 -0
  120. package/v2/resources/channels.mjs.map +1 -0
  121. package/v2/resources/contacts.d.mts +62 -0
  122. package/v2/resources/contacts.d.mts.map +1 -0
  123. package/v2/resources/contacts.d.ts +62 -0
  124. package/v2/resources/contacts.d.ts.map +1 -0
  125. package/v2/resources/contacts.js +66 -0
  126. package/v2/resources/contacts.js.map +1 -0
  127. package/v2/resources/contacts.mjs +62 -0
  128. package/v2/resources/contacts.mjs.map +1 -0
  129. package/v2/resources/conversations.d.mts +51 -0
  130. package/v2/resources/conversations.d.mts.map +1 -0
  131. package/v2/resources/conversations.d.ts +51 -0
  132. package/v2/resources/conversations.d.ts.map +1 -0
  133. package/v2/resources/conversations.js +55 -0
  134. package/v2/resources/conversations.js.map +1 -0
  135. package/v2/resources/conversations.mjs +51 -0
  136. package/v2/resources/conversations.mjs.map +1 -0
  137. package/v2/resources/email-domains.d.mts +72 -0
  138. package/v2/resources/email-domains.d.mts.map +1 -0
  139. package/v2/resources/email-domains.d.ts +72 -0
  140. package/v2/resources/email-domains.d.ts.map +1 -0
  141. package/v2/resources/email-domains.js +80 -0
  142. package/v2/resources/email-domains.js.map +1 -0
  143. package/v2/resources/email-domains.mjs +76 -0
  144. package/v2/resources/email-domains.mjs.map +1 -0
  145. package/v2/resources/functions.d.mts +41 -0
  146. package/v2/resources/functions.d.mts.map +1 -0
  147. package/v2/resources/functions.d.ts +41 -0
  148. package/v2/resources/functions.d.ts.map +1 -0
  149. package/v2/resources/functions.js +41 -0
  150. package/v2/resources/functions.js.map +1 -0
  151. package/v2/resources/functions.mjs +37 -0
  152. package/v2/resources/functions.mjs.map +1 -0
  153. package/v2/resources/index.d.mts +12 -0
  154. package/v2/resources/index.d.mts.map +1 -0
  155. package/v2/resources/index.d.ts +12 -0
  156. package/v2/resources/index.d.ts.map +1 -0
  157. package/v2/resources/index.js +27 -0
  158. package/v2/resources/index.js.map +1 -0
  159. package/v2/resources/index.mjs +13 -0
  160. package/v2/resources/index.mjs.map +1 -0
  161. package/v2/resources/messages.d.mts +82 -0
  162. package/v2/resources/messages.d.mts.map +1 -0
  163. package/v2/resources/messages.d.ts +82 -0
  164. package/v2/resources/messages.d.ts.map +1 -0
  165. package/v2/resources/messages.js +74 -0
  166. package/v2/resources/messages.js.map +1 -0
  167. package/v2/resources/messages.mjs +70 -0
  168. package/v2/resources/messages.mjs.map +1 -0
  169. package/v2/resources/numbers.d.mts +46 -0
  170. package/v2/resources/numbers.d.mts.map +1 -0
  171. package/v2/resources/numbers.d.ts +46 -0
  172. package/v2/resources/numbers.d.ts.map +1 -0
  173. package/v2/resources/numbers.js +41 -0
  174. package/v2/resources/numbers.js.map +1 -0
  175. package/v2/resources/numbers.mjs +37 -0
  176. package/v2/resources/numbers.mjs.map +1 -0
  177. package/v2/resources/templates.d.mts +56 -0
  178. package/v2/resources/templates.d.mts.map +1 -0
  179. package/v2/resources/templates.d.ts +56 -0
  180. package/v2/resources/templates.d.ts.map +1 -0
  181. package/v2/resources/templates.js +61 -0
  182. package/v2/resources/templates.js.map +1 -0
  183. package/v2/resources/templates.mjs +57 -0
  184. package/v2/resources/templates.mjs.map +1 -0
  185. package/v2/resources/webhook.d.mts +67 -0
  186. package/v2/resources/webhook.d.mts.map +1 -0
  187. package/v2/resources/webhook.d.ts +67 -0
  188. package/v2/resources/webhook.d.ts.map +1 -0
  189. package/v2/resources/webhook.js +70 -0
  190. package/v2/resources/webhook.js.map +1 -0
  191. package/v2/resources/webhook.mjs +66 -0
  192. package/v2/resources/webhook.mjs.map +1 -0
  193. package/v2/types.d.mts +2171 -0
  194. package/v2/types.d.mts.map +1 -0
  195. package/v2/types.d.ts +2171 -0
  196. package/v2/types.d.ts.map +1 -0
  197. package/v2/types.js +4 -0
  198. package/v2/types.js.map +1 -0
  199. package/v2/types.mjs +3 -0
  200. package/v2/types.mjs.map +1 -0
  201. package/v2/v2.d.mts +40 -0
  202. package/v2/v2.d.mts.map +1 -0
  203. package/v2/v2.d.ts +40 -0
  204. package/v2/v2.d.ts.map +1 -0
  205. package/v2/v2.js +47 -0
  206. package/v2/v2.js.map +1 -0
  207. package/v2/v2.mjs +42 -0
  208. package/v2/v2.mjs.map +1 -0
  209. package/v2.d.mts +2 -0
  210. package/v2.d.mts.map +1 -0
  211. package/v2.d.ts +2 -0
  212. package/v2.d.ts.map +1 -0
  213. package/v2.js +6 -0
  214. package/v2.js.map +1 -0
  215. package/v2.mjs +3 -0
  216. package/v2.mjs.map +1 -0
  217. package/version.d.mts +1 -1
  218. package/version.d.ts +1 -1
  219. package/version.js +1 -1
  220. package/version.mjs +1 -1
@@ -0,0 +1,46 @@
1
+ import { APIResource } from "../../core/resource.mjs";
2
+ import { APIPromise } from "../../core/api-promise.mjs";
3
+ import { RequestOptions } from "../../internal/request-options.mjs";
4
+ import type * as T from "../types.mjs";
5
+ /** Search and buy phone numbers. */
6
+ export declare class Numbers extends APIResource {
7
+ /**
8
+ * Search numbers to buy
9
+ *
10
+ * Search numbers to buy, by country and type.
11
+ *
12
+ * `GET /v2/numbers/available`
13
+ */
14
+ searchAvailable(query: NumberSearchAvailableParams, options?: RequestOptions): APIPromise<NumberSearchAvailableResponse>;
15
+ /**
16
+ * Buy a number
17
+ *
18
+ * Buy a number and make it an SMS channel in the same call. The purchase follows
19
+ * the same rules as `POST /v1/phone-numbers`, including regulatory requirements,
20
+ * and the number comes back with SMS on. There is no separate assign step. Where
21
+ * it lands: when the project's default channel group has no number yet, the number
22
+ * joins that group (and becomes the project's first channel and default when there
23
+ * is none); otherwise it gets a channel group of its own.
24
+ *
25
+ * While the number is in regulatory review (`number.regulatoryStatus:
26
+ * pending_review`) it is attached but cannot send, and `channels` can be empty
27
+ * until it is approved. If the purchase succeeded but turning SMS on failed, the
28
+ * number is still bought and billed; the response says so in `setupError` rather
29
+ * than failing the call.
30
+ *
31
+ * `POST /v2/numbers`
32
+ */
33
+ purchase(body: NumberPurchaseParams, options?: RequestOptions): APIPromise<NumberPurchaseResponse>;
34
+ }
35
+ export type NumberSearchAvailableParams = T.NumbersSearchAvailableParams;
36
+ export type NumberSearchAvailableResponse = T.SearchNumbersV2Response;
37
+ export type AvailablePhoneNumber = T.AvailablePhoneNumber;
38
+ export type PhoneNumberType = T.PhoneNumberType;
39
+ export type NumberPurchaseParams = T.NumbersPurchaseParams;
40
+ export type NumberPurchaseResponse = T.PurchaseNumberV2Response;
41
+ export type ErrorBody = T.ErrorBody;
42
+ export type OwnedPhoneNumber = T.OwnedPhoneNumber;
43
+ export declare namespace Numbers {
44
+ export { type AvailablePhoneNumber as AvailablePhoneNumber, type ErrorBody as ErrorBody, type NumberPurchaseParams as NumberPurchaseParams, type NumberPurchaseResponse as NumberPurchaseResponse, type NumberSearchAvailableParams as NumberSearchAvailableParams, type NumberSearchAvailableResponse as NumberSearchAvailableResponse, type OwnedPhoneNumber as OwnedPhoneNumber, type PhoneNumberType as PhoneNumberType, };
45
+ }
46
+ //# sourceMappingURL=numbers.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"numbers.d.mts","sourceRoot":"","sources":["../../src/v2/resources/numbers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAClD,OAAO,EAAE,UAAU,EAAE,mCAA+B;AACpD,OAAO,EAAE,cAAc,EAAE,2CAAuC;AAChE,OAAO,KAAK,KAAK,CAAC,qBAAiB;AAEnC,oCAAoC;AACpC,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;;;OAMG;IACH,eAAe,CACb,KAAK,EAAE,2BAA2B,EAClC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,6BAA6B,CAAC;IAI5C;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,sBAAsB,CAAC;CAGnG;AAED,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,4BAA4B,CAAC;AAEzE,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,uBAAuB,CAAC;AAEtE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,oBAAoB,CAAC;AAE1D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,eAAe,CAAC;AAEhD,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,qBAAqB,CAAC;AAE3D,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,wBAAwB,CAAC;AAEhE,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC;AAEpC,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,gBAAgB,CAAC;AAElD,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,SAAS,IAAI,SAAS,EAC3B,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,eAAe,IAAI,eAAe,GACxC,CAAC;CACH"}
@@ -0,0 +1,46 @@
1
+ import { APIResource } from "../../core/resource.js";
2
+ import { APIPromise } from "../../core/api-promise.js";
3
+ import { RequestOptions } from "../../internal/request-options.js";
4
+ import type * as T from "../types.js";
5
+ /** Search and buy phone numbers. */
6
+ export declare class Numbers extends APIResource {
7
+ /**
8
+ * Search numbers to buy
9
+ *
10
+ * Search numbers to buy, by country and type.
11
+ *
12
+ * `GET /v2/numbers/available`
13
+ */
14
+ searchAvailable(query: NumberSearchAvailableParams, options?: RequestOptions): APIPromise<NumberSearchAvailableResponse>;
15
+ /**
16
+ * Buy a number
17
+ *
18
+ * Buy a number and make it an SMS channel in the same call. The purchase follows
19
+ * the same rules as `POST /v1/phone-numbers`, including regulatory requirements,
20
+ * and the number comes back with SMS on. There is no separate assign step. Where
21
+ * it lands: when the project's default channel group has no number yet, the number
22
+ * joins that group (and becomes the project's first channel and default when there
23
+ * is none); otherwise it gets a channel group of its own.
24
+ *
25
+ * While the number is in regulatory review (`number.regulatoryStatus:
26
+ * pending_review`) it is attached but cannot send, and `channels` can be empty
27
+ * until it is approved. If the purchase succeeded but turning SMS on failed, the
28
+ * number is still bought and billed; the response says so in `setupError` rather
29
+ * than failing the call.
30
+ *
31
+ * `POST /v2/numbers`
32
+ */
33
+ purchase(body: NumberPurchaseParams, options?: RequestOptions): APIPromise<NumberPurchaseResponse>;
34
+ }
35
+ export type NumberSearchAvailableParams = T.NumbersSearchAvailableParams;
36
+ export type NumberSearchAvailableResponse = T.SearchNumbersV2Response;
37
+ export type AvailablePhoneNumber = T.AvailablePhoneNumber;
38
+ export type PhoneNumberType = T.PhoneNumberType;
39
+ export type NumberPurchaseParams = T.NumbersPurchaseParams;
40
+ export type NumberPurchaseResponse = T.PurchaseNumberV2Response;
41
+ export type ErrorBody = T.ErrorBody;
42
+ export type OwnedPhoneNumber = T.OwnedPhoneNumber;
43
+ export declare namespace Numbers {
44
+ export { type AvailablePhoneNumber as AvailablePhoneNumber, type ErrorBody as ErrorBody, type NumberPurchaseParams as NumberPurchaseParams, type NumberPurchaseResponse as NumberPurchaseResponse, type NumberSearchAvailableParams as NumberSearchAvailableParams, type NumberSearchAvailableResponse as NumberSearchAvailableResponse, type OwnedPhoneNumber as OwnedPhoneNumber, type PhoneNumberType as PhoneNumberType, };
45
+ }
46
+ //# sourceMappingURL=numbers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src/v2/resources/numbers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,EAAE,UAAU,EAAE,kCAA+B;AACpD,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAChE,OAAO,KAAK,KAAK,CAAC,oBAAiB;AAEnC,oCAAoC;AACpC,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;;;OAMG;IACH,eAAe,CACb,KAAK,EAAE,2BAA2B,EAClC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,6BAA6B,CAAC;IAI5C;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,sBAAsB,CAAC;CAGnG;AAED,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,4BAA4B,CAAC;AAEzE,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,uBAAuB,CAAC;AAEtE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,oBAAoB,CAAC;AAE1D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,eAAe,CAAC;AAEhD,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,qBAAqB,CAAC;AAE3D,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,wBAAwB,CAAC;AAEhE,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC;AAEpC,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,gBAAgB,CAAC;AAElD,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,SAAS,IAAI,SAAS,EAC3B,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,eAAe,IAAI,eAAe,GACxC,CAAC;CACH"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ // Generated by zavu-codegen from apps/docs/api-reference/v2/openapi.json. Do not edit: run `bun run codegen`.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Numbers = void 0;
5
+ const resource_1 = require("../../core/resource.js");
6
+ /** Search and buy phone numbers. */
7
+ class Numbers extends resource_1.APIResource {
8
+ /**
9
+ * Search numbers to buy
10
+ *
11
+ * Search numbers to buy, by country and type.
12
+ *
13
+ * `GET /v2/numbers/available`
14
+ */
15
+ searchAvailable(query, options) {
16
+ return this._client.get('/v2/numbers/available', { query, ...options });
17
+ }
18
+ /**
19
+ * Buy a number
20
+ *
21
+ * Buy a number and make it an SMS channel in the same call. The purchase follows
22
+ * the same rules as `POST /v1/phone-numbers`, including regulatory requirements,
23
+ * and the number comes back with SMS on. There is no separate assign step. Where
24
+ * it lands: when the project's default channel group has no number yet, the number
25
+ * joins that group (and becomes the project's first channel and default when there
26
+ * is none); otherwise it gets a channel group of its own.
27
+ *
28
+ * While the number is in regulatory review (`number.regulatoryStatus:
29
+ * pending_review`) it is attached but cannot send, and `channels` can be empty
30
+ * until it is approved. If the purchase succeeded but turning SMS on failed, the
31
+ * number is still bought and billed; the response says so in `setupError` rather
32
+ * than failing the call.
33
+ *
34
+ * `POST /v2/numbers`
35
+ */
36
+ purchase(body, options) {
37
+ return this._client.post('/v2/numbers', { body, ...options });
38
+ }
39
+ }
40
+ exports.Numbers = Numbers;
41
+ //# sourceMappingURL=numbers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"numbers.js","sourceRoot":"","sources":["../../src/v2/resources/numbers.ts"],"names":[],"mappings":";AAAA,8GAA8G;;;AAE9G,qDAAkD;AAKlD,oCAAoC;AACpC,MAAa,OAAQ,SAAQ,sBAAW;IACtC;;;;;;OAMG;IACH,eAAe,CACb,KAAkC,EAClC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,IAA0B,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;CACF;AApCD,0BAoCC"}
@@ -0,0 +1,37 @@
1
+ // Generated by zavu-codegen from apps/docs/api-reference/v2/openapi.json. Do not edit: run `bun run codegen`.
2
+ import { APIResource } from "../../core/resource.mjs";
3
+ /** Search and buy phone numbers. */
4
+ export class Numbers extends APIResource {
5
+ /**
6
+ * Search numbers to buy
7
+ *
8
+ * Search numbers to buy, by country and type.
9
+ *
10
+ * `GET /v2/numbers/available`
11
+ */
12
+ searchAvailable(query, options) {
13
+ return this._client.get('/v2/numbers/available', { query, ...options });
14
+ }
15
+ /**
16
+ * Buy a number
17
+ *
18
+ * Buy a number and make it an SMS channel in the same call. The purchase follows
19
+ * the same rules as `POST /v1/phone-numbers`, including regulatory requirements,
20
+ * and the number comes back with SMS on. There is no separate assign step. Where
21
+ * it lands: when the project's default channel group has no number yet, the number
22
+ * joins that group (and becomes the project's first channel and default when there
23
+ * is none); otherwise it gets a channel group of its own.
24
+ *
25
+ * While the number is in regulatory review (`number.regulatoryStatus:
26
+ * pending_review`) it is attached but cannot send, and `channels` can be empty
27
+ * until it is approved. If the purchase succeeded but turning SMS on failed, the
28
+ * number is still bought and billed; the response says so in `setupError` rather
29
+ * than failing the call.
30
+ *
31
+ * `POST /v2/numbers`
32
+ */
33
+ purchase(body, options) {
34
+ return this._client.post('/v2/numbers', { body, ...options });
35
+ }
36
+ }
37
+ //# sourceMappingURL=numbers.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"numbers.mjs","sourceRoot":"","sources":["../../src/v2/resources/numbers.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAE9G,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAKlD,oCAAoC;AACpC,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;;;;;OAMG;IACH,eAAe,CACb,KAAkC,EAClC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,IAA0B,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;CACF"}
@@ -0,0 +1,56 @@
1
+ import { APIResource } from "../../core/resource.mjs";
2
+ import { APIPromise } from "../../core/api-promise.mjs";
3
+ import { Cursor, PagePromise } from "../../core/pagination.mjs";
4
+ import { RequestOptions } from "../../internal/request-options.mjs";
5
+ import type * as T from "../types.mjs";
6
+ /** WhatsApp message templates. */
7
+ export declare class Templates extends APIResource {
8
+ /**
9
+ * List templates
10
+ *
11
+ * `GET /v2/templates`
12
+ */
13
+ list(query?: TemplateListParams | null | undefined, options?: RequestOptions): PagePromise<TemplatesCursor, Template>;
14
+ /**
15
+ * Create a template
16
+ *
17
+ * `POST /v2/templates`
18
+ */
19
+ create(body: TemplateCreateParams, options?: RequestOptions): APIPromise<TemplateCreateResponse>;
20
+ /**
21
+ * Get a template
22
+ *
23
+ * `GET /v2/templates/{templateId}`
24
+ */
25
+ retrieve(templateID: string, options?: RequestOptions): APIPromise<TemplateRetrieveResponse>;
26
+ /**
27
+ * Delete a template
28
+ *
29
+ * As `DELETE /v1/templates/{templateId}`.
30
+ *
31
+ * `DELETE /v2/templates/{templateId}`
32
+ */
33
+ delete(templateID: string, options?: RequestOptions): APIPromise<void>;
34
+ /**
35
+ * Submit a template to WhatsApp
36
+ *
37
+ * Submit a draft template to Meta for approval, naming the WhatsApp number by its
38
+ * address (`from`).
39
+ *
40
+ * `POST /v2/templates/{templateId}/submit`
41
+ */
42
+ submit(templateID: string, body: TemplateSubmitParams, options?: RequestOptions): APIPromise<TemplateSubmitResponse>;
43
+ }
44
+ export type TemplateListParams = T.TemplatesListParams;
45
+ export type Template = T.Template;
46
+ export type TemplatesCursor = Cursor<T.Template>;
47
+ export type WhatsAppCategory = T.WhatsAppCategory;
48
+ export type TemplateCreateParams = T.TemplatesCreateParams;
49
+ export type TemplateCreateResponse = T.Template;
50
+ export type TemplateRetrieveResponse = T.Template;
51
+ export type TemplateSubmitParams = T.TemplatesSubmitParams;
52
+ export type TemplateSubmitResponse = T.Template;
53
+ export declare namespace Templates {
54
+ export { type Template as Template, type TemplateCreateParams as TemplateCreateParams, type TemplateCreateResponse as TemplateCreateResponse, type TemplateListParams as TemplateListParams, type TemplateRetrieveResponse as TemplateRetrieveResponse, type TemplateSubmitParams as TemplateSubmitParams, type TemplateSubmitResponse as TemplateSubmitResponse, type TemplatesCursor as TemplatesCursor, type WhatsAppCategory as WhatsAppCategory, };
55
+ }
56
+ //# sourceMappingURL=templates.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.mts","sourceRoot":"","sources":["../../src/v2/resources/templates.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAClD,OAAO,EAAE,UAAU,EAAE,mCAA+B;AACpD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,kCAA8B;AAE5D,OAAO,EAAE,cAAc,EAAE,2CAAuC;AAEhE,OAAO,KAAK,KAAK,CAAC,qBAAiB;AAEnC,kCAAkC;AAClC,qBAAa,SAAU,SAAQ,WAAW;IACxC;;;;OAIG;IACH,IAAI,CACF,KAAK,GAAE,kBAAkB,GAAG,IAAI,GAAG,SAAc,EACjD,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,eAAe,EAAE,QAAQ,CAAC;IAIzC;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,sBAAsB,CAAC;IAIhG;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,wBAAwB,CAAC;IAI5F;;;;;;OAMG;IACH,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAOtE;;;;;;;OAOG;IACH,MAAM,CACJ,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,oBAAoB,EAC1B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,sBAAsB,CAAC;CAGtC;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,mBAAmB,CAAC;AAEvD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC;AAElC,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAEjD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,gBAAgB,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,qBAAqB,CAAC;AAE3D,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,QAAQ,CAAC;AAEhD,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,QAAQ,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,qBAAqB,CAAC;AAE3D,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,QAAQ,CAAC;AAEhD,MAAM,CAAC,OAAO,WAAW,SAAS,CAAC;IACjC,OAAO,EACL,KAAK,QAAQ,IAAI,QAAQ,EACzB,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
@@ -0,0 +1,56 @@
1
+ import { APIResource } from "../../core/resource.js";
2
+ import { APIPromise } from "../../core/api-promise.js";
3
+ import { Cursor, PagePromise } from "../../core/pagination.js";
4
+ import { RequestOptions } from "../../internal/request-options.js";
5
+ import type * as T from "../types.js";
6
+ /** WhatsApp message templates. */
7
+ export declare class Templates extends APIResource {
8
+ /**
9
+ * List templates
10
+ *
11
+ * `GET /v2/templates`
12
+ */
13
+ list(query?: TemplateListParams | null | undefined, options?: RequestOptions): PagePromise<TemplatesCursor, Template>;
14
+ /**
15
+ * Create a template
16
+ *
17
+ * `POST /v2/templates`
18
+ */
19
+ create(body: TemplateCreateParams, options?: RequestOptions): APIPromise<TemplateCreateResponse>;
20
+ /**
21
+ * Get a template
22
+ *
23
+ * `GET /v2/templates/{templateId}`
24
+ */
25
+ retrieve(templateID: string, options?: RequestOptions): APIPromise<TemplateRetrieveResponse>;
26
+ /**
27
+ * Delete a template
28
+ *
29
+ * As `DELETE /v1/templates/{templateId}`.
30
+ *
31
+ * `DELETE /v2/templates/{templateId}`
32
+ */
33
+ delete(templateID: string, options?: RequestOptions): APIPromise<void>;
34
+ /**
35
+ * Submit a template to WhatsApp
36
+ *
37
+ * Submit a draft template to Meta for approval, naming the WhatsApp number by its
38
+ * address (`from`).
39
+ *
40
+ * `POST /v2/templates/{templateId}/submit`
41
+ */
42
+ submit(templateID: string, body: TemplateSubmitParams, options?: RequestOptions): APIPromise<TemplateSubmitResponse>;
43
+ }
44
+ export type TemplateListParams = T.TemplatesListParams;
45
+ export type Template = T.Template;
46
+ export type TemplatesCursor = Cursor<T.Template>;
47
+ export type WhatsAppCategory = T.WhatsAppCategory;
48
+ export type TemplateCreateParams = T.TemplatesCreateParams;
49
+ export type TemplateCreateResponse = T.Template;
50
+ export type TemplateRetrieveResponse = T.Template;
51
+ export type TemplateSubmitParams = T.TemplatesSubmitParams;
52
+ export type TemplateSubmitResponse = T.Template;
53
+ export declare namespace Templates {
54
+ export { type Template as Template, type TemplateCreateParams as TemplateCreateParams, type TemplateCreateResponse as TemplateCreateResponse, type TemplateListParams as TemplateListParams, type TemplateRetrieveResponse as TemplateRetrieveResponse, type TemplateSubmitParams as TemplateSubmitParams, type TemplateSubmitResponse as TemplateSubmitResponse, type TemplatesCursor as TemplatesCursor, type WhatsAppCategory as WhatsAppCategory, };
55
+ }
56
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/v2/resources/templates.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,EAAE,UAAU,EAAE,kCAA+B;AACpD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,iCAA8B;AAE5D,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAEhE,OAAO,KAAK,KAAK,CAAC,oBAAiB;AAEnC,kCAAkC;AAClC,qBAAa,SAAU,SAAQ,WAAW;IACxC;;;;OAIG;IACH,IAAI,CACF,KAAK,GAAE,kBAAkB,GAAG,IAAI,GAAG,SAAc,EACjD,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,eAAe,EAAE,QAAQ,CAAC;IAIzC;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,sBAAsB,CAAC;IAIhG;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,wBAAwB,CAAC;IAI5F;;;;;;OAMG;IACH,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAOtE;;;;;;;OAOG;IACH,MAAM,CACJ,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,oBAAoB,EAC1B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,sBAAsB,CAAC;CAGtC;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,mBAAmB,CAAC;AAEvD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC;AAElC,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAEjD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,gBAAgB,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,qBAAqB,CAAC;AAE3D,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,QAAQ,CAAC;AAEhD,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,QAAQ,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,qBAAqB,CAAC;AAE3D,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,QAAQ,CAAC;AAEhD,MAAM,CAAC,OAAO,WAAW,SAAS,CAAC;IACjC,OAAO,EACL,KAAK,QAAQ,IAAI,QAAQ,EACzB,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ // Generated by zavu-codegen from apps/docs/api-reference/v2/openapi.json. Do not edit: run `bun run codegen`.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Templates = void 0;
5
+ const resource_1 = require("../../core/resource.js");
6
+ const pagination_1 = require("../../core/pagination.js");
7
+ const headers_1 = require("../../internal/headers.js");
8
+ const path_1 = require("../../internal/utils/path.js");
9
+ /** WhatsApp message templates. */
10
+ class Templates extends resource_1.APIResource {
11
+ /**
12
+ * List templates
13
+ *
14
+ * `GET /v2/templates`
15
+ */
16
+ list(query = {}, options) {
17
+ return this._client.getAPIList('/v2/templates', (pagination_1.Cursor), { query, ...options });
18
+ }
19
+ /**
20
+ * Create a template
21
+ *
22
+ * `POST /v2/templates`
23
+ */
24
+ create(body, options) {
25
+ return this._client.post('/v2/templates', { body, ...options });
26
+ }
27
+ /**
28
+ * Get a template
29
+ *
30
+ * `GET /v2/templates/{templateId}`
31
+ */
32
+ retrieve(templateID, options) {
33
+ return this._client.get((0, path_1.path) `/v2/templates/${templateID}`, options);
34
+ }
35
+ /**
36
+ * Delete a template
37
+ *
38
+ * As `DELETE /v1/templates/{templateId}`.
39
+ *
40
+ * `DELETE /v2/templates/{templateId}`
41
+ */
42
+ delete(templateID, options) {
43
+ return this._client.delete((0, path_1.path) `/v2/templates/${templateID}`, {
44
+ ...options,
45
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
46
+ });
47
+ }
48
+ /**
49
+ * Submit a template to WhatsApp
50
+ *
51
+ * Submit a draft template to Meta for approval, naming the WhatsApp number by its
52
+ * address (`from`).
53
+ *
54
+ * `POST /v2/templates/{templateId}/submit`
55
+ */
56
+ submit(templateID, body, options) {
57
+ return this._client.post((0, path_1.path) `/v2/templates/${templateID}/submit`, { body, ...options });
58
+ }
59
+ }
60
+ exports.Templates = Templates;
61
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/v2/resources/templates.ts"],"names":[],"mappings":";AAAA,8GAA8G;;;AAE9G,qDAAkD;AAElD,yDAA4D;AAC5D,uDAAsD;AAEtD,uDAAiD;AAGjD,kCAAkC;AAClC,MAAa,SAAU,SAAQ,sBAAW;IACxC;;;;OAIG;IACH,IAAI,CACF,QAA+C,EAAE,EACjD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,eAAe,EAAE,CAAA,mBAAgB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC3F,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,IAA0B,EAAE,OAAwB;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,UAAkB,EAAE,OAAwB;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,iBAAiB,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,UAAkB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,iBAAiB,UAAU,EAAE,EAAE;YAC5D,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CACJ,UAAkB,EAClB,IAA0B,EAC1B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,iBAAiB,UAAU,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC3F,CAAC;CACF;AA5DD,8BA4DC"}
@@ -0,0 +1,57 @@
1
+ // Generated by zavu-codegen from apps/docs/api-reference/v2/openapi.json. Do not edit: run `bun run codegen`.
2
+ import { APIResource } from "../../core/resource.mjs";
3
+ import { Cursor } from "../../core/pagination.mjs";
4
+ import { buildHeaders } from "../../internal/headers.mjs";
5
+ import { path } from "../../internal/utils/path.mjs";
6
+ /** WhatsApp message templates. */
7
+ export class Templates extends APIResource {
8
+ /**
9
+ * List templates
10
+ *
11
+ * `GET /v2/templates`
12
+ */
13
+ list(query = {}, options) {
14
+ return this._client.getAPIList('/v2/templates', (Cursor), { query, ...options });
15
+ }
16
+ /**
17
+ * Create a template
18
+ *
19
+ * `POST /v2/templates`
20
+ */
21
+ create(body, options) {
22
+ return this._client.post('/v2/templates', { body, ...options });
23
+ }
24
+ /**
25
+ * Get a template
26
+ *
27
+ * `GET /v2/templates/{templateId}`
28
+ */
29
+ retrieve(templateID, options) {
30
+ return this._client.get(path `/v2/templates/${templateID}`, options);
31
+ }
32
+ /**
33
+ * Delete a template
34
+ *
35
+ * As `DELETE /v1/templates/{templateId}`.
36
+ *
37
+ * `DELETE /v2/templates/{templateId}`
38
+ */
39
+ delete(templateID, options) {
40
+ return this._client.delete(path `/v2/templates/${templateID}`, {
41
+ ...options,
42
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
43
+ });
44
+ }
45
+ /**
46
+ * Submit a template to WhatsApp
47
+ *
48
+ * Submit a draft template to Meta for approval, naming the WhatsApp number by its
49
+ * address (`from`).
50
+ *
51
+ * `POST /v2/templates/{templateId}/submit`
52
+ */
53
+ submit(templateID, body, options) {
54
+ return this._client.post(path `/v2/templates/${templateID}/submit`, { body, ...options });
55
+ }
56
+ }
57
+ //# sourceMappingURL=templates.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.mjs","sourceRoot":"","sources":["../../src/v2/resources/templates.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAE9G,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAElD,OAAO,EAAE,MAAM,EAAe,kCAA8B;AAC5D,OAAO,EAAE,YAAY,EAAE,mCAA+B;AAEtD,OAAO,EAAE,IAAI,EAAE,sCAAkC;AAGjD,kCAAkC;AAClC,MAAM,OAAO,SAAU,SAAQ,WAAW;IACxC;;;;OAIG;IACH,IAAI,CACF,QAA+C,EAAE,EACjD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,eAAe,EAAE,CAAA,MAAgB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC3F,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,IAA0B,EAAE,OAAwB;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,UAAkB,EAAE,OAAwB;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,iBAAiB,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,UAAkB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,iBAAiB,UAAU,EAAE,EAAE;YAC5D,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CACJ,UAAkB,EAClB,IAA0B,EAC1B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,iBAAiB,UAAU,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC3F,CAAC;CACF"}
@@ -0,0 +1,67 @@
1
+ import { APIResource } from "../../core/resource.mjs";
2
+ import { APIPromise } from "../../core/api-promise.mjs";
3
+ import { RequestOptions } from "../../internal/request-options.mjs";
4
+ import type * as T from "../types.mjs";
5
+ /** The one project webhook for every event. */
6
+ export declare class Webhook extends APIResource {
7
+ /**
8
+ * Get the project webhook
9
+ *
10
+ * One webhook for the whole project and every event, `message.*`,
11
+ * `conversation.new` and `call.*` included. Payloads name addresses (`from`, `to`)
12
+ * and the transport (`type`), never a sender id; see `WebhookPayloadV2`.
13
+ *
14
+ * **Alongside /v1 webhooks.** Configuring this webhook is the opt-in. From then on
15
+ * each event is delivered here *in addition to* any /v1 sender webhook or /v1
16
+ * project webhook subscribed to it, as independent deliveries with different event
17
+ * ids. Nothing is deduplicated. `senderWebhooks` lists the /v1 sender webhooks
18
+ * still on; switch them off with `disableSenderWebhooks` on `PUT` once this one is
19
+ * verified.
20
+ *
21
+ * It does not share storage with `/v1/invitations/webhook`.
22
+ *
23
+ * `GET /v2/webhook`
24
+ */
25
+ retrieve(options?: RequestOptions): APIPromise<WebhookRetrieveResponse>;
26
+ /**
27
+ * Create or replace the project webhook
28
+ *
29
+ * Create or replace the webhook. `url` must be HTTPS. The signature scheme
30
+ * defaults to `v2`. A webhook cannot move straight from `v1` to `v2`, or from `v2`
31
+ * to `v1` (`400`): a receiver verifying the current scheme would break on the next
32
+ * delivery, so both directions go through `v1+v2`. Replacing keeps the secret.
33
+ *
34
+ * Pass `disableSenderWebhooks: true` to switch off the /v1 sender webhooks of this
35
+ * project in the same call, so each event arrives once.
36
+ *
37
+ * `PUT /v2/webhook`
38
+ */
39
+ set(body: WebhookSetParams, options?: RequestOptions): APIPromise<WebhookSetResponse>;
40
+ /**
41
+ * Remove the webhook
42
+ *
43
+ * Remove the /v2 webhook and its secret. /v1 sender webhooks are not touched,
44
+ * including any `disableSenderWebhooks` switched off: they stay off.
45
+ *
46
+ * `DELETE /v2/webhook`
47
+ */
48
+ delete(options?: RequestOptions): APIPromise<void>;
49
+ /**
50
+ * Rotate the webhook secret
51
+ *
52
+ * `POST /v2/webhook/secret`
53
+ */
54
+ rotateSecret(options?: RequestOptions): APIPromise<WebhookRotateSecretResponse>;
55
+ }
56
+ export type WebhookRetrieveResponse = T.GetWebhookV2Response;
57
+ export type ProjectWebhookV2 = T.ProjectWebhookV2;
58
+ export type SenderWebhookV1 = T.SenderWebhookV1;
59
+ export type WebhookSetParams = T.WebhookSetParams;
60
+ export type WebhookSetResponse = T.PutWebhookV2Response;
61
+ export type WebhookEvent = T.WebhookEvent;
62
+ export type WebhookSignatureVersion = T.WebhookSignatureVersion;
63
+ export type WebhookRotateSecretResponse = T.RotateWebhookSecretV2Response;
64
+ export declare namespace Webhook {
65
+ export { type ProjectWebhookV2 as ProjectWebhookV2, type SenderWebhookV1 as SenderWebhookV1, type WebhookEvent as WebhookEvent, type WebhookRetrieveResponse as WebhookRetrieveResponse, type WebhookRotateSecretResponse as WebhookRotateSecretResponse, type WebhookSetParams as WebhookSetParams, type WebhookSetResponse as WebhookSetResponse, type WebhookSignatureVersion as WebhookSignatureVersion, };
66
+ }
67
+ //# sourceMappingURL=webhook.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook.d.mts","sourceRoot":"","sources":["../../src/v2/resources/webhook.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAClD,OAAO,EAAE,UAAU,EAAE,mCAA+B;AAEpD,OAAO,EAAE,cAAc,EAAE,2CAAuC;AAChE,OAAO,KAAK,KAAK,CAAC,qBAAiB;AAEnC,+CAA+C;AAC/C,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,uBAAuB,CAAC;IAIvE;;;;;;;;;;;;OAYG;IACH,GAAG,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,kBAAkB,CAAC;IAIrF;;;;;;;OAOG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAOlD;;;;OAIG;IACH,YAAY,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,2BAA2B,CAAC;CAGhF;AAED,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,oBAAoB,CAAC;AAE7D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,gBAAgB,CAAC;AAElD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,eAAe,CAAC;AAEhD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,gBAAgB,CAAC;AAElD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,oBAAoB,CAAC;AAExD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,YAAY,CAAC;AAE1C,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,uBAAuB,CAAC;AAEhE,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,6BAA6B,CAAC;AAE1E,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}
@@ -0,0 +1,67 @@
1
+ import { APIResource } from "../../core/resource.js";
2
+ import { APIPromise } from "../../core/api-promise.js";
3
+ import { RequestOptions } from "../../internal/request-options.js";
4
+ import type * as T from "../types.js";
5
+ /** The one project webhook for every event. */
6
+ export declare class Webhook extends APIResource {
7
+ /**
8
+ * Get the project webhook
9
+ *
10
+ * One webhook for the whole project and every event, `message.*`,
11
+ * `conversation.new` and `call.*` included. Payloads name addresses (`from`, `to`)
12
+ * and the transport (`type`), never a sender id; see `WebhookPayloadV2`.
13
+ *
14
+ * **Alongside /v1 webhooks.** Configuring this webhook is the opt-in. From then on
15
+ * each event is delivered here *in addition to* any /v1 sender webhook or /v1
16
+ * project webhook subscribed to it, as independent deliveries with different event
17
+ * ids. Nothing is deduplicated. `senderWebhooks` lists the /v1 sender webhooks
18
+ * still on; switch them off with `disableSenderWebhooks` on `PUT` once this one is
19
+ * verified.
20
+ *
21
+ * It does not share storage with `/v1/invitations/webhook`.
22
+ *
23
+ * `GET /v2/webhook`
24
+ */
25
+ retrieve(options?: RequestOptions): APIPromise<WebhookRetrieveResponse>;
26
+ /**
27
+ * Create or replace the project webhook
28
+ *
29
+ * Create or replace the webhook. `url` must be HTTPS. The signature scheme
30
+ * defaults to `v2`. A webhook cannot move straight from `v1` to `v2`, or from `v2`
31
+ * to `v1` (`400`): a receiver verifying the current scheme would break on the next
32
+ * delivery, so both directions go through `v1+v2`. Replacing keeps the secret.
33
+ *
34
+ * Pass `disableSenderWebhooks: true` to switch off the /v1 sender webhooks of this
35
+ * project in the same call, so each event arrives once.
36
+ *
37
+ * `PUT /v2/webhook`
38
+ */
39
+ set(body: WebhookSetParams, options?: RequestOptions): APIPromise<WebhookSetResponse>;
40
+ /**
41
+ * Remove the webhook
42
+ *
43
+ * Remove the /v2 webhook and its secret. /v1 sender webhooks are not touched,
44
+ * including any `disableSenderWebhooks` switched off: they stay off.
45
+ *
46
+ * `DELETE /v2/webhook`
47
+ */
48
+ delete(options?: RequestOptions): APIPromise<void>;
49
+ /**
50
+ * Rotate the webhook secret
51
+ *
52
+ * `POST /v2/webhook/secret`
53
+ */
54
+ rotateSecret(options?: RequestOptions): APIPromise<WebhookRotateSecretResponse>;
55
+ }
56
+ export type WebhookRetrieveResponse = T.GetWebhookV2Response;
57
+ export type ProjectWebhookV2 = T.ProjectWebhookV2;
58
+ export type SenderWebhookV1 = T.SenderWebhookV1;
59
+ export type WebhookSetParams = T.WebhookSetParams;
60
+ export type WebhookSetResponse = T.PutWebhookV2Response;
61
+ export type WebhookEvent = T.WebhookEvent;
62
+ export type WebhookSignatureVersion = T.WebhookSignatureVersion;
63
+ export type WebhookRotateSecretResponse = T.RotateWebhookSecretV2Response;
64
+ export declare namespace Webhook {
65
+ export { type ProjectWebhookV2 as ProjectWebhookV2, type SenderWebhookV1 as SenderWebhookV1, type WebhookEvent as WebhookEvent, type WebhookRetrieveResponse as WebhookRetrieveResponse, type WebhookRotateSecretResponse as WebhookRotateSecretResponse, type WebhookSetParams as WebhookSetParams, type WebhookSetResponse as WebhookSetResponse, type WebhookSignatureVersion as WebhookSignatureVersion, };
66
+ }
67
+ //# sourceMappingURL=webhook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../src/v2/resources/webhook.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,EAAE,UAAU,EAAE,kCAA+B;AAEpD,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAChE,OAAO,KAAK,KAAK,CAAC,oBAAiB;AAEnC,+CAA+C;AAC/C,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,uBAAuB,CAAC;IAIvE;;;;;;;;;;;;OAYG;IACH,GAAG,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,kBAAkB,CAAC;IAIrF;;;;;;;OAOG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAOlD;;;;OAIG;IACH,YAAY,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,2BAA2B,CAAC;CAGhF;AAED,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,oBAAoB,CAAC;AAE7D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,gBAAgB,CAAC;AAElD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,eAAe,CAAC;AAEhD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,gBAAgB,CAAC;AAElD,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,oBAAoB,CAAC;AAExD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,YAAY,CAAC;AAE1C,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,uBAAuB,CAAC;AAEhE,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,6BAA6B,CAAC;AAE1E,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}