@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,101 @@
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
+ import { type ChannelType } from "./messages.mjs";
7
+ /** Where the project can send from: one entry per (address, type). */
8
+ export declare class Channels extends APIResource {
9
+ /**
10
+ * List channels
11
+ *
12
+ * Every (address, type) the project can send from, and whether it can send right
13
+ * now. Paginated by sender: a page holds every entry of up to `limit` senders, so
14
+ * it can hold more than `limit` entries.
15
+ *
16
+ * `GET /v2/channels`
17
+ */
18
+ list(query?: ChannelListParams | null | undefined, options?: RequestOptions): PagePromise<ChannelEntriesCursor, ChannelEntry>;
19
+ /**
20
+ * Connect a channel
21
+ *
22
+ * Connect a channel without buying anything, so a new project can send its first
23
+ * message from /v2. Returns every entry of the connected address (`GET
24
+ * /v2/channels/{address}`).
25
+ *
26
+ * **Where it lands.** Channels are grouped: the entries of `GET /v2/channels` that
27
+ * share a `v1SenderId` are one group, and a group holds one connection per
28
+ * transport. The new channel joins the project's default group when that group
29
+ * does not carry the transport yet; otherwise, or when the project has none, it
30
+ * starts a new group (the first group of a project becomes its default). So in a
31
+ * fresh project every channel connected here lands on the default and `POST
32
+ * /v2/messages` needs no `from`; a second email address or a second bot starts its
33
+ * own group and is used by passing its address as `from`.
34
+ *
35
+ * **Idempotent** for `sms_oneway` and `email`: an address already connected
36
+ * answers `200` with its entries and changes nothing.
37
+ *
38
+ * **Active or not.** One-way SMS is active at once. An email or Telegram
39
+ * connection the plan includes is switched on by itself; one that would cost money
40
+ * is listed with `active: false` and is switched on with `POST
41
+ * /v2/channels/{address}/{type}/activate` (same price and limits as on /v1).
42
+ *
43
+ * A Telegram token that Telegram refuses leaves nothing behind.
44
+ *
45
+ * `POST /v2/channels`
46
+ */
47
+ connect(body: ChannelConnectParams, options?: RequestOptions): APIPromise<ChannelConnectResponse>;
48
+ /**
49
+ * Get the entries of one address
50
+ *
51
+ * Every transport the address carries, one entry each.
52
+ *
53
+ * `GET /v2/channels/{address}`
54
+ */
55
+ retrieve(address: string, options?: RequestOptions): APIPromise<ChannelRetrieveResponse>;
56
+ /**
57
+ * Activate a transport
58
+ *
59
+ * The same switch as **Activate** on Accounts in the dashboard, with the same
60
+ * price and limits: on a paid plan a month is charged at once, stated in
61
+ * `chargedCents` and `monthlyCents`. `activated: false` means it was already on
62
+ * and nothing was charged.
63
+ *
64
+ * `POST /v2/channels/{address}/{type}/activate`
65
+ */
66
+ activate(address: string, type: ActivatableChannel, options?: RequestOptions): APIPromise<ChannelActivateResponse>;
67
+ /**
68
+ * Deactivate a transport
69
+ *
70
+ * Switch the connection off. It stays connected, so activating it again needs no
71
+ * reconnection. The month already paid is not refunded.
72
+ *
73
+ * `POST /v2/channels/{address}/{type}/deactivate`
74
+ */
75
+ deactivate(address: string, type: ActivatableChannel, options?: RequestOptions): APIPromise<ChannelDeactivateResponse>;
76
+ /**
77
+ * Disconnect a channel
78
+ *
79
+ * Disconnect one (address, type). `sms_oneway`, `telegram` and `voice` can be
80
+ * disconnected here. The others answer `409 disconnect_unavailable` saying what to
81
+ * do instead: `whatsapp`, `instagram`, `messenger` and `email` can be switched off
82
+ * with `.../deactivate` (they stay connected); two-way `sms` comes with the
83
+ * address's number.
84
+ *
85
+ * `DELETE /v2/channels/{address}/{type}`
86
+ */
87
+ disconnect(address: string, type: ChannelType, options?: RequestOptions): APIPromise<void>;
88
+ }
89
+ export type ChannelListParams = T.ChannelsListParams;
90
+ export type ChannelEntry = T.ChannelEntry;
91
+ export type ChannelEntriesCursor = Cursor<T.ChannelEntry>;
92
+ export type ChannelConnectParams = T.ChannelsConnectParams;
93
+ export type ChannelConnectResponse = T.ConnectChannelV2Response;
94
+ export type ChannelRetrieveResponse = T.GetChannelV2Response;
95
+ export type ActivatableChannel = T.ActivatableChannel;
96
+ export type ChannelActivateResponse = T.ActivateChannelV2Response;
97
+ export type ChannelDeactivateResponse = T.DeactivateChannelV2Response;
98
+ export declare namespace Channels {
99
+ export { type ActivatableChannel as ActivatableChannel, type ChannelActivateResponse as ChannelActivateResponse, type ChannelConnectParams as ChannelConnectParams, type ChannelConnectResponse as ChannelConnectResponse, type ChannelDeactivateResponse as ChannelDeactivateResponse, type ChannelEntriesCursor as ChannelEntriesCursor, type ChannelEntry as ChannelEntry, type ChannelListParams as ChannelListParams, type ChannelRetrieveResponse as ChannelRetrieveResponse, };
100
+ }
101
+ //# sourceMappingURL=channels.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channels.d.mts","sourceRoot":"","sources":["../../src/v2/resources/channels.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;AACnC,OAAO,EAAE,KAAK,WAAW,EAAE,uBAAmB;AAE9C,sEAAsE;AACtE,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;;;;OAQG;IACH,IAAI,CACF,KAAK,GAAE,iBAAiB,GAAG,IAAI,GAAG,SAAc,EAChD,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,oBAAoB,EAAE,YAAY,CAAC;IAIlD;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2B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W,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}
@@ -0,0 +1,101 @@
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
+ import { type ChannelType } from "./messages.js";
7
+ /** Where the project can send from: one entry per (address, type). */
8
+ export declare class Channels extends APIResource {
9
+ /**
10
+ * List channels
11
+ *
12
+ * Every (address, type) the project can send from, and whether it can send right
13
+ * now. Paginated by sender: a page holds every entry of up to `limit` senders, so
14
+ * it can hold more than `limit` entries.
15
+ *
16
+ * `GET /v2/channels`
17
+ */
18
+ list(query?: ChannelListParams | null | undefined, options?: RequestOptions): PagePromise<ChannelEntriesCursor, ChannelEntry>;
19
+ /**
20
+ * Connect a channel
21
+ *
22
+ * Connect a channel without buying anything, so a new project can send its first
23
+ * message from /v2. Returns every entry of the connected address (`GET
24
+ * /v2/channels/{address}`).
25
+ *
26
+ * **Where it lands.** Channels are grouped: the entries of `GET /v2/channels` that
27
+ * share a `v1SenderId` are one group, and a group holds one connection per
28
+ * transport. The new channel joins the project's default group when that group
29
+ * does not carry the transport yet; otherwise, or when the project has none, it
30
+ * starts a new group (the first group of a project becomes its default). So in a
31
+ * fresh project every channel connected here lands on the default and `POST
32
+ * /v2/messages` needs no `from`; a second email address or a second bot starts its
33
+ * own group and is used by passing its address as `from`.
34
+ *
35
+ * **Idempotent** for `sms_oneway` and `email`: an address already connected
36
+ * answers `200` with its entries and changes nothing.
37
+ *
38
+ * **Active or not.** One-way SMS is active at once. An email or Telegram
39
+ * connection the plan includes is switched on by itself; one that would cost money
40
+ * is listed with `active: false` and is switched on with `POST
41
+ * /v2/channels/{address}/{type}/activate` (same price and limits as on /v1).
42
+ *
43
+ * A Telegram token that Telegram refuses leaves nothing behind.
44
+ *
45
+ * `POST /v2/channels`
46
+ */
47
+ connect(body: ChannelConnectParams, options?: RequestOptions): APIPromise<ChannelConnectResponse>;
48
+ /**
49
+ * Get the entries of one address
50
+ *
51
+ * Every transport the address carries, one entry each.
52
+ *
53
+ * `GET /v2/channels/{address}`
54
+ */
55
+ retrieve(address: string, options?: RequestOptions): APIPromise<ChannelRetrieveResponse>;
56
+ /**
57
+ * Activate a transport
58
+ *
59
+ * The same switch as **Activate** on Accounts in the dashboard, with the same
60
+ * price and limits: on a paid plan a month is charged at once, stated in
61
+ * `chargedCents` and `monthlyCents`. `activated: false` means it was already on
62
+ * and nothing was charged.
63
+ *
64
+ * `POST /v2/channels/{address}/{type}/activate`
65
+ */
66
+ activate(address: string, type: ActivatableChannel, options?: RequestOptions): APIPromise<ChannelActivateResponse>;
67
+ /**
68
+ * Deactivate a transport
69
+ *
70
+ * Switch the connection off. It stays connected, so activating it again needs no
71
+ * reconnection. The month already paid is not refunded.
72
+ *
73
+ * `POST /v2/channels/{address}/{type}/deactivate`
74
+ */
75
+ deactivate(address: string, type: ActivatableChannel, options?: RequestOptions): APIPromise<ChannelDeactivateResponse>;
76
+ /**
77
+ * Disconnect a channel
78
+ *
79
+ * Disconnect one (address, type). `sms_oneway`, `telegram` and `voice` can be
80
+ * disconnected here. The others answer `409 disconnect_unavailable` saying what to
81
+ * do instead: `whatsapp`, `instagram`, `messenger` and `email` can be switched off
82
+ * with `.../deactivate` (they stay connected); two-way `sms` comes with the
83
+ * address's number.
84
+ *
85
+ * `DELETE /v2/channels/{address}/{type}`
86
+ */
87
+ disconnect(address: string, type: ChannelType, options?: RequestOptions): APIPromise<void>;
88
+ }
89
+ export type ChannelListParams = T.ChannelsListParams;
90
+ export type ChannelEntry = T.ChannelEntry;
91
+ export type ChannelEntriesCursor = Cursor<T.ChannelEntry>;
92
+ export type ChannelConnectParams = T.ChannelsConnectParams;
93
+ export type ChannelConnectResponse = T.ConnectChannelV2Response;
94
+ export type ChannelRetrieveResponse = T.GetChannelV2Response;
95
+ export type ActivatableChannel = T.ActivatableChannel;
96
+ export type ChannelActivateResponse = T.ActivateChannelV2Response;
97
+ export type ChannelDeactivateResponse = T.DeactivateChannelV2Response;
98
+ export declare namespace Channels {
99
+ export { type ActivatableChannel as ActivatableChannel, type ChannelActivateResponse as ChannelActivateResponse, type ChannelConnectParams as ChannelConnectParams, type ChannelConnectResponse as ChannelConnectResponse, type ChannelDeactivateResponse as ChannelDeactivateResponse, type ChannelEntriesCursor as ChannelEntriesCursor, type ChannelEntry as ChannelEntry, type ChannelListParams as ChannelListParams, type ChannelRetrieveResponse as ChannelRetrieveResponse, };
100
+ }
101
+ //# sourceMappingURL=channels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../src/v2/resources/channels.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;AACnC,OAAO,EAAE,KAAK,WAAW,EAAE,sBAAmB;AAE9C,sEAAsE;AACtE,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;;;;OAQG;IACH,IAAI,CACF,KAAK,GAAE,iBAAiB,GAAG,IAAI,GAAG,SAAc,EAChD,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,oBAAoB,EAAE,YAAY,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CAAC,2BAA2B,CAAC;AAEtE,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,uBAAuB,IAAI,uBAAuB,GACxD,CAAC;CACH"}
@@ -0,0 +1,107 @@
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.Channels = 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
+ /** Where the project can send from: one entry per (address, type). */
10
+ class Channels extends resource_1.APIResource {
11
+ /**
12
+ * List channels
13
+ *
14
+ * Every (address, type) the project can send from, and whether it can send right
15
+ * now. Paginated by sender: a page holds every entry of up to `limit` senders, so
16
+ * it can hold more than `limit` entries.
17
+ *
18
+ * `GET /v2/channels`
19
+ */
20
+ list(query = {}, options) {
21
+ return this._client.getAPIList('/v2/channels', (pagination_1.Cursor), { query, ...options });
22
+ }
23
+ /**
24
+ * Connect a channel
25
+ *
26
+ * Connect a channel without buying anything, so a new project can send its first
27
+ * message from /v2. Returns every entry of the connected address (`GET
28
+ * /v2/channels/{address}`).
29
+ *
30
+ * **Where it lands.** Channels are grouped: the entries of `GET /v2/channels` that
31
+ * share a `v1SenderId` are one group, and a group holds one connection per
32
+ * transport. The new channel joins the project's default group when that group
33
+ * does not carry the transport yet; otherwise, or when the project has none, it
34
+ * starts a new group (the first group of a project becomes its default). So in a
35
+ * fresh project every channel connected here lands on the default and `POST
36
+ * /v2/messages` needs no `from`; a second email address or a second bot starts its
37
+ * own group and is used by passing its address as `from`.
38
+ *
39
+ * **Idempotent** for `sms_oneway` and `email`: an address already connected
40
+ * answers `200` with its entries and changes nothing.
41
+ *
42
+ * **Active or not.** One-way SMS is active at once. An email or Telegram
43
+ * connection the plan includes is switched on by itself; one that would cost money
44
+ * is listed with `active: false` and is switched on with `POST
45
+ * /v2/channels/{address}/{type}/activate` (same price and limits as on /v1).
46
+ *
47
+ * A Telegram token that Telegram refuses leaves nothing behind.
48
+ *
49
+ * `POST /v2/channels`
50
+ */
51
+ connect(body, options) {
52
+ return this._client.post('/v2/channels', { body, ...options });
53
+ }
54
+ /**
55
+ * Get the entries of one address
56
+ *
57
+ * Every transport the address carries, one entry each.
58
+ *
59
+ * `GET /v2/channels/{address}`
60
+ */
61
+ retrieve(address, options) {
62
+ return this._client.get((0, path_1.path) `/v2/channels/${address}`, options);
63
+ }
64
+ /**
65
+ * Activate a transport
66
+ *
67
+ * The same switch as **Activate** on Accounts in the dashboard, with the same
68
+ * price and limits: on a paid plan a month is charged at once, stated in
69
+ * `chargedCents` and `monthlyCents`. `activated: false` means it was already on
70
+ * and nothing was charged.
71
+ *
72
+ * `POST /v2/channels/{address}/{type}/activate`
73
+ */
74
+ activate(address, type, options) {
75
+ return this._client.post((0, path_1.path) `/v2/channels/${address}/${type}/activate`, options);
76
+ }
77
+ /**
78
+ * Deactivate a transport
79
+ *
80
+ * Switch the connection off. It stays connected, so activating it again needs no
81
+ * reconnection. The month already paid is not refunded.
82
+ *
83
+ * `POST /v2/channels/{address}/{type}/deactivate`
84
+ */
85
+ deactivate(address, type, options) {
86
+ return this._client.post((0, path_1.path) `/v2/channels/${address}/${type}/deactivate`, options);
87
+ }
88
+ /**
89
+ * Disconnect a channel
90
+ *
91
+ * Disconnect one (address, type). `sms_oneway`, `telegram` and `voice` can be
92
+ * disconnected here. The others answer `409 disconnect_unavailable` saying what to
93
+ * do instead: `whatsapp`, `instagram`, `messenger` and `email` can be switched off
94
+ * with `.../deactivate` (they stay connected); two-way `sms` comes with the
95
+ * address's number.
96
+ *
97
+ * `DELETE /v2/channels/{address}/{type}`
98
+ */
99
+ disconnect(address, type, options) {
100
+ return this._client.delete((0, path_1.path) `/v2/channels/${address}/${type}`, {
101
+ ...options,
102
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
103
+ });
104
+ }
105
+ }
106
+ exports.Channels = Channels;
107
+ //# sourceMappingURL=channels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channels.js","sourceRoot":"","sources":["../../src/v2/resources/channels.ts"],"names":[],"mappings":";AAAA,8GAA8G;;;AAE9G,qDAAkD;AAElD,yDAA4D;AAC5D,uDAAsD;AAEtD,uDAAiD;AAIjD,sEAAsE;AACtE,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;;;;;OAQG;IACH,IAAI,CACF,QAA8C,EAAE,EAChD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,CAAA,mBAAoB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,OAAO,CAAC,IAA0B,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,OAAe,EAAE,OAAwB;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,gBAAgB,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;;;;OASG;IACH,QAAQ,CACN,OAAe,EACf,IAAwB,EACxB,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,gBAAgB,OAAO,IAAI,IAAI,WAAW,EAAE,OAAO,CAAC,CAAC;IACpF,CAAC;IAED;;;;;;;OAOG;IACH,UAAU,CACR,OAAe,EACf,IAAwB,EACxB,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,gBAAgB,OAAO,IAAI,IAAI,aAAa,EAAE,OAAO,CAAC,CAAC;IACtF,CAAC;IAED;;;;;;;;;;OAUG;IACH,UAAU,CAAC,OAAe,EAAE,IAAiB,EAAE,OAAwB;QACrE,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,gBAAgB,OAAO,IAAI,IAAI,EAAE,EAAE;YAChE,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;CACF;AA/GD,4BA+GC"}
@@ -0,0 +1,103 @@
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
+ /** Where the project can send from: one entry per (address, type). */
7
+ export class Channels extends APIResource {
8
+ /**
9
+ * List channels
10
+ *
11
+ * Every (address, type) the project can send from, and whether it can send right
12
+ * now. Paginated by sender: a page holds every entry of up to `limit` senders, so
13
+ * it can hold more than `limit` entries.
14
+ *
15
+ * `GET /v2/channels`
16
+ */
17
+ list(query = {}, options) {
18
+ return this._client.getAPIList('/v2/channels', (Cursor), { query, ...options });
19
+ }
20
+ /**
21
+ * Connect a channel
22
+ *
23
+ * Connect a channel without buying anything, so a new project can send its first
24
+ * message from /v2. Returns every entry of the connected address (`GET
25
+ * /v2/channels/{address}`).
26
+ *
27
+ * **Where it lands.** Channels are grouped: the entries of `GET /v2/channels` that
28
+ * share a `v1SenderId` are one group, and a group holds one connection per
29
+ * transport. The new channel joins the project's default group when that group
30
+ * does not carry the transport yet; otherwise, or when the project has none, it
31
+ * starts a new group (the first group of a project becomes its default). So in a
32
+ * fresh project every channel connected here lands on the default and `POST
33
+ * /v2/messages` needs no `from`; a second email address or a second bot starts its
34
+ * own group and is used by passing its address as `from`.
35
+ *
36
+ * **Idempotent** for `sms_oneway` and `email`: an address already connected
37
+ * answers `200` with its entries and changes nothing.
38
+ *
39
+ * **Active or not.** One-way SMS is active at once. An email or Telegram
40
+ * connection the plan includes is switched on by itself; one that would cost money
41
+ * is listed with `active: false` and is switched on with `POST
42
+ * /v2/channels/{address}/{type}/activate` (same price and limits as on /v1).
43
+ *
44
+ * A Telegram token that Telegram refuses leaves nothing behind.
45
+ *
46
+ * `POST /v2/channels`
47
+ */
48
+ connect(body, options) {
49
+ return this._client.post('/v2/channels', { body, ...options });
50
+ }
51
+ /**
52
+ * Get the entries of one address
53
+ *
54
+ * Every transport the address carries, one entry each.
55
+ *
56
+ * `GET /v2/channels/{address}`
57
+ */
58
+ retrieve(address, options) {
59
+ return this._client.get(path `/v2/channels/${address}`, options);
60
+ }
61
+ /**
62
+ * Activate a transport
63
+ *
64
+ * The same switch as **Activate** on Accounts in the dashboard, with the same
65
+ * price and limits: on a paid plan a month is charged at once, stated in
66
+ * `chargedCents` and `monthlyCents`. `activated: false` means it was already on
67
+ * and nothing was charged.
68
+ *
69
+ * `POST /v2/channels/{address}/{type}/activate`
70
+ */
71
+ activate(address, type, options) {
72
+ return this._client.post(path `/v2/channels/${address}/${type}/activate`, options);
73
+ }
74
+ /**
75
+ * Deactivate a transport
76
+ *
77
+ * Switch the connection off. It stays connected, so activating it again needs no
78
+ * reconnection. The month already paid is not refunded.
79
+ *
80
+ * `POST /v2/channels/{address}/{type}/deactivate`
81
+ */
82
+ deactivate(address, type, options) {
83
+ return this._client.post(path `/v2/channels/${address}/${type}/deactivate`, options);
84
+ }
85
+ /**
86
+ * Disconnect a channel
87
+ *
88
+ * Disconnect one (address, type). `sms_oneway`, `telegram` and `voice` can be
89
+ * disconnected here. The others answer `409 disconnect_unavailable` saying what to
90
+ * do instead: `whatsapp`, `instagram`, `messenger` and `email` can be switched off
91
+ * with `.../deactivate` (they stay connected); two-way `sms` comes with the
92
+ * address's number.
93
+ *
94
+ * `DELETE /v2/channels/{address}/{type}`
95
+ */
96
+ disconnect(address, type, options) {
97
+ return this._client.delete(path `/v2/channels/${address}/${type}`, {
98
+ ...options,
99
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
100
+ });
101
+ }
102
+ }
103
+ //# sourceMappingURL=channels.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channels.mjs","sourceRoot":"","sources":["../../src/v2/resources/channels.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;AAIjD,sEAAsE;AACtE,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;;;;;;OAQG;IACH,IAAI,CACF,QAA8C,EAAE,EAChD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,CAAA,MAAoB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,OAAO,CAAC,IAA0B,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,OAAe,EAAE,OAAwB;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,gBAAgB,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;;;;OASG;IACH,QAAQ,CACN,OAAe,EACf,IAAwB,EACxB,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,gBAAgB,OAAO,IAAI,IAAI,WAAW,EAAE,OAAO,CAAC,CAAC;IACpF,CAAC;IAED;;;;;;;OAOG;IACH,UAAU,CACR,OAAe,EACf,IAAwB,EACxB,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,gBAAgB,OAAO,IAAI,IAAI,aAAa,EAAE,OAAO,CAAC,CAAC;IACtF,CAAC;IAED;;;;;;;;;;OAUG;IACH,UAAU,CAAC,OAAe,EAAE,IAAiB,EAAE,OAAwB;QACrE,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,gBAAgB,OAAO,IAAI,IAAI,EAAE,EAAE;YAChE,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,62 @@
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
+ /** Contacts and the identifiers they are reached at. */
7
+ export declare class Contacts extends APIResource {
8
+ /**
9
+ * List contacts
10
+ *
11
+ * List contacts with their channels. A repeated `tag` means all of them.
12
+ *
13
+ * `GET /v2/contacts`
14
+ */
15
+ list(query?: ContactListParams | null | undefined, options?: RequestOptions): PagePromise<ContactsCursor, Contact>;
16
+ /**
17
+ * Create a contact
18
+ *
19
+ * Create a contact with one or more channels. An identifier another contact
20
+ * already holds on the same channel is refused (`400 duplicate_identifier`, with
21
+ * `details.conflicts[{channel, identifier, contactId}]`); update the existing
22
+ * contact with `PATCH /v2/contacts/{contactId}` instead.
23
+ *
24
+ * `POST /v2/contacts`
25
+ */
26
+ create(body: ContactCreateParams, options?: RequestOptions): APIPromise<ContactCreateResponse>;
27
+ /**
28
+ * Get a contact
29
+ *
30
+ * `GET /v2/contacts/{contactId}`
31
+ */
32
+ retrieve(contactID: string, options?: RequestOptions): APIPromise<ContactRetrieveResponse>;
33
+ /**
34
+ * Update a contact
35
+ *
36
+ * `PATCH /v2/contacts/{contactId}`
37
+ */
38
+ update(contactID: string, body?: ContactUpdateParams | null | undefined, options?: RequestOptions): APIPromise<ContactUpdateResponse>;
39
+ /**
40
+ * Delete a contact
41
+ *
42
+ * Permanently delete a contact and its channels (right to erasure). Conversations,
43
+ * message history and campaign delivery logs are kept and no longer reference it.
44
+ *
45
+ * `DELETE /v2/contacts/{contactId}`
46
+ */
47
+ delete(contactID: string, options?: RequestOptions): APIPromise<void>;
48
+ }
49
+ export type ContactListParams = T.ContactsListParams;
50
+ export type Contact = T.Contact;
51
+ export type ContactsCursor = Cursor<T.Contact>;
52
+ export type ContactChannel = T.ContactChannel;
53
+ export type ContactCreateParams = T.ContactsCreateParams;
54
+ export type ContactCreateResponse = T.Contact;
55
+ export type ContactChannelInput = T.ContactChannelInput;
56
+ export type ContactRetrieveResponse = T.Contact;
57
+ export type ContactUpdateParams = T.ContactsUpdateParams;
58
+ export type ContactUpdateResponse = T.Contact;
59
+ export declare namespace Contacts {
60
+ export { type Contact as Contact, type ContactChannel as ContactChannel, type ContactChannelInput as ContactChannelInput, type ContactCreateParams as ContactCreateParams, type ContactCreateResponse as ContactCreateResponse, type ContactListParams as ContactListParams, type ContactRetrieveResponse as ContactRetrieveResponse, type ContactUpdateParams as ContactUpdateParams, type ContactUpdateResponse as ContactUpdateResponse, type ContactsCursor as ContactsCursor, };
61
+ }
62
+ //# sourceMappingURL=contacts.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contacts.d.mts","sourceRoot":"","sources":["../../src/v2/resources/contacts.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,wDAAwD;AACxD,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;;OAMG;IACH,IAAI,CACF,KAAK,GAAE,iBAAiB,GAAG,IAAI,GAAG,SAAc,EAChD,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,cAAc,EAAE,OAAO,CAAC;IAIvC;;;;;;;;;OASG;IACH,MAAM,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,qBAAqB,CAAC;IAI9F;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,uBAAuB,CAAC;IAI1F;;;;OAIG;IACH,MAAM,CACJ,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE,mBAAmB,GAAG,IAAI,GAAG,SAAc,EACjD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,qBAAqB,CAAC;IAIpC;;;;;;;OAOG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;CAMtE;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,kBAAkB,CAAC;AAErD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;AAEhC,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AAE/C,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,cAAc,CAAC;AAE9C,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,oBAAoB,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,OAAO,CAAC;AAE9C,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,mBAAmB,CAAC;AAExD,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,OAAO,CAAC;AAEhD,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,oBAAoB,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,OAAO,CAAC;AAE9C,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,OAAO,IAAI,OAAO,EACvB,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,cAAc,IAAI,cAAc,GACtC,CAAC;CACH"}
@@ -0,0 +1,62 @@
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
+ /** Contacts and the identifiers they are reached at. */
7
+ export declare class Contacts extends APIResource {
8
+ /**
9
+ * List contacts
10
+ *
11
+ * List contacts with their channels. A repeated `tag` means all of them.
12
+ *
13
+ * `GET /v2/contacts`
14
+ */
15
+ list(query?: ContactListParams | null | undefined, options?: RequestOptions): PagePromise<ContactsCursor, Contact>;
16
+ /**
17
+ * Create a contact
18
+ *
19
+ * Create a contact with one or more channels. An identifier another contact
20
+ * already holds on the same channel is refused (`400 duplicate_identifier`, with
21
+ * `details.conflicts[{channel, identifier, contactId}]`); update the existing
22
+ * contact with `PATCH /v2/contacts/{contactId}` instead.
23
+ *
24
+ * `POST /v2/contacts`
25
+ */
26
+ create(body: ContactCreateParams, options?: RequestOptions): APIPromise<ContactCreateResponse>;
27
+ /**
28
+ * Get a contact
29
+ *
30
+ * `GET /v2/contacts/{contactId}`
31
+ */
32
+ retrieve(contactID: string, options?: RequestOptions): APIPromise<ContactRetrieveResponse>;
33
+ /**
34
+ * Update a contact
35
+ *
36
+ * `PATCH /v2/contacts/{contactId}`
37
+ */
38
+ update(contactID: string, body?: ContactUpdateParams | null | undefined, options?: RequestOptions): APIPromise<ContactUpdateResponse>;
39
+ /**
40
+ * Delete a contact
41
+ *
42
+ * Permanently delete a contact and its channels (right to erasure). Conversations,
43
+ * message history and campaign delivery logs are kept and no longer reference it.
44
+ *
45
+ * `DELETE /v2/contacts/{contactId}`
46
+ */
47
+ delete(contactID: string, options?: RequestOptions): APIPromise<void>;
48
+ }
49
+ export type ContactListParams = T.ContactsListParams;
50
+ export type Contact = T.Contact;
51
+ export type ContactsCursor = Cursor<T.Contact>;
52
+ export type ContactChannel = T.ContactChannel;
53
+ export type ContactCreateParams = T.ContactsCreateParams;
54
+ export type ContactCreateResponse = T.Contact;
55
+ export type ContactChannelInput = T.ContactChannelInput;
56
+ export type ContactRetrieveResponse = T.Contact;
57
+ export type ContactUpdateParams = T.ContactsUpdateParams;
58
+ export type ContactUpdateResponse = T.Contact;
59
+ export declare namespace Contacts {
60
+ export { type Contact as Contact, type ContactChannel as ContactChannel, type ContactChannelInput as ContactChannelInput, type ContactCreateParams as ContactCreateParams, type ContactCreateResponse as ContactCreateResponse, type ContactListParams as ContactListParams, type ContactRetrieveResponse as ContactRetrieveResponse, type ContactUpdateParams as ContactUpdateParams, type ContactUpdateResponse as ContactUpdateResponse, type ContactsCursor as ContactsCursor, };
61
+ }
62
+ //# sourceMappingURL=contacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contacts.d.ts","sourceRoot":"","sources":["../../src/v2/resources/contacts.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,wDAAwD;AACxD,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;;OAMG;IACH,IAAI,CACF,KAAK,GAAE,iBAAiB,GAAG,IAAI,GAAG,SAAc,EAChD,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,cAAc,EAAE,OAAO,CAAC;IAIvC;;;;;;;;;OASG;IACH,MAAM,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,qBAAqB,CAAC;IAI9F;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,uBAAuB,CAAC;IAI1F;;;;OAIG;IACH,MAAM,CACJ,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE,mBAAmB,GAAG,IAAI,GAAG,SAAc,EACjD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,qBAAqB,CAAC;IAIpC;;;;;;;OAOG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;CAMtE;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,kBAAkB,CAAC;AAErD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;AAEhC,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AAE/C,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,cAAc,CAAC;AAE9C,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,oBAAoB,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,OAAO,CAAC;AAE9C,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,mBAAmB,CAAC;AAExD,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,OAAO,CAAC;AAEhD,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,oBAAoB,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,OAAO,CAAC;AAE9C,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,OAAO,IAAI,OAAO,EACvB,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,cAAc,IAAI,cAAc,GACtC,CAAC;CACH"}
@@ -0,0 +1,66 @@
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.Contacts = 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
+ /** Contacts and the identifiers they are reached at. */
10
+ class Contacts extends resource_1.APIResource {
11
+ /**
12
+ * List contacts
13
+ *
14
+ * List contacts with their channels. A repeated `tag` means all of them.
15
+ *
16
+ * `GET /v2/contacts`
17
+ */
18
+ list(query = {}, options) {
19
+ return this._client.getAPIList('/v2/contacts', (pagination_1.Cursor), { query, ...options });
20
+ }
21
+ /**
22
+ * Create a contact
23
+ *
24
+ * Create a contact with one or more channels. An identifier another contact
25
+ * already holds on the same channel is refused (`400 duplicate_identifier`, with
26
+ * `details.conflicts[{channel, identifier, contactId}]`); update the existing
27
+ * contact with `PATCH /v2/contacts/{contactId}` instead.
28
+ *
29
+ * `POST /v2/contacts`
30
+ */
31
+ create(body, options) {
32
+ return this._client.post('/v2/contacts', { body, ...options });
33
+ }
34
+ /**
35
+ * Get a contact
36
+ *
37
+ * `GET /v2/contacts/{contactId}`
38
+ */
39
+ retrieve(contactID, options) {
40
+ return this._client.get((0, path_1.path) `/v2/contacts/${contactID}`, options);
41
+ }
42
+ /**
43
+ * Update a contact
44
+ *
45
+ * `PATCH /v2/contacts/{contactId}`
46
+ */
47
+ update(contactID, body = {}, options) {
48
+ return this._client.patch((0, path_1.path) `/v2/contacts/${contactID}`, { body, ...options });
49
+ }
50
+ /**
51
+ * Delete a contact
52
+ *
53
+ * Permanently delete a contact and its channels (right to erasure). Conversations,
54
+ * message history and campaign delivery logs are kept and no longer reference it.
55
+ *
56
+ * `DELETE /v2/contacts/{contactId}`
57
+ */
58
+ delete(contactID, options) {
59
+ return this._client.delete((0, path_1.path) `/v2/contacts/${contactID}`, {
60
+ ...options,
61
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
62
+ });
63
+ }
64
+ }
65
+ exports.Contacts = Contacts;
66
+ //# sourceMappingURL=contacts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contacts.js","sourceRoot":"","sources":["../../src/v2/resources/contacts.ts"],"names":[],"mappings":";AAAA,8GAA8G;;;AAE9G,qDAAkD;AAElD,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