@relayapi/sdk 0.2.2

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 (242) hide show
  1. package/dist/api-promise.d.ts +2 -0
  2. package/dist/api-promise.js +18 -0
  3. package/dist/client.d.ts +225 -0
  4. package/dist/client.js +552 -0
  5. package/dist/core/api-promise.d.ts +45 -0
  6. package/dist/core/api-promise.js +83 -0
  7. package/dist/core/error.d.ts +45 -0
  8. package/dist/core/error.js +112 -0
  9. package/dist/core/resource.d.ts +5 -0
  10. package/dist/core/resource.js +10 -0
  11. package/dist/core/uploads.d.ts +2 -0
  12. package/dist/core/uploads.js +5 -0
  13. package/dist/error.d.ts +2 -0
  14. package/dist/error.js +18 -0
  15. package/dist/index.d.ts +5 -0
  16. package/dist/index.js +26 -0
  17. package/dist/internal/builtin-types.d.ts +72 -0
  18. package/dist/internal/builtin-types.js +3 -0
  19. package/dist/internal/detect-platform.d.ts +14 -0
  20. package/dist/internal/detect-platform.js +161 -0
  21. package/dist/internal/errors.d.ts +2 -0
  22. package/dist/internal/errors.js +40 -0
  23. package/dist/internal/headers.d.ts +19 -0
  24. package/dist/internal/headers.js +78 -0
  25. package/dist/internal/parse.d.ts +11 -0
  26. package/dist/internal/parse.js +39 -0
  27. package/dist/internal/request-options.d.ts +74 -0
  28. package/dist/internal/request-options.js +13 -0
  29. package/dist/internal/shim-types.d.ts +16 -0
  30. package/dist/internal/shim-types.js +3 -0
  31. package/dist/internal/shims.d.ts +23 -0
  32. package/dist/internal/shims.js +90 -0
  33. package/dist/internal/to-file.d.ts +44 -0
  34. package/dist/internal/to-file.js +90 -0
  35. package/dist/internal/types.d.ts +68 -0
  36. package/dist/internal/types.js +3 -0
  37. package/dist/internal/uploads.d.ts +41 -0
  38. package/dist/internal/uploads.js +140 -0
  39. package/dist/internal/utils/base64.d.ts +2 -0
  40. package/dist/internal/utils/base64.js +37 -0
  41. package/dist/internal/utils/bytes.d.ts +3 -0
  42. package/dist/internal/utils/bytes.js +30 -0
  43. package/dist/internal/utils/env.d.ts +8 -0
  44. package/dist/internal/utils/env.js +21 -0
  45. package/dist/internal/utils/log.d.ts +36 -0
  46. package/dist/internal/utils/log.js +84 -0
  47. package/dist/internal/utils/path.d.ts +14 -0
  48. package/dist/internal/utils/path.js +78 -0
  49. package/dist/internal/utils/query.d.ts +4 -0
  50. package/dist/internal/utils/query.js +22 -0
  51. package/dist/internal/utils/sleep.d.ts +1 -0
  52. package/dist/internal/utils/sleep.js +6 -0
  53. package/dist/internal/utils/uuid.d.ts +4 -0
  54. package/dist/internal/utils/uuid.js +18 -0
  55. package/dist/internal/utils/values.d.ts +17 -0
  56. package/dist/internal/utils/values.js +111 -0
  57. package/dist/internal/utils.d.ts +7 -0
  58. package/dist/internal/utils.js +24 -0
  59. package/dist/resource.d.ts +2 -0
  60. package/dist/resource.js +18 -0
  61. package/dist/resources/account-groups.d.ts +52 -0
  62. package/dist/resources/account-groups.js +37 -0
  63. package/dist/resources/accounts/accounts.d.ts +148 -0
  64. package/dist/resources/accounts/accounts.js +101 -0
  65. package/dist/resources/accounts/facebook-pages.d.ts +48 -0
  66. package/dist/resources/accounts/facebook-pages.js +21 -0
  67. package/dist/resources/accounts/gmb-locations.d.ts +48 -0
  68. package/dist/resources/accounts/gmb-locations.js +21 -0
  69. package/dist/resources/accounts/health.d.ts +49 -0
  70. package/dist/resources/accounts/health.js +21 -0
  71. package/dist/resources/accounts/index.d.ts +8 -0
  72. package/dist/resources/accounts/index.js +20 -0
  73. package/dist/resources/accounts/linkedin-organizations.d.ts +52 -0
  74. package/dist/resources/accounts/linkedin-organizations.js +21 -0
  75. package/dist/resources/accounts/pinterest-boards.d.ts +48 -0
  76. package/dist/resources/accounts/pinterest-boards.js +21 -0
  77. package/dist/resources/accounts/reddit-flairs.d.ts +27 -0
  78. package/dist/resources/accounts/reddit-flairs.js +15 -0
  79. package/dist/resources/accounts/reddit-subreddits.d.ts +48 -0
  80. package/dist/resources/accounts/reddit-subreddits.js +21 -0
  81. package/dist/resources/accounts.d.ts +1 -0
  82. package/dist/resources/accounts.js +18 -0
  83. package/dist/resources/analytics/analytics.d.ts +369 -0
  84. package/dist/resources/analytics/analytics.js +84 -0
  85. package/dist/resources/analytics/index.d.ts +2 -0
  86. package/dist/resources/analytics/index.js +8 -0
  87. package/dist/resources/analytics/youtube.d.ts +49 -0
  88. package/dist/resources/analytics/youtube.js +14 -0
  89. package/dist/resources/analytics.d.ts +1 -0
  90. package/dist/resources/analytics.js +18 -0
  91. package/dist/resources/api-keys.d.ts +110 -0
  92. package/dist/resources/api-keys.js +32 -0
  93. package/dist/resources/connect/connect.d.ts +188 -0
  94. package/dist/resources/connect/connect.js +97 -0
  95. package/dist/resources/connect/facebook/facebook.d.ts +9 -0
  96. package/dist/resources/connect/facebook/facebook.js +48 -0
  97. package/dist/resources/connect/facebook/index.d.ts +2 -0
  98. package/dist/resources/connect/facebook/index.js +8 -0
  99. package/dist/resources/connect/facebook/pages.d.ts +70 -0
  100. package/dist/resources/connect/facebook/pages.js +20 -0
  101. package/dist/resources/connect/facebook.d.ts +1 -0
  102. package/dist/resources/connect/facebook.js +18 -0
  103. package/dist/resources/connect/googlebusiness/googlebusiness.d.ts +9 -0
  104. package/dist/resources/connect/googlebusiness/googlebusiness.js +48 -0
  105. package/dist/resources/connect/googlebusiness/index.d.ts +2 -0
  106. package/dist/resources/connect/googlebusiness/index.js +8 -0
  107. package/dist/resources/connect/googlebusiness/locations.d.ts +70 -0
  108. package/dist/resources/connect/googlebusiness/locations.js +20 -0
  109. package/dist/resources/connect/googlebusiness.d.ts +1 -0
  110. package/dist/resources/connect/googlebusiness.js +18 -0
  111. package/dist/resources/connect/index.d.ts +8 -0
  112. package/dist/resources/connect/index.js +20 -0
  113. package/dist/resources/connect/linkedin/index.d.ts +2 -0
  114. package/dist/resources/connect/linkedin/index.js +8 -0
  115. package/dist/resources/connect/linkedin/linkedin.d.ts +9 -0
  116. package/dist/resources/connect/linkedin/linkedin.js +48 -0
  117. package/dist/resources/connect/linkedin/organizations.d.ts +85 -0
  118. package/dist/resources/connect/linkedin/organizations.js +20 -0
  119. package/dist/resources/connect/linkedin.d.ts +1 -0
  120. package/dist/resources/connect/linkedin.js +18 -0
  121. package/dist/resources/connect/pinterest/boards.d.ts +70 -0
  122. package/dist/resources/connect/pinterest/boards.js +20 -0
  123. package/dist/resources/connect/pinterest/index.d.ts +2 -0
  124. package/dist/resources/connect/pinterest/index.js +8 -0
  125. package/dist/resources/connect/pinterest/pinterest.d.ts +9 -0
  126. package/dist/resources/connect/pinterest/pinterest.js +48 -0
  127. package/dist/resources/connect/pinterest.d.ts +1 -0
  128. package/dist/resources/connect/pinterest.js +18 -0
  129. package/dist/resources/connect/snapchat/index.d.ts +2 -0
  130. package/dist/resources/connect/snapchat/index.js +8 -0
  131. package/dist/resources/connect/snapchat/profiles.d.ts +74 -0
  132. package/dist/resources/connect/snapchat/profiles.js +20 -0
  133. package/dist/resources/connect/snapchat/snapchat.d.ts +9 -0
  134. package/dist/resources/connect/snapchat/snapchat.js +48 -0
  135. package/dist/resources/connect/snapchat.d.ts +1 -0
  136. package/dist/resources/connect/snapchat.js +18 -0
  137. package/dist/resources/connect/telegram.d.ts +122 -0
  138. package/dist/resources/connect/telegram.js +26 -0
  139. package/dist/resources/connect/whatsapp.d.ts +92 -0
  140. package/dist/resources/connect/whatsapp.js +26 -0
  141. package/dist/resources/connect.d.ts +1 -0
  142. package/dist/resources/connect.js +18 -0
  143. package/dist/resources/connections.d.ts +55 -0
  144. package/dist/resources/connections.js +14 -0
  145. package/dist/resources/inbox/comments/comments.d.ts +220 -0
  146. package/dist/resources/inbox/comments/comments.js +83 -0
  147. package/dist/resources/inbox/comments/hide.d.ts +36 -0
  148. package/dist/resources/inbox/comments/hide.js +21 -0
  149. package/dist/resources/inbox/comments/index.d.ts +3 -0
  150. package/dist/resources/inbox/comments/index.js +10 -0
  151. package/dist/resources/inbox/comments/like.d.ts +36 -0
  152. package/dist/resources/inbox/comments/like.js +21 -0
  153. package/dist/resources/inbox/comments.d.ts +1 -0
  154. package/dist/resources/inbox/comments.js +18 -0
  155. package/dist/resources/inbox/inbox.d.ts +17 -0
  156. package/dist/resources/inbox/inbox.js +56 -0
  157. package/dist/resources/inbox/index.d.ts +4 -0
  158. package/dist/resources/inbox/index.js +12 -0
  159. package/dist/resources/inbox/messages.d.ts +205 -0
  160. package/dist/resources/inbox/messages.js +40 -0
  161. package/dist/resources/inbox/reviews/index.d.ts +2 -0
  162. package/dist/resources/inbox/reviews/index.js +8 -0
  163. package/dist/resources/inbox/reviews/reply.d.ts +38 -0
  164. package/dist/resources/inbox/reviews/reply.js +21 -0
  165. package/dist/resources/inbox/reviews/reviews.d.ts +76 -0
  166. package/dist/resources/inbox/reviews/reviews.js +54 -0
  167. package/dist/resources/inbox/reviews.d.ts +1 -0
  168. package/dist/resources/inbox/reviews.js +18 -0
  169. package/dist/resources/inbox.d.ts +1 -0
  170. package/dist/resources/inbox.js +18 -0
  171. package/dist/resources/index.d.ts +16 -0
  172. package/dist/resources/index.js +36 -0
  173. package/dist/resources/media.d.ts +177 -0
  174. package/dist/resources/media.js +51 -0
  175. package/dist/resources/posts/index.d.ts +2 -0
  176. package/dist/resources/posts/index.js +8 -0
  177. package/dist/resources/posts/logs.d.ts +134 -0
  178. package/dist/resources/posts/logs.js +31 -0
  179. package/dist/resources/posts/posts.d.ts +607 -0
  180. package/dist/resources/posts/posts.js +149 -0
  181. package/dist/resources/posts.d.ts +1 -0
  182. package/dist/resources/posts.js +18 -0
  183. package/dist/resources/queue/index.d.ts +2 -0
  184. package/dist/resources/queue/index.js +8 -0
  185. package/dist/resources/queue/queue.d.ts +42 -0
  186. package/dist/resources/queue/queue.js +60 -0
  187. package/dist/resources/queue/slots.d.ts +215 -0
  188. package/dist/resources/queue/slots.js +36 -0
  189. package/dist/resources/queue.d.ts +1 -0
  190. package/dist/resources/queue.js +18 -0
  191. package/dist/resources/reddit.d.ts +186 -0
  192. package/dist/resources/reddit.js +20 -0
  193. package/dist/resources/tools/index.d.ts +3 -0
  194. package/dist/resources/tools/index.js +10 -0
  195. package/dist/resources/tools/instagram.d.ts +41 -0
  196. package/dist/resources/tools/instagram.js +22 -0
  197. package/dist/resources/tools/tools.d.ts +13 -0
  198. package/dist/resources/tools/tools.js +52 -0
  199. package/dist/resources/tools/validate.d.ts +689 -0
  200. package/dist/resources/tools/validate.js +63 -0
  201. package/dist/resources/tools.d.ts +1 -0
  202. package/dist/resources/tools.js +18 -0
  203. package/dist/resources/twitter/bookmark.d.ts +48 -0
  204. package/dist/resources/twitter/bookmark.js +20 -0
  205. package/dist/resources/twitter/follow.d.ts +48 -0
  206. package/dist/resources/twitter/follow.js +20 -0
  207. package/dist/resources/twitter/index.d.ts +4 -0
  208. package/dist/resources/twitter/index.js +12 -0
  209. package/dist/resources/twitter/retweet.d.ts +48 -0
  210. package/dist/resources/twitter/retweet.js +20 -0
  211. package/dist/resources/twitter/twitter.d.ts +17 -0
  212. package/dist/resources/twitter/twitter.js +56 -0
  213. package/dist/resources/twitter.d.ts +1 -0
  214. package/dist/resources/twitter.js +18 -0
  215. package/dist/resources/usage.d.ts +97 -0
  216. package/dist/resources/usage.js +14 -0
  217. package/dist/resources/webhooks.d.ts +205 -0
  218. package/dist/resources/webhooks.js +50 -0
  219. package/dist/resources/whatsapp/broadcasts.d.ts +291 -0
  220. package/dist/resources/whatsapp/broadcasts.js +49 -0
  221. package/dist/resources/whatsapp/business-profile.d.ts +85 -0
  222. package/dist/resources/whatsapp/business-profile.js +20 -0
  223. package/dist/resources/whatsapp/contacts.d.ts +250 -0
  224. package/dist/resources/whatsapp/contacts.js +49 -0
  225. package/dist/resources/whatsapp/groups.d.ts +87 -0
  226. package/dist/resources/whatsapp/groups.js +31 -0
  227. package/dist/resources/whatsapp/index.d.ts +6 -0
  228. package/dist/resources/whatsapp/index.js +16 -0
  229. package/dist/resources/whatsapp/templates.d.ts +250 -0
  230. package/dist/resources/whatsapp/templates.js +39 -0
  231. package/dist/resources/whatsapp/whatsapp.d.ts +148 -0
  232. package/dist/resources/whatsapp/whatsapp.js +76 -0
  233. package/dist/resources/whatsapp.d.ts +1 -0
  234. package/dist/resources/whatsapp.js +18 -0
  235. package/dist/resources.d.ts +1 -0
  236. package/dist/resources.js +17 -0
  237. package/dist/uploads.d.ts +2 -0
  238. package/dist/uploads.js +18 -0
  239. package/dist/version.d.ts +1 -0
  240. package/dist/version.js +5 -0
  241. package/package.json +28 -0
  242. package/src/index.ts +22 -0
