@zavudev/sdk 0.58.1 → 0.59.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/CHANGELOG.md +27 -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 +29 -12
  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 +2429 -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 +29 -12
  38. package/types.d.mts.map +1 -1
  39. package/types.d.ts +29 -12
  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 +2188 -0
  194. package/v2/types.d.mts.map +1 -0
  195. package/v2/types.d.ts +2188 -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,112 @@
1
+ // Generated by zavu-codegen from apps/docs/api-reference/v2/openapi.json. Do not edit: run `bun run codegen`.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { Cursor, PagePromise } from '../../core/pagination';
6
+ import { buildHeaders } from '../../internal/headers';
7
+ import { RequestOptions } from '../../internal/request-options';
8
+ import { path } from '../../internal/utils/path';
9
+ import type * as T from '../types';
10
+
11
+ /** Contacts and the identifiers they are reached at. */
12
+ export class Contacts extends APIResource {
13
+ /**
14
+ * List contacts
15
+ *
16
+ * List contacts with their channels. A repeated `tag` means all of them.
17
+ *
18
+ * `GET /v2/contacts`
19
+ */
20
+ list(
21
+ query: ContactListParams | null | undefined = {},
22
+ options?: RequestOptions,
23
+ ): PagePromise<ContactsCursor, Contact> {
24
+ return this._client.getAPIList('/v2/contacts', Cursor<Contact>, { query, ...options });
25
+ }
26
+
27
+ /**
28
+ * Create a contact
29
+ *
30
+ * Create a contact with one or more channels. An identifier another contact
31
+ * already holds on the same channel is refused (`400 duplicate_identifier`, with
32
+ * `details.conflicts[{channel, identifier, contactId}]`); update the existing
33
+ * contact with `PATCH /v2/contacts/{contactId}` instead.
34
+ *
35
+ * `POST /v2/contacts`
36
+ */
37
+ create(body: ContactCreateParams, options?: RequestOptions): APIPromise<ContactCreateResponse> {
38
+ return this._client.post('/v2/contacts', { body, ...options });
39
+ }
40
+
41
+ /**
42
+ * Get a contact
43
+ *
44
+ * `GET /v2/contacts/{contactId}`
45
+ */
46
+ retrieve(contactID: string, options?: RequestOptions): APIPromise<ContactRetrieveResponse> {
47
+ return this._client.get(path`/v2/contacts/${contactID}`, options);
48
+ }
49
+
50
+ /**
51
+ * Update a contact
52
+ *
53
+ * `PATCH /v2/contacts/{contactId}`
54
+ */
55
+ update(
56
+ contactID: string,
57
+ body: ContactUpdateParams | null | undefined = {},
58
+ options?: RequestOptions,
59
+ ): APIPromise<ContactUpdateResponse> {
60
+ return this._client.patch(path`/v2/contacts/${contactID}`, { body, ...options });
61
+ }
62
+
63
+ /**
64
+ * Delete a contact
65
+ *
66
+ * Permanently delete a contact and its channels (right to erasure). Conversations,
67
+ * message history and campaign delivery logs are kept and no longer reference it.
68
+ *
69
+ * `DELETE /v2/contacts/{contactId}`
70
+ */
71
+ delete(contactID: string, options?: RequestOptions): APIPromise<void> {
72
+ return this._client.delete(path`/v2/contacts/${contactID}`, {
73
+ ...options,
74
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
75
+ });
76
+ }
77
+ }
78
+
79
+ export type ContactListParams = T.ContactsListParams;
80
+
81
+ export type Contact = T.Contact;
82
+
83
+ export type ContactsCursor = Cursor<T.Contact>;
84
+
85
+ export type ContactChannel = T.ContactChannel;
86
+
87
+ export type ContactCreateParams = T.ContactsCreateParams;
88
+
89
+ export type ContactCreateResponse = T.Contact;
90
+
91
+ export type ContactChannelInput = T.ContactChannelInput;
92
+
93
+ export type ContactRetrieveResponse = T.Contact;
94
+
95
+ export type ContactUpdateParams = T.ContactsUpdateParams;
96
+
97
+ export type ContactUpdateResponse = T.Contact;
98
+
99
+ export declare namespace Contacts {
100
+ export {
101
+ type Contact as Contact,
102
+ type ContactChannel as ContactChannel,
103
+ type ContactChannelInput as ContactChannelInput,
104
+ type ContactCreateParams as ContactCreateParams,
105
+ type ContactCreateResponse as ContactCreateResponse,
106
+ type ContactListParams as ContactListParams,
107
+ type ContactRetrieveResponse as ContactRetrieveResponse,
108
+ type ContactUpdateParams as ContactUpdateParams,
109
+ type ContactUpdateResponse as ContactUpdateResponse,
110
+ type ContactsCursor as ContactsCursor,
111
+ };
112
+ }
@@ -0,0 +1,89 @@
1
+ // Generated by zavu-codegen from apps/docs/api-reference/v2/openapi.json. Do not edit: run `bun run codegen`.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { Cursor, PagePromise } from '../../core/pagination';
6
+ import { RequestOptions } from '../../internal/request-options';
7
+ import { path } from '../../internal/utils/path';
8
+ import type * as T from '../types';
9
+ import { type Message, type MessagesCursor } from './messages';
10
+
11
+ /** Inbox threads, one per contact across channels. */
12
+ export class Conversations extends APIResource {
13
+ /**
14
+ * List conversations
15
+ *
16
+ * List inbox threads, most recently active first. Filter by `from` (one of your
17
+ * addresses) and `channel`. Each conversation carries `from`, the address it was
18
+ * last handled from.
19
+ *
20
+ * `GET /v2/conversations`
21
+ */
22
+ list(
23
+ query: ConversationListParams | null | undefined = {},
24
+ options?: RequestOptions,
25
+ ): PagePromise<ConversationsCursor, Conversation> {
26
+ return this._client.getAPIList('/v2/conversations', Cursor<Conversation>, { query, ...options });
27
+ }
28
+
29
+ /**
30
+ * Get a conversation
31
+ *
32
+ * `GET /v2/conversations/{conversationId}`
33
+ */
34
+ retrieve(conversationID: string, options?: RequestOptions): APIPromise<ConversationRetrieveResponse> {
35
+ return this._client.get(path`/v2/conversations/${conversationID}`, options);
36
+ }
37
+
38
+ /**
39
+ * List a conversation's messages
40
+ *
41
+ * Reply with `POST /v2/messages` and this `conversationId`.
42
+ *
43
+ * `GET /v2/conversations/{conversationId}/messages`
44
+ */
45
+ listMessages(
46
+ conversationID: string,
47
+ query: ConversationListMessagesParams | null | undefined = {},
48
+ options?: RequestOptions,
49
+ ): PagePromise<MessagesCursor, Message> {
50
+ return this._client.getAPIList(path`/v2/conversations/${conversationID}/messages`, Cursor<Message>, {
51
+ query,
52
+ ...options,
53
+ });
54
+ }
55
+
56
+ /**
57
+ * Mark a conversation read
58
+ *
59
+ * Resets `unreadCount` in your inbox. Sends no read receipt to the contact.
60
+ *
61
+ * `POST /v2/conversations/{conversationId}/read`
62
+ */
63
+ markAsRead(conversationID: string, options?: RequestOptions): APIPromise<ConversationMarkAsReadResponse> {
64
+ return this._client.post(path`/v2/conversations/${conversationID}/read`, options);
65
+ }
66
+ }
67
+
68
+ export type ConversationListParams = T.ConversationsListParams;
69
+
70
+ export type Conversation = T.Conversation;
71
+
72
+ export type ConversationsCursor = Cursor<T.Conversation>;
73
+
74
+ export type ConversationRetrieveResponse = T.GetConversationV2Response;
75
+
76
+ export type ConversationListMessagesParams = T.ConversationsListMessagesParams;
77
+
78
+ export type ConversationMarkAsReadResponse = T.MarkConversationReadV2Response;
79
+
80
+ export declare namespace Conversations {
81
+ export {
82
+ type Conversation as Conversation,
83
+ type ConversationListMessagesParams as ConversationListMessagesParams,
84
+ type ConversationListParams as ConversationListParams,
85
+ type ConversationMarkAsReadResponse as ConversationMarkAsReadResponse,
86
+ type ConversationRetrieveResponse as ConversationRetrieveResponse,
87
+ type ConversationsCursor as ConversationsCursor,
88
+ };
89
+ }
@@ -0,0 +1,107 @@
1
+ // Generated by zavu-codegen from apps/docs/api-reference/v2/openapi.json. Do not edit: run `bun run codegen`.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { buildHeaders } from '../../internal/headers';
6
+ import { RequestOptions } from '../../internal/request-options';
7
+ import { path } from '../../internal/utils/path';
8
+ import type * as T from '../types';
9
+
10
+ /** Domains to send email from. */
11
+ export class EmailDomains extends APIResource {
12
+ /**
13
+ * List email domains
14
+ *
15
+ * Email domains of this project.
16
+ *
17
+ * `GET /v2/email-domains`
18
+ */
19
+ list(options?: RequestOptions): APIPromise<EmailDomainListResponse> {
20
+ return this._client.get('/v2/email-domains', options);
21
+ }
22
+
23
+ /**
24
+ * Add an email domain
25
+ *
26
+ * Add a domain to send email from. `domain` is validated first: a bare domain (a
27
+ * leading `https://` and a trailing path are dropped); anything else, spaces
28
+ * included, is `400` with `details.errors[0].path` `["domain"]`. Adding a domain
29
+ * the project already has returns it with `200` (nothing created), like `POST
30
+ * /v2/channels`.
31
+ *
32
+ * Returns the DNS records to publish; the DKIM CNAMEs are required. If they could
33
+ * not be generated, the domain is still created (`201`) but comes back
34
+ * `verifiable: false` with `setupError`: remove it and add it again, or contact
35
+ * support. Verify cannot fix it.
36
+ *
37
+ * Publish the records exactly as returned, verify, then connect an address with
38
+ * `POST /v2/channels {"type":"email"}`.
39
+ *
40
+ * `POST /v2/email-domains`
41
+ */
42
+ create(body: EmailDomainCreateParams, options?: RequestOptions): APIPromise<EmailDomainCreateResponse> {
43
+ return this._client.post('/v2/email-domains', { body, ...options });
44
+ }
45
+
46
+ /**
47
+ * Get an email domain
48
+ *
49
+ * The domain with its DNS records and status.
50
+ *
51
+ * `GET /v2/email-domains/{emailDomainId}`
52
+ */
53
+ retrieve(emailDomainID: string, options?: RequestOptions): APIPromise<EmailDomainRetrieveResponse> {
54
+ return this._client.get(path`/v2/email-domains/${emailDomainID}`, options);
55
+ }
56
+
57
+ /**
58
+ * Remove an email domain
59
+ *
60
+ * `DELETE /v2/email-domains/{emailDomainId}`
61
+ */
62
+ delete(emailDomainID: string, options?: RequestOptions): APIPromise<void> {
63
+ return this._client.delete(path`/v2/email-domains/${emailDomainID}`, {
64
+ ...options,
65
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
66
+ });
67
+ }
68
+
69
+ /**
70
+ * Verify an email domain
71
+ *
72
+ * Re-check the domain's DNS records and refresh its status. `404` only for a
73
+ * domain that is not this project's; `503 verification_unavailable` when the check
74
+ * could not run (nothing changed, retry). A domain with no DKIM records
75
+ * (`verifiable: false`) cannot verify whatever DNS says: verify runs the check (it
76
+ * may recover the records), and when the domain still has none it answers `409
77
+ * domain_setup_failed` with the same `setupError` the domain carries.
78
+ *
79
+ * `POST /v2/email-domains/{emailDomainId}/verify`
80
+ */
81
+ verify(emailDomainID: string, options?: RequestOptions): APIPromise<EmailDomainVerifyResponse> {
82
+ return this._client.post(path`/v2/email-domains/${emailDomainID}/verify`, options);
83
+ }
84
+ }
85
+
86
+ export type EmailDomainListResponse = T.ListEmailDomainsV2Response;
87
+
88
+ export type EmailDomain = T.EmailDomain;
89
+
90
+ export type EmailDomainCreateParams = T.EmailDomainsCreateParams;
91
+
92
+ export type EmailDomainCreateResponse = T.AddEmailDomainV2Response;
93
+
94
+ export type EmailDomainRetrieveResponse = T.GetEmailDomainV2Response;
95
+
96
+ export type EmailDomainVerifyResponse = T.VerifyEmailDomainV2Response;
97
+
98
+ export declare namespace EmailDomains {
99
+ export {
100
+ type EmailDomain as EmailDomain,
101
+ type EmailDomainCreateParams as EmailDomainCreateParams,
102
+ type EmailDomainCreateResponse as EmailDomainCreateResponse,
103
+ type EmailDomainListResponse as EmailDomainListResponse,
104
+ type EmailDomainRetrieveResponse as EmailDomainRetrieveResponse,
105
+ type EmailDomainVerifyResponse as EmailDomainVerifyResponse,
106
+ };
107
+ }
@@ -0,0 +1,73 @@
1
+ // Generated by zavu-codegen from apps/docs/api-reference/v2/openapi.json. Do not edit: run `bun run codegen`.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { Cursor, PagePromise } from '../../core/pagination';
6
+ import { RequestOptions } from '../../internal/request-options';
7
+ import { path } from '../../internal/utils/path';
8
+ import type * as T from '../types';
9
+
10
+ /** Configure Zavu Functions. */
11
+ export class Functions extends APIResource {
12
+ /**
13
+ * List functions
14
+ *
15
+ * The project's functions, newest first.
16
+ *
17
+ * `GET /v2/functions`
18
+ */
19
+ list(
20
+ query: FunctionListParams | null | undefined = {},
21
+ options?: RequestOptions,
22
+ ): PagePromise<ZavuFunctionsCursor, ZavuFunction> {
23
+ return this._client.getAPIList('/v2/functions', Cursor<ZavuFunction>, { query, ...options });
24
+ }
25
+
26
+ /**
27
+ * Get a function
28
+ *
29
+ * `GET /v2/functions/{functionId}`
30
+ */
31
+ retrieve(functionID: string, options?: RequestOptions): APIPromise<FunctionRetrieveResponse> {
32
+ return this._client.get(path`/v2/functions/${functionID}`, options);
33
+ }
34
+
35
+ /**
36
+ * Configure a function
37
+ *
38
+ * Name, description, timeout, memory, architecture, pause and the HTTP endpoint,
39
+ * with the same rules as the dashboard's Settings tab.
40
+ *
41
+ * `PATCH /v2/functions/{functionId}`
42
+ */
43
+ update(
44
+ functionID: string,
45
+ body: FunctionUpdateParams | null | undefined = {},
46
+ options?: RequestOptions,
47
+ ): APIPromise<FunctionUpdateResponse> {
48
+ return this._client.patch(path`/v2/functions/${functionID}`, { body, ...options });
49
+ }
50
+ }
51
+
52
+ export type FunctionListParams = T.FunctionsListParams;
53
+
54
+ export type ZavuFunction = T.ZavuFunction;
55
+
56
+ export type ZavuFunctionsCursor = Cursor<T.ZavuFunction>;
57
+
58
+ export type FunctionRetrieveResponse = T.GetFunctionV2Response;
59
+
60
+ export type FunctionUpdateParams = T.FunctionsUpdateParams;
61
+
62
+ export type FunctionUpdateResponse = T.UpdateFunctionV2Response;
63
+
64
+ export declare namespace Functions {
65
+ export {
66
+ type FunctionListParams as FunctionListParams,
67
+ type FunctionRetrieveResponse as FunctionRetrieveResponse,
68
+ type FunctionUpdateParams as FunctionUpdateParams,
69
+ type FunctionUpdateResponse as FunctionUpdateResponse,
70
+ type ZavuFunction as ZavuFunction,
71
+ type ZavuFunctionsCursor as ZavuFunctionsCursor,
72
+ };
73
+ }
@@ -0,0 +1,138 @@
1
+ // Generated by zavu-codegen from apps/docs/api-reference/v2/openapi.json. Do not edit: run `bun run codegen`.
2
+
3
+ export {
4
+ Messages,
5
+ type MessageSendParams,
6
+ type MessageSendResponse,
7
+ type ChannelTypeRequest,
8
+ type EmailAttachmentInput,
9
+ type Message,
10
+ type MessageContent,
11
+ type MessageType,
12
+ type Routing,
13
+ type SendMessageResponse,
14
+ type MessageListParams,
15
+ type MessagesCursor,
16
+ type ChannelType,
17
+ type MessageStatus,
18
+ type MessageRetrieveResponse,
19
+ } from './messages';
20
+ export {
21
+ Conversations,
22
+ type ConversationListParams,
23
+ type Conversation,
24
+ type ConversationsCursor,
25
+ type ConversationRetrieveResponse,
26
+ type ConversationListMessagesParams,
27
+ type ConversationMarkAsReadResponse,
28
+ } from './conversations';
29
+ export {
30
+ Contacts,
31
+ type ContactListParams,
32
+ type Contact,
33
+ type ContactsCursor,
34
+ type ContactChannel,
35
+ type ContactCreateParams,
36
+ type ContactCreateResponse,
37
+ type ContactChannelInput,
38
+ type ContactRetrieveResponse,
39
+ type ContactUpdateParams,
40
+ type ContactUpdateResponse,
41
+ } from './contacts';
42
+ export {
43
+ Channels,
44
+ type ChannelListParams,
45
+ type ChannelEntry,
46
+ type ChannelEntriesCursor,
47
+ type ChannelConnectParams,
48
+ type ChannelConnectResponse,
49
+ type ChannelRetrieveResponse,
50
+ type ActivatableChannel,
51
+ type ChannelActivateResponse,
52
+ type ChannelDeactivateResponse,
53
+ } from './channels';
54
+ export {
55
+ Templates,
56
+ type TemplateListParams,
57
+ type Template,
58
+ type TemplatesCursor,
59
+ type WhatsAppCategory,
60
+ type TemplateCreateParams,
61
+ type TemplateCreateResponse,
62
+ type TemplateRetrieveResponse,
63
+ type TemplateSubmitParams,
64
+ type TemplateSubmitResponse,
65
+ } from './templates';
66
+ export {
67
+ Campaigns,
68
+ type CampaignListParams,
69
+ type Broadcast,
70
+ type BroadcastsCursor,
71
+ type BroadcastChannel,
72
+ type BroadcastContent,
73
+ type BroadcastMessageType,
74
+ type BroadcastStatus,
75
+ type CampaignCreateParams,
76
+ type CampaignCreateResponse,
77
+ type CampaignRetrieveResponse,
78
+ type CampaignSendParams,
79
+ type CampaignSendResponse,
80
+ type CampaignProgressResponse,
81
+ type BroadcastProgress,
82
+ type CampaignCancelResponse,
83
+ } from './campaigns/campaigns';
84
+ export {
85
+ Webhook,
86
+ type WebhookRetrieveResponse,
87
+ type ProjectWebhookV2,
88
+ type SenderWebhookV1,
89
+ type WebhookSetParams,
90
+ type WebhookSetResponse,
91
+ type WebhookEvent,
92
+ type WebhookSignatureVersion,
93
+ type WebhookRotateSecretResponse,
94
+ } from './webhook';
95
+ export {
96
+ Agents,
97
+ type AgentListParams,
98
+ type Agent,
99
+ type AgentsCursor,
100
+ type AgentProvider,
101
+ type AgentVoiceConfig,
102
+ type AgentCreateParams,
103
+ type AgentCreateResponse,
104
+ type AgentRetrieveResponse,
105
+ type AgentUpdateParams,
106
+ type AgentUpdateResponse,
107
+ type AgentTestParams,
108
+ type AgentTestResponse,
109
+ } from './agents/agents';
110
+ export {
111
+ Numbers,
112
+ type NumberSearchAvailableParams,
113
+ type NumberSearchAvailableResponse,
114
+ type AvailablePhoneNumber,
115
+ type PhoneNumberType,
116
+ type NumberPurchaseParams,
117
+ type NumberPurchaseResponse,
118
+ type ErrorBody,
119
+ type OwnedPhoneNumber,
120
+ } from './numbers';
121
+ export {
122
+ EmailDomains,
123
+ type EmailDomainListResponse,
124
+ type EmailDomain,
125
+ type EmailDomainCreateParams,
126
+ type EmailDomainCreateResponse,
127
+ type EmailDomainRetrieveResponse,
128
+ type EmailDomainVerifyResponse,
129
+ } from './email-domains';
130
+ export {
131
+ Functions,
132
+ type FunctionListParams,
133
+ type ZavuFunction,
134
+ type ZavuFunctionsCursor,
135
+ type FunctionRetrieveResponse,
136
+ type FunctionUpdateParams,
137
+ type FunctionUpdateResponse,
138
+ } from './functions';
@@ -0,0 +1,129 @@
1
+ // Generated by zavu-codegen from apps/docs/api-reference/v2/openapi.json. Do not edit: run `bun run codegen`.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { Cursor, PagePromise } from '../../core/pagination';
6
+ import { RequestOptions } from '../../internal/request-options';
7
+ import { path } from '../../internal/utils/path';
8
+ import type * as T from '../types';
9
+
10
+ /** Send, list and read messages. */
11
+ export class Messages extends APIResource {
12
+ /**
13
+ * Send a message
14
+ *
15
+ * Send one message. The body is the /v1 message body plus `from` and
16
+ * `conversationId`. There is no `Zavu-Sender` header.
17
+ *
18
+ * **Where it leaves from:** `conversationId` if given, else `from` (an address),
19
+ * else the project default. See `from` for ambiguous addresses.
20
+ *
21
+ * **Which transport:** decided by the first branch that applies, and reported in
22
+ * `routing.reason`: a test-mode key uses the WhatsApp sandbox; an email-address
23
+ * `to` uses email; a WhatsApp-only `messageType` uses WhatsApp; an explicit
24
+ * `channel` is used as given; otherwise the fixed order over the sender's ACTIVE
25
+ * transports (for a phone number: WhatsApp, then SMS, then one-way SMS). The order
26
+ * ignores price and the 24-hour window. A `channel` that contradicts the recipient
27
+ * (an email `to` on anything but `email`, or `channel: "email"` with a phone
28
+ * number or chat id) or a WhatsApp-only `messageType` is refused with `400`; /v1
29
+ * overrides the first and last silently.
30
+ *
31
+ * **When nothing can send** the answer is always `409 no_channel`, whatever the
32
+ * reason: no channel at all, an explicit `channel` that is not connected, an email
33
+ * `to` without an email channel, a WhatsApp-only `messageType` without WhatsApp.
34
+ * `details.connect` lists what this project can connect to reach `to`, with the
35
+ * exact call for each (`POST /v2/channels`, `POST /v2/numbers`), and the message
36
+ * never names an address that carries nothing.
37
+ *
38
+ * **Fallback** from WhatsApp to SMS, when enabled, happens after this call
39
+ * returned, once the WhatsApp send fails. It is not visible in `routing`; read
40
+ * `attemptedChannels` on the message or wait for the webhooks. Before falling back
41
+ * to SMS, a message sent through /v2 is checked for an approved 10DLC campaign (+1
42
+ * numbers) and an active connection; when either is missing it stays `failed` with
43
+ * `errorCode` `TEN_DLC_REQUIRED` or `CHANNEL_INACTIVE`.
44
+ *
45
+ * Limits, risk review, pricing and verification are exactly /v1's: see `POST
46
+ * /v1/messages`.
47
+ *
48
+ * `POST /v2/messages`
49
+ */
50
+ send(
51
+ body: MessageSendParams | null | undefined = {},
52
+ options?: RequestOptions,
53
+ ): APIPromise<MessageSendResponse> {
54
+ return this._client.post('/v2/messages', { body, ...options });
55
+ }
56
+
57
+ /**
58
+ * List messages
59
+ *
60
+ * List messages of this project, newest first.
61
+ *
62
+ * `GET /v2/messages`
63
+ */
64
+ list(
65
+ query: MessageListParams | null | undefined = {},
66
+ options?: RequestOptions,
67
+ ): PagePromise<MessagesCursor, Message> {
68
+ return this._client.getAPIList('/v2/messages', Cursor<Message>, { query, ...options });
69
+ }
70
+
71
+ /**
72
+ * Get a message
73
+ *
74
+ * A message, with `from` and `to` naming addresses, plus `attemptedChannels` and
75
+ * `riskHold`.
76
+ *
77
+ * `GET /v2/messages/{messageId}`
78
+ */
79
+ retrieve(messageID: string, options?: RequestOptions): APIPromise<MessageRetrieveResponse> {
80
+ return this._client.get(path`/v2/messages/${messageID}`, options);
81
+ }
82
+ }
83
+
84
+ export type MessageSendParams = T.MessagesSendParams;
85
+
86
+ export type MessageSendResponse = T.SendMessageResponse;
87
+
88
+ export type ChannelTypeRequest = T.ChannelTypeRequest;
89
+
90
+ export type EmailAttachmentInput = T.EmailAttachmentInput;
91
+
92
+ export type Message = T.Message;
93
+
94
+ export type MessageContent = T.MessageContent;
95
+
96
+ export type MessageType = T.MessageType;
97
+
98
+ export type Routing = T.Routing;
99
+
100
+ export type SendMessageResponse = T.SendMessageResponse;
101
+
102
+ export type MessageListParams = T.MessagesListParams;
103
+
104
+ export type MessagesCursor = Cursor<T.Message>;
105
+
106
+ export type ChannelType = T.ChannelType;
107
+
108
+ export type MessageStatus = T.MessageStatus;
109
+
110
+ export type MessageRetrieveResponse = T.GetMessageV2Response;
111
+
112
+ export declare namespace Messages {
113
+ export {
114
+ type ChannelType as ChannelType,
115
+ type ChannelTypeRequest as ChannelTypeRequest,
116
+ type EmailAttachmentInput as EmailAttachmentInput,
117
+ type Message as Message,
118
+ type MessageContent as MessageContent,
119
+ type MessageListParams as MessageListParams,
120
+ type MessageRetrieveResponse as MessageRetrieveResponse,
121
+ type MessageSendParams as MessageSendParams,
122
+ type MessageSendResponse as MessageSendResponse,
123
+ type MessageStatus as MessageStatus,
124
+ type MessageType as MessageType,
125
+ type MessagesCursor as MessagesCursor,
126
+ type Routing as Routing,
127
+ type SendMessageResponse as SendMessageResponse,
128
+ };
129
+ }