@@ -0,0 +1,205 @@
1
+ import { APIResource } from '../core/resource';
2
+ import { APIPromise } from '../core/api-promise';
3
+ import { RequestOptions } from '../internal/request-options';
4
+ export declare class Webhooks extends APIResource {
5
+ /**
6
+ * Create a new webhook endpoint. The signing secret is returned only once in the
7
+ * response.
8
+ */
9
+ create(body: WebhookCreateParams, options?: RequestOptions): APIPromise<WebhookCreateResponse>;
10
+ /**
11
+ * Update a webhook endpoint
12
+ */
13
+ update(id: string, body?: WebhookUpdateParams | null | undefined, options?: RequestOptions): APIPromise<WebhookUpdateResponse>;
14
+ /**
15
+ * List webhook endpoints
16
+ */
17
+ list(query?: WebhookListParams | null | undefined, options?: RequestOptions): APIPromise<WebhookListResponse>;
18
+ /**
19
+ * Delete a webhook endpoint
20
+ */
21
+ delete(id: string, options?: RequestOptions): APIPromise<void>;
22
+ /**
23
+ * Returns delivery logs from the last 7 days.
24
+ */
25
+ listLogs(query?: WebhookListLogsParams | null | undefined, options?: RequestOptions): APIPromise<WebhookListLogsResponse>;
26
+ /**
27
+ * Send a test POST request to the webhook URL to verify it is reachable.
28
+ */
29
+ sendTest(body: WebhookSendTestParams, options?: RequestOptions): APIPromise<WebhookSendTestResponse>;
30
+ }
31
+ export interface WebhookCreateResponse {
32
+ /**
33
+ * Webhook ID
34
+ */
35
+ id: string;
36
+ /**
37
+ * Creation timestamp
38
+ */
39
+ created_at: string;
40
+ /**
41
+ * Whether the webhook is active
42
+ */
43
+ enabled: boolean;
44
+ /**
45
+ * Subscribed events
46
+ */
47
+ events: Array<string>;
48
+ /**
49
+ * Webhook signing secret (shown only once)
50
+ */
51
+ secret: string;
52
+ /**
53
+ * Endpoint URL
54
+ */
55
+ url: string;
56
+ }
57
+ export interface WebhookUpdateResponse {
58
+ /**
59
+ * Webhook ID
60
+ */
61
+ id: string;
62
+ /**
63
+ * Creation timestamp
64
+ */
65
+ created_at: string;
66
+ /**
67
+ * Whether the webhook is active
68
+ */
69
+ enabled: boolean;
70
+ /**
71
+ * Subscribed events
72
+ */
73
+ events: Array<string>;
74
+ /**
75
+ * Last update timestamp
76
+ */
77
+ updated_at: string;
78
+ /**
79
+ * Endpoint URL
80
+ */
81
+ url: string;
82
+ }
83
+ export interface WebhookListResponse {
84
+ data: Array<WebhookListResponse.Data>;
85
+ /**
86
+ * Whether more items exist
87
+ */
88
+ has_more: boolean;
89
+ /**
90
+ * Cursor for next page
91
+ */
92
+ next_cursor: string | null;
93
+ }
94
+ export declare namespace WebhookListResponse {
95
+ interface Data {
96
+ /**
97
+ * Webhook ID
98
+ */
99
+ id: string;
100
+ /**
101
+ * Creation timestamp
102
+ */
103
+ created_at: string;
104
+ /**
105
+ * Whether the webhook is active
106
+ */
107
+ enabled: boolean;
108
+ /**
109
+ * Subscribed events
110
+ */
111
+ events: Array<string>;
112
+ /**
113
+ * Last update timestamp
114
+ */
115
+ updated_at: string;
116
+ /**
117
+ * Endpoint URL
118
+ */
119
+ url: string;
120
+ }
121
+ }
122
+ export interface WebhookListLogsResponse {
123
+ data: Array<WebhookListLogsResponse.Data>;
124
+ has_more: boolean;
125
+ next_cursor: string | null;
126
+ }
127
+ export declare namespace WebhookListLogsResponse {
128
+ interface Data {
129
+ id: string;
130
+ created_at: string;
131
+ error: string | null;
132
+ event: string;
133
+ response_time_ms: number | null;
134
+ status_code: number | null;
135
+ success: boolean;
136
+ webhook_id: string;
137
+ }
138
+ }
139
+ export interface WebhookSendTestResponse {
140
+ /**
141
+ * Response time in milliseconds
142
+ */
143
+ response_time_ms: number | null;
144
+ /**
145
+ * HTTP status code from the test delivery
146
+ */
147
+ status_code: number | null;
148
+ /**
149
+ * Whether the test delivery succeeded
150
+ */
151
+ success: boolean;
152
+ }
153
+ export interface WebhookCreateParams {
154
+ /**
155
+ * Events to subscribe to
156
+ */
157
+ events: Array<'post.published' | 'post.partial' | 'post.failed' | 'post.scheduled' | 'account.connected' | 'account.disconnected' | 'comment.received' | 'message.received'>;
158
+ /**
159
+ * Webhook endpoint URL
160
+ */
161
+ url: string;
162
+ }
163
+ export interface WebhookUpdateParams {
164
+ /**
165
+ * Enable or disable the webhook
166
+ */
167
+ enabled?: boolean;
168
+ /**
169
+ * Updated events
170
+ */
171
+ events?: Array<'post.published' | 'post.partial' | 'post.failed' | 'post.scheduled' | 'account.connected' | 'account.disconnected' | 'comment.received' | 'message.received'>;
172
+ /**
173
+ * Updated endpoint URL
174
+ */
175
+ url?: string;
176
+ }
177
+ export interface WebhookListParams {
178
+ /**
179
+ * Pagination cursor
180
+ */
181
+ cursor?: string;
182
+ /**
183
+ * Number of items per page
184
+ */
185
+ limit?: number;
186
+ }
187
+ export interface WebhookListLogsParams {
188
+ /**
189
+ * Pagination cursor
190
+ */
191
+ cursor?: string;
192
+ /**
193
+ * Number of items per page
194
+ */
195
+ limit?: number;
196
+ }
197
+ export interface WebhookSendTestParams {
198
+ /**
199
+ * ID of the webhook to test
200
+ */
201
+ webhook_id: string;
202
+ }
203
+ export declare namespace Webhooks {
204
+ export { type WebhookCreateResponse as WebhookCreateResponse, type WebhookUpdateResponse as WebhookUpdateResponse, type WebhookListResponse as WebhookListResponse, type WebhookListLogsResponse as WebhookListLogsResponse, type WebhookSendTestResponse as WebhookSendTestResponse, type WebhookCreateParams as WebhookCreateParams, type WebhookUpdateParams as WebhookUpdateParams, type WebhookListParams as WebhookListParams, type WebhookListLogsParams as WebhookListLogsParams, type WebhookSendTestParams as WebhookSendTestParams, };
205
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Webhooks = void 0;
5
+ const resource_1 = require("../core/resource");
6
+ const headers_1 = require("../internal/headers");
7
+ const path_1 = require("../internal/utils/path");
8
+ class Webhooks extends resource_1.APIResource {
9
+ /**
10
+ * Create a new webhook endpoint. The signing secret is returned only once in the
11
+ * response.
12
+ */
13
+ create(body, options) {
14
+ return this._client.post('/v1/webhooks', { body, ...options });
15
+ }
16
+ /**
17
+ * Update a webhook endpoint
18
+ */
19
+ update(id, body = {}, options) {
20
+ return this._client.patch((0, path_1.path) `/v1/webhooks/${id}`, { body, ...options });
21
+ }
22
+ /**
23
+ * List webhook endpoints
24
+ */
25
+ list(query = {}, options) {
26
+ return this._client.get('/v1/webhooks', { query, ...options });
27
+ }
28
+ /**
29
+ * Delete a webhook endpoint
30
+ */
31
+ delete(id, options) {
32
+ return this._client.delete((0, path_1.path) `/v1/webhooks/${id}`, {
33
+ ...options,
34
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
35
+ });
36
+ }
37
+ /**
38
+ * Returns delivery logs from the last 7 days.
39
+ */
40
+ listLogs(query = {}, options) {
41
+ return this._client.get('/v1/webhooks/logs', { query, ...options });
42
+ }
43
+ /**
44
+ * Send a test POST request to the webhook URL to verify it is reachable.
45
+ */
46
+ sendTest(body, options) {
47
+ return this._client.post('/v1/webhooks/test', { body, ...options });
48
+ }
49
+ }
50
+ exports.Webhooks = Webhooks;
@@ -0,0 +1,291 @@
1
+ import { APIResource } from '../../core/resource';
2
+ import { APIPromise } from '../../core/api-promise';
3
+ import { RequestOptions } from '../../internal/request-options';
4
+ export declare class Broadcasts extends APIResource {
5
+ /**
6
+ * Create a broadcast
7
+ */
8
+ create(body: BroadcastCreateParams, options?: RequestOptions): APIPromise<BroadcastCreateResponse>;
9
+ /**
10
+ * Get broadcast details
11
+ */
12
+ retrieve(broadcastID: string, options?: RequestOptions): APIPromise<BroadcastRetrieveResponse>;
13
+ /**
14
+ * List broadcasts
15
+ */
16
+ list(query: BroadcastListParams, options?: RequestOptions): APIPromise<BroadcastListResponse>;
17
+ /**
18
+ * Delete a broadcast
19
+ */
20
+ delete(broadcastID: string, options?: RequestOptions): APIPromise<void>;
21
+ /**
22
+ * Schedule a broadcast
23
+ */
24
+ schedule(broadcastID: string, options?: RequestOptions): APIPromise<BroadcastScheduleResponse>;
25
+ /**
26
+ * Send a broadcast immediately
27
+ */
28
+ send(broadcastID: string, options?: RequestOptions): APIPromise<BroadcastSendResponse>;
29
+ }
30
+ export interface BroadcastCreateResponse {
31
+ /**
32
+ * Broadcast ID
33
+ */
34
+ id: string;
35
+ /**
36
+ * Created timestamp
37
+ */
38
+ created_at: string;
39
+ /**
40
+ * Broadcast name
41
+ */
42
+ name: string;
43
+ /**
44
+ * Total recipients
45
+ */
46
+ recipient_count: number;
47
+ /**
48
+ * Broadcast status
49
+ */
50
+ status: 'draft' | 'scheduled' | 'sending' | 'sent' | 'failed';
51
+ /**
52
+ * Template name
53
+ */
54
+ template: string;
55
+ /**
56
+ * Failed sends
57
+ */
58
+ failed?: number;
59
+ /**
60
+ * Scheduled time
61
+ */
62
+ scheduled_at?: string | null;
63
+ /**
64
+ * Successfully sent
65
+ */
66
+ sent?: number;
67
+ }
68
+ export interface BroadcastRetrieveResponse {
69
+ /**
70
+ * Broadcast ID
71
+ */
72
+ id: string;
73
+ /**
74
+ * Created timestamp
75
+ */
76
+ created_at: string;
77
+ /**
78
+ * Broadcast name
79
+ */
80
+ name: string;
81
+ /**
82
+ * Total recipients
83
+ */
84
+ recipient_count: number;
85
+ /**
86
+ * Broadcast status
87
+ */
88
+ status: 'draft' | 'scheduled' | 'sending' | 'sent' | 'failed';
89
+ /**
90
+ * Template name
91
+ */
92
+ template: string;
93
+ /**
94
+ * Failed sends
95
+ */
96
+ failed?: number;
97
+ /**
98
+ * Scheduled time
99
+ */
100
+ scheduled_at?: string | null;
101
+ /**
102
+ * Successfully sent
103
+ */
104
+ sent?: number;
105
+ }
106
+ export interface BroadcastListResponse {
107
+ data: Array<BroadcastListResponse.Data>;
108
+ }
109
+ export declare namespace BroadcastListResponse {
110
+ interface Data {
111
+ /**
112
+ * Broadcast ID
113
+ */
114
+ id: string;
115
+ /**
116
+ * Created timestamp
117
+ */
118
+ created_at: string;
119
+ /**
120
+ * Broadcast name
121
+ */
122
+ name: string;
123
+ /**
124
+ * Total recipients
125
+ */
126
+ recipient_count: number;
127
+ /**
128
+ * Broadcast status
129
+ */
130
+ status: 'draft' | 'scheduled' | 'sending' | 'sent' | 'failed';
131
+ /**
132
+ * Template name
133
+ */
134
+ template: string;
135
+ /**
136
+ * Failed sends
137
+ */
138
+ failed?: number;
139
+ /**
140
+ * Scheduled time
141
+ */
142
+ scheduled_at?: string | null;
143
+ /**
144
+ * Successfully sent
145
+ */
146
+ sent?: number;
147
+ }
148
+ }
149
+ export interface BroadcastScheduleResponse {
150
+ /**
151
+ * Broadcast ID
152
+ */
153
+ id: string;
154
+ /**
155
+ * Created timestamp
156
+ */
157
+ created_at: string;
158
+ /**
159
+ * Broadcast name
160
+ */
161
+ name: string;
162
+ /**
163
+ * Total recipients
164
+ */
165
+ recipient_count: number;
166
+ /**
167
+ * Broadcast status
168
+ */
169
+ status: 'draft' | 'scheduled' | 'sending' | 'sent' | 'failed';
170
+ /**
171
+ * Template name
172
+ */
173
+ template: string;
174
+ /**
175
+ * Failed sends
176
+ */
177
+ failed?: number;
178
+ /**
179
+ * Scheduled time
180
+ */
181
+ scheduled_at?: string | null;
182
+ /**
183
+ * Successfully sent
184
+ */
185
+ sent?: number;
186
+ }
187
+ export interface BroadcastSendResponse {
188
+ /**
189
+ * Broadcast ID
190
+ */
191
+ id: string;
192
+ /**
193
+ * Created timestamp
194
+ */
195
+ created_at: string;
196
+ /**
197
+ * Broadcast name
198
+ */
199
+ name: string;
200
+ /**
201
+ * Total recipients
202
+ */
203
+ recipient_count: number;
204
+ /**
205
+ * Broadcast status
206
+ */
207
+ status: 'draft' | 'scheduled' | 'sending' | 'sent' | 'failed';
208
+ /**
209
+ * Template name
210
+ */
211
+ template: string;
212
+ /**
213
+ * Failed sends
214
+ */
215
+ failed?: number;
216
+ /**
217
+ * Scheduled time
218
+ */
219
+ scheduled_at?: string | null;
220
+ /**
221
+ * Successfully sent
222
+ */
223
+ sent?: number;
224
+ }
225
+ export interface BroadcastCreateParams {
226
+ /**
227
+ * WhatsApp account ID
228
+ */
229
+ account_id: string;
230
+ /**
231
+ * Broadcast name
232
+ */
233
+ name: string;
234
+ /**
235
+ * Recipient list
236
+ */
237
+ recipients: Array<BroadcastCreateParams.Recipient>;
238
+ template: BroadcastCreateParams.Template;
239
+ /**
240
+ * ISO 8601 timestamp to schedule send
241
+ */
242
+ scheduled_at?: string;
243
+ }
244
+ export declare namespace BroadcastCreateParams {
245
+ interface Recipient {
246
+ /**
247
+ * Phone number in E.164 format
248
+ */
249
+ phone: string;
250
+ /**
251
+ * Template variable substitutions
252
+ */
253
+ variables?: {
254
+ [key: string]: string;
255
+ };
256
+ }
257
+ interface Template {
258
+ /**
259
+ * Template language code
260
+ */
261
+ language: string;
262
+ /**
263
+ * Template name
264
+ */
265
+ name: string;
266
+ components?: Array<Template.Component>;
267
+ }
268
+ namespace Template {
269
+ interface Component {
270
+ /**
271
+ * Component type
272
+ */
273
+ type: 'header' | 'body' | 'button';
274
+ /**
275
+ * Component parameters
276
+ */
277
+ parameters?: Array<{
278
+ [key: string]: unknown;
279
+ }>;
280
+ }
281
+ }
282
+ }
283
+ export interface BroadcastListParams {
284
+ /**
285
+ * WhatsApp account ID
286
+ */
287
+ account_id: string;
288
+ }
289
+ export declare namespace Broadcasts {
290
+ export { type BroadcastCreateResponse as BroadcastCreateResponse, type BroadcastRetrieveResponse as BroadcastRetrieveResponse, type BroadcastListResponse as BroadcastListResponse, type BroadcastScheduleResponse as BroadcastScheduleResponse, type BroadcastSendResponse as BroadcastSendResponse, type BroadcastCreateParams as BroadcastCreateParams, type BroadcastListParams as BroadcastListParams, };
291
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Broadcasts = void 0;
5
+ const resource_1 = require("../../core/resource");
6
+ const headers_1 = require("../../internal/headers");
7
+ const path_1 = require("../../internal/utils/path");
8
+ class Broadcasts extends resource_1.APIResource {
9
+ /**
10
+ * Create a broadcast
11
+ */
12
+ create(body, options) {
13
+ return this._client.post('/v1/whatsapp/broadcasts', { body, ...options });
14
+ }
15
+ /**
16
+ * Get broadcast details
17
+ */
18
+ retrieve(broadcastID, options) {
19
+ return this._client.get((0, path_1.path) `/v1/whatsapp/broadcasts/${broadcastID}`, options);
20
+ }
21
+ /**
22
+ * List broadcasts
23
+ */
24
+ list(query, options) {
25
+ return this._client.get('/v1/whatsapp/broadcasts', { query, ...options });
26
+ }
27
+ /**
28
+ * Delete a broadcast
29
+ */
30
+ delete(broadcastID, options) {
31
+ return this._client.delete((0, path_1.path) `/v1/whatsapp/broadcasts/${broadcastID}`, {
32
+ ...options,
33
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
34
+ });
35
+ }
36
+ /**
37
+ * Schedule a broadcast
38
+ */
39
+ schedule(broadcastID, options) {
40
+ return this._client.post((0, path_1.path) `/v1/whatsapp/broadcasts/${broadcastID}/schedule`, options);
41
+ }
42
+ /**
43
+ * Send a broadcast immediately
44
+ */
45
+ send(broadcastID, options) {
46
+ return this._client.post((0, path_1.path) `/v1/whatsapp/broadcasts/${broadcastID}/send`, options);
47
+ }
48
+ }
49
+ exports.Broadcasts = Broadcasts;
@@ -0,0 +1,85 @@
1
+ import { APIResource } from '../../core/resource';
2
+ import { APIPromise } from '../../core/api-promise';
3
+ import { RequestOptions } from '../../internal/request-options';
4
+ export declare class BusinessProfile extends APIResource {
5
+ /**
6
+ * Get WhatsApp Business profile
7
+ */
8
+ retrieve(query: BusinessProfileRetrieveParams, options?: RequestOptions): APIPromise<BusinessProfileRetrieveResponse>;
9
+ /**
10
+ * Update WhatsApp Business profile
11
+ */
12
+ update(body: BusinessProfileUpdateParams, options?: RequestOptions): APIPromise<BusinessProfileUpdateResponse>;
13
+ }
14
+ export interface BusinessProfileRetrieveResponse {
15
+ /**
16
+ * About text
17
+ */
18
+ about?: string | null;
19
+ /**
20
+ * Business address
21
+ */
22
+ address?: string | null;
23
+ /**
24
+ * Description
25
+ */
26
+ description?: string | null;
27
+ /**
28
+ * Business email
29
+ */
30
+ email?: string | null;
31
+ /**
32
+ * Profile picture URL
33
+ */
34
+ profile_picture_url?: string | null;
35
+ /**
36
+ * Website URLs
37
+ */
38
+ websites?: Array<string>;
39
+ }
40
+ export interface BusinessProfileUpdateResponse {
41
+ /**
42
+ * About text
43
+ */
44
+ about?: string | null;
45
+ /**
46
+ * Business address
47
+ */
48
+ address?: string | null;
49
+ /**
50
+ * Description
51
+ */
52
+ description?: string | null;
53
+ /**
54
+ * Business email
55
+ */
56
+ email?: string | null;
57
+ /**
58
+ * Profile picture URL
59
+ */
60
+ profile_picture_url?: string | null;
61
+ /**
62
+ * Website URLs
63
+ */
64
+ websites?: Array<string>;
65
+ }
66
+ export interface BusinessProfileRetrieveParams {
67
+ /**
68
+ * WhatsApp account ID
69
+ */
70
+ account_id: string;
71
+ }
72
+ export interface BusinessProfileUpdateParams {
73
+ /**
74
+ * WhatsApp account ID
75
+ */
76
+ account_id: string;
77
+ about?: string;
78
+ address?: string;
79
+ description?: string;
80
+ email?: string;
81
+ websites?: Array<string>;
82
+ }
83
+ export declare namespace BusinessProfile {
84
+ export { type BusinessProfileRetrieveResponse as BusinessProfileRetrieveResponse, type BusinessProfileUpdateResponse as BusinessProfileUpdateResponse, type BusinessProfileRetrieveParams as BusinessProfileRetrieveParams, type BusinessProfileUpdateParams as BusinessProfileUpdateParams, };
85
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.BusinessProfile = void 0;
5
+ const resource_1 = require("../../core/resource");
6
+ class BusinessProfile extends resource_1.APIResource {
7
+ /**
8
+ * Get WhatsApp Business profile
9
+ */
10
+ retrieve(query, options) {
11
+ return this._client.get('/v1/whatsapp/business-profile', { query, ...options });
12
+ }
13
+ /**
14
+ * Update WhatsApp Business profile
15
+ */
16
+ update(body, options) {
17
+ return this._client.put('/v1/whatsapp/business-profile', { body, ...options });
18
+ }
19
+ }
20
+ exports.BusinessProfile = BusinessProfile;