sendblue 2.0.1 → 2.0.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 (65) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/client.d.mts +6 -3
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +6 -3
  5. package/client.d.ts.map +1 -1
  6. package/client.js +5 -2
  7. package/client.js.map +1 -1
  8. package/client.mjs +5 -2
  9. package/client.mjs.map +1 -1
  10. package/internal/to-file.d.mts +1 -1
  11. package/internal/to-file.d.ts +1 -1
  12. package/internal/to-file.js +1 -1
  13. package/internal/to-file.mjs +1 -1
  14. package/internal/utils/values.js +3 -3
  15. package/internal/utils/values.js.map +1 -1
  16. package/internal/utils/values.mjs +3 -3
  17. package/internal/utils/values.mjs.map +1 -1
  18. package/package.json +4 -1
  19. package/resources/contacts/contacts.d.mts +2 -28
  20. package/resources/contacts/contacts.d.mts.map +1 -1
  21. package/resources/contacts/contacts.d.ts +2 -28
  22. package/resources/contacts/contacts.d.ts.map +1 -1
  23. package/resources/contacts/contacts.js +2 -2
  24. package/resources/contacts/contacts.js.map +1 -1
  25. package/resources/contacts/contacts.mjs +2 -2
  26. package/resources/contacts/contacts.mjs.map +1 -1
  27. package/resources/contacts/index.d.mts +1 -1
  28. package/resources/contacts/index.d.mts.map +1 -1
  29. package/resources/contacts/index.d.ts +1 -1
  30. package/resources/contacts/index.d.ts.map +1 -1
  31. package/resources/contacts/index.js.map +1 -1
  32. package/resources/contacts/index.mjs.map +1 -1
  33. package/resources/index.d.mts +2 -1
  34. package/resources/index.d.mts.map +1 -1
  35. package/resources/index.d.ts +2 -1
  36. package/resources/index.d.ts.map +1 -1
  37. package/resources/index.js +3 -1
  38. package/resources/index.js.map +1 -1
  39. package/resources/index.mjs +1 -0
  40. package/resources/index.mjs.map +1 -1
  41. package/resources/messages.d.mts +0 -8
  42. package/resources/messages.d.mts.map +1 -1
  43. package/resources/messages.d.ts +0 -8
  44. package/resources/messages.d.ts.map +1 -1
  45. package/resources/webhooks.d.mts +224 -0
  46. package/resources/webhooks.d.mts.map +1 -0
  47. package/resources/webhooks.d.ts +224 -0
  48. package/resources/webhooks.d.ts.map +1 -0
  49. package/resources/webhooks.js +82 -0
  50. package/resources/webhooks.js.map +1 -0
  51. package/resources/webhooks.mjs +78 -0
  52. package/resources/webhooks.mjs.map +1 -0
  53. package/src/client.ts +30 -5
  54. package/src/internal/to-file.ts +1 -1
  55. package/src/internal/utils/values.ts +3 -3
  56. package/src/resources/contacts/contacts.ts +2 -38
  57. package/src/resources/contacts/index.ts +0 -1
  58. package/src/resources/index.ts +11 -1
  59. package/src/resources/messages.ts +0 -10
  60. package/src/resources/webhooks.ts +284 -0
  61. package/src/version.ts +1 -1
  62. package/version.d.mts +1 -1
  63. package/version.d.ts +1 -1
  64. package/version.js +1 -1
  65. package/version.mjs +1 -1
@@ -0,0 +1,224 @@
1
+ import { APIResource } from "../core/resource.mjs";
2
+ import { APIPromise } from "../core/api-promise.mjs";
3
+ import { RequestOptions } from "../internal/request-options.mjs";
4
+ export declare class Webhooks extends APIResource {
5
+ /**
6
+ * Add new webhooks to your account. This endpoint appends webhooks to the existing
7
+ * list.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const webhook = await client.webhooks.create({
12
+ * webhooks: [
13
+ * 'https://example.com/new-webhook',
14
+ * {
15
+ * url: 'https://example.com/webhook-with-secret',
16
+ * secret: 'my-webhook-secret',
17
+ * },
18
+ * ],
19
+ * globalSecret: 'optional-global-secret',
20
+ * type: 'receive',
21
+ * });
22
+ * ```
23
+ */
24
+ create(body: WebhookCreateParams, options?: RequestOptions): APIPromise<WebhookCreateResponse>;
25
+ /**
26
+ * Replace all webhooks for your account. This endpoint completely replaces the
27
+ * existing webhook configuration.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * const webhook = await client.webhooks.update({
32
+ * webhooks: {
33
+ * receive: [
34
+ * 'https://example.com/webhook1',
35
+ * {
36
+ * url: 'https://example.com/webhook2',
37
+ * secret: 'webhook-secret',
38
+ * },
39
+ * ],
40
+ * call_log: ['https://example.com/call-webhook'],
41
+ * contact_created: [
42
+ * 'https://example.com/contact-webhook',
43
+ * ],
44
+ * globalSecret: 'my-global-secret',
45
+ * },
46
+ * });
47
+ * ```
48
+ */
49
+ update(body: WebhookUpdateParams, options?: RequestOptions): APIPromise<WebhookUpdateResponse>;
50
+ /**
51
+ * Get all webhooks configured for your account.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * const webhooks = await client.webhooks.list();
56
+ * ```
57
+ */
58
+ list(options?: RequestOptions): APIPromise<WebhookListResponse>;
59
+ /**
60
+ * Delete specific webhooks from your account.
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * const webhook = await client.webhooks.delete({
65
+ * webhooks: ['https://example.com'],
66
+ * });
67
+ * ```
68
+ */
69
+ delete(body: WebhookDeleteParams, options?: RequestOptions): APIPromise<WebhookDeleteResponse>;
70
+ }
71
+ export interface WebhookConfiguration {
72
+ /**
73
+ * Webhooks for call logs
74
+ */
75
+ call_log?: Array<string | WebhookConfiguration.WebhookObject>;
76
+ /**
77
+ * Webhooks for contact creation (URL strings only)
78
+ */
79
+ contact_created?: Array<string>;
80
+ /**
81
+ * Global secret applied to all webhooks
82
+ */
83
+ globalSecret?: string;
84
+ /**
85
+ * Webhooks for line assignment
86
+ */
87
+ line_assigned?: Array<string | WebhookConfiguration.WebhookObject>;
88
+ /**
89
+ * Webhooks for blocked lines
90
+ */
91
+ line_blocked?: Array<string | WebhookConfiguration.WebhookObject>;
92
+ /**
93
+ * Webhooks for outbound messages
94
+ */
95
+ outbound?: Array<string | WebhookConfiguration.WebhookObject>;
96
+ /**
97
+ * Webhooks for inbound messages
98
+ */
99
+ receive?: Array<string | WebhookConfiguration.WebhookObject>;
100
+ /**
101
+ * Legacy secret field
102
+ */
103
+ secret?: string;
104
+ }
105
+ export declare namespace WebhookConfiguration {
106
+ interface WebhookObject {
107
+ /**
108
+ * Webhook URL (HTTPS only)
109
+ */
110
+ url: string;
111
+ /**
112
+ * Secret for webhook verification
113
+ */
114
+ secret?: string;
115
+ }
116
+ interface WebhookObject {
117
+ /**
118
+ * Webhook URL (HTTPS only)
119
+ */
120
+ url: string;
121
+ /**
122
+ * Secret for webhook verification
123
+ */
124
+ secret?: string;
125
+ }
126
+ interface WebhookObject {
127
+ /**
128
+ * Webhook URL (HTTPS only)
129
+ */
130
+ url: string;
131
+ /**
132
+ * Secret for webhook verification
133
+ */
134
+ secret?: string;
135
+ }
136
+ interface WebhookObject {
137
+ /**
138
+ * Webhook URL (HTTPS only)
139
+ */
140
+ url: string;
141
+ /**
142
+ * Secret for webhook verification
143
+ */
144
+ secret?: string;
145
+ }
146
+ interface WebhookObject {
147
+ /**
148
+ * Webhook URL (HTTPS only)
149
+ */
150
+ url: string;
151
+ /**
152
+ * Secret for webhook verification
153
+ */
154
+ secret?: string;
155
+ }
156
+ }
157
+ export interface WebhookCreateResponse {
158
+ status: 'OK' | 'ERROR';
159
+ message?: string;
160
+ /**
161
+ * Updated webhook configration (partial)
162
+ */
163
+ webhooks?: WebhookConfiguration;
164
+ }
165
+ export interface WebhookUpdateResponse {
166
+ status: 'OK' | 'ERROR';
167
+ message?: string;
168
+ /**
169
+ * Updated webhook configration (partial)
170
+ */
171
+ webhooks?: WebhookConfiguration;
172
+ }
173
+ export interface WebhookListResponse {
174
+ status: 'OK' | 'ERROR';
175
+ message?: string;
176
+ webhooks?: WebhookConfiguration;
177
+ }
178
+ export interface WebhookDeleteResponse {
179
+ status: 'OK' | 'ERROR';
180
+ message?: string;
181
+ }
182
+ export interface WebhookCreateParams {
183
+ /**
184
+ * Array of webhook URLs or webhook objects to add
185
+ */
186
+ webhooks: Array<string | WebhookCreateParams.WebhookObject>;
187
+ /**
188
+ * Optional global secret to apply to all webhooks
189
+ */
190
+ globalSecret?: string;
191
+ /**
192
+ * Webhook type (default to 'receive')
193
+ */
194
+ type?: 'receive' | 'call_log' | 'line_blocked' | 'line_assigned' | 'outbound' | 'contact_created';
195
+ }
196
+ export declare namespace WebhookCreateParams {
197
+ interface WebhookObject {
198
+ /**
199
+ * Webhook URL (HTTPS only)
200
+ */
201
+ url: string;
202
+ /**
203
+ * Secret for webhook verification
204
+ */
205
+ secret?: string;
206
+ }
207
+ }
208
+ export interface WebhookUpdateParams {
209
+ webhooks: WebhookConfiguration;
210
+ }
211
+ export interface WebhookDeleteParams {
212
+ /**
213
+ * Array of webhook URLs to delete
214
+ */
215
+ webhooks: Array<string>;
216
+ /**
217
+ * Webhook type (default to 'receive')
218
+ */
219
+ type?: 'receive' | 'call_log' | 'line_blocked' | 'line_assigned' | 'outbound' | 'contact_created';
220
+ }
221
+ export declare namespace Webhooks {
222
+ export { type WebhookConfiguration as WebhookConfiguration, type WebhookCreateResponse as WebhookCreateResponse, type WebhookUpdateResponse as WebhookUpdateResponse, type WebhookListResponse as WebhookListResponse, type WebhookDeleteResponse as WebhookDeleteResponse, type WebhookCreateParams as WebhookCreateParams, type WebhookUpdateParams as WebhookUpdateParams, type WebhookDeleteParams as WebhookDeleteParams, };
223
+ }
224
+ //# sourceMappingURL=webhooks.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.d.mts","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,qBAAqB,CAAC;IAI9F;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,qBAAqB,CAAC;IAI9F;;;;;;;OAOG;IACH,IAAI,CAAC,OAAO,CA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CAAC;KACjB;CACF;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,oBAAoB,CAAC;CAChC;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAExB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,cAAc,GAAG,eAAe,GAAG,UAAU,GAAG,iBAAiB,CAAC;CACnG;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
@@ -0,0 +1,224 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import { APIPromise } from "../core/api-promise.js";
3
+ import { RequestOptions } from "../internal/request-options.js";
4
+ export declare class Webhooks extends APIResource {
5
+ /**
6
+ * Add new webhooks to your account. This endpoint appends webhooks to the existing
7
+ * list.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * const webhook = await client.webhooks.create({
12
+ * webhooks: [
13
+ * 'https://example.com/new-webhook',
14
+ * {
15
+ * url: 'https://example.com/webhook-with-secret',
16
+ * secret: 'my-webhook-secret',
17
+ * },
18
+ * ],
19
+ * globalSecret: 'optional-global-secret',
20
+ * type: 'receive',
21
+ * });
22
+ * ```
23
+ */
24
+ create(body: WebhookCreateParams, options?: RequestOptions): APIPromise<WebhookCreateResponse>;
25
+ /**
26
+ * Replace all webhooks for your account. This endpoint completely replaces the
27
+ * existing webhook configuration.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * const webhook = await client.webhooks.update({
32
+ * webhooks: {
33
+ * receive: [
34
+ * 'https://example.com/webhook1',
35
+ * {
36
+ * url: 'https://example.com/webhook2',
37
+ * secret: 'webhook-secret',
38
+ * },
39
+ * ],
40
+ * call_log: ['https://example.com/call-webhook'],
41
+ * contact_created: [
42
+ * 'https://example.com/contact-webhook',
43
+ * ],
44
+ * globalSecret: 'my-global-secret',
45
+ * },
46
+ * });
47
+ * ```
48
+ */
49
+ update(body: WebhookUpdateParams, options?: RequestOptions): APIPromise<WebhookUpdateResponse>;
50
+ /**
51
+ * Get all webhooks configured for your account.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * const webhooks = await client.webhooks.list();
56
+ * ```
57
+ */
58
+ list(options?: RequestOptions): APIPromise<WebhookListResponse>;
59
+ /**
60
+ * Delete specific webhooks from your account.
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * const webhook = await client.webhooks.delete({
65
+ * webhooks: ['https://example.com'],
66
+ * });
67
+ * ```
68
+ */
69
+ delete(body: WebhookDeleteParams, options?: RequestOptions): APIPromise<WebhookDeleteResponse>;
70
+ }
71
+ export interface WebhookConfiguration {
72
+ /**
73
+ * Webhooks for call logs
74
+ */
75
+ call_log?: Array<string | WebhookConfiguration.WebhookObject>;
76
+ /**
77
+ * Webhooks for contact creation (URL strings only)
78
+ */
79
+ contact_created?: Array<string>;
80
+ /**
81
+ * Global secret applied to all webhooks
82
+ */
83
+ globalSecret?: string;
84
+ /**
85
+ * Webhooks for line assignment
86
+ */
87
+ line_assigned?: Array<string | WebhookConfiguration.WebhookObject>;
88
+ /**
89
+ * Webhooks for blocked lines
90
+ */
91
+ line_blocked?: Array<string | WebhookConfiguration.WebhookObject>;
92
+ /**
93
+ * Webhooks for outbound messages
94
+ */
95
+ outbound?: Array<string | WebhookConfiguration.WebhookObject>;
96
+ /**
97
+ * Webhooks for inbound messages
98
+ */
99
+ receive?: Array<string | WebhookConfiguration.WebhookObject>;
100
+ /**
101
+ * Legacy secret field
102
+ */
103
+ secret?: string;
104
+ }
105
+ export declare namespace WebhookConfiguration {
106
+ interface WebhookObject {
107
+ /**
108
+ * Webhook URL (HTTPS only)
109
+ */
110
+ url: string;
111
+ /**
112
+ * Secret for webhook verification
113
+ */
114
+ secret?: string;
115
+ }
116
+ interface WebhookObject {
117
+ /**
118
+ * Webhook URL (HTTPS only)
119
+ */
120
+ url: string;
121
+ /**
122
+ * Secret for webhook verification
123
+ */
124
+ secret?: string;
125
+ }
126
+ interface WebhookObject {
127
+ /**
128
+ * Webhook URL (HTTPS only)
129
+ */
130
+ url: string;
131
+ /**
132
+ * Secret for webhook verification
133
+ */
134
+ secret?: string;
135
+ }
136
+ interface WebhookObject {
137
+ /**
138
+ * Webhook URL (HTTPS only)
139
+ */
140
+ url: string;
141
+ /**
142
+ * Secret for webhook verification
143
+ */
144
+ secret?: string;
145
+ }
146
+ interface WebhookObject {
147
+ /**
148
+ * Webhook URL (HTTPS only)
149
+ */
150
+ url: string;
151
+ /**
152
+ * Secret for webhook verification
153
+ */
154
+ secret?: string;
155
+ }
156
+ }
157
+ export interface WebhookCreateResponse {
158
+ status: 'OK' | 'ERROR';
159
+ message?: string;
160
+ /**
161
+ * Updated webhook configration (partial)
162
+ */
163
+ webhooks?: WebhookConfiguration;
164
+ }
165
+ export interface WebhookUpdateResponse {
166
+ status: 'OK' | 'ERROR';
167
+ message?: string;
168
+ /**
169
+ * Updated webhook configration (partial)
170
+ */
171
+ webhooks?: WebhookConfiguration;
172
+ }
173
+ export interface WebhookListResponse {
174
+ status: 'OK' | 'ERROR';
175
+ message?: string;
176
+ webhooks?: WebhookConfiguration;
177
+ }
178
+ export interface WebhookDeleteResponse {
179
+ status: 'OK' | 'ERROR';
180
+ message?: string;
181
+ }
182
+ export interface WebhookCreateParams {
183
+ /**
184
+ * Array of webhook URLs or webhook objects to add
185
+ */
186
+ webhooks: Array<string | WebhookCreateParams.WebhookObject>;
187
+ /**
188
+ * Optional global secret to apply to all webhooks
189
+ */
190
+ globalSecret?: string;
191
+ /**
192
+ * Webhook type (default to 'receive')
193
+ */
194
+ type?: 'receive' | 'call_log' | 'line_blocked' | 'line_assigned' | 'outbound' | 'contact_created';
195
+ }
196
+ export declare namespace WebhookCreateParams {
197
+ interface WebhookObject {
198
+ /**
199
+ * Webhook URL (HTTPS only)
200
+ */
201
+ url: string;
202
+ /**
203
+ * Secret for webhook verification
204
+ */
205
+ secret?: string;
206
+ }
207
+ }
208
+ export interface WebhookUpdateParams {
209
+ webhooks: WebhookConfiguration;
210
+ }
211
+ export interface WebhookDeleteParams {
212
+ /**
213
+ * Array of webhook URLs to delete
214
+ */
215
+ webhooks: Array<string>;
216
+ /**
217
+ * Webhook type (default to 'receive')
218
+ */
219
+ type?: 'receive' | 'call_log' | 'line_blocked' | 'line_assigned' | 'outbound' | 'contact_created';
220
+ }
221
+ export declare namespace Webhooks {
222
+ export { type WebhookConfiguration as WebhookConfiguration, type WebhookCreateResponse as WebhookCreateResponse, type WebhookUpdateResponse as WebhookUpdateResponse, type WebhookListResponse as WebhookListResponse, type WebhookDeleteResponse as WebhookDeleteResponse, type WebhookCreateParams as WebhookCreateParams, type WebhookUpdateParams as WebhookUpdateParams, type WebhookDeleteParams as WebhookDeleteParams, };
223
+ }
224
+ //# sourceMappingURL=webhooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,qBAAqB,CAAC;IAI9F;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,G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AEG;QACH,GAAG,EAAE,MAAM,CAAC;QAEZ;;WAEG;QACH,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB;CACF;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,oBAAoB,CAAC;CAChC;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAExB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,cAAc,GAAG,eAAe,GAAG,UAAU,GAAG,iBAAiB,CAAC;CACnG;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
@@ -0,0 +1,82 @@
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.js");
6
+ class Webhooks extends resource_1.APIResource {
7
+ /**
8
+ * Add new webhooks to your account. This endpoint appends webhooks to the existing
9
+ * list.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const webhook = await client.webhooks.create({
14
+ * webhooks: [
15
+ * 'https://example.com/new-webhook',
16
+ * {
17
+ * url: 'https://example.com/webhook-with-secret',
18
+ * secret: 'my-webhook-secret',
19
+ * },
20
+ * ],
21
+ * globalSecret: 'optional-global-secret',
22
+ * type: 'receive',
23
+ * });
24
+ * ```
25
+ */
26
+ create(body, options) {
27
+ return this._client.post('/api/v2/account/webhooks', { body, ...options });
28
+ }
29
+ /**
30
+ * Replace all webhooks for your account. This endpoint completely replaces the
31
+ * existing webhook configuration.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const webhook = await client.webhooks.update({
36
+ * webhooks: {
37
+ * receive: [
38
+ * 'https://example.com/webhook1',
39
+ * {
40
+ * url: 'https://example.com/webhook2',
41
+ * secret: 'webhook-secret',
42
+ * },
43
+ * ],
44
+ * call_log: ['https://example.com/call-webhook'],
45
+ * contact_created: [
46
+ * 'https://example.com/contact-webhook',
47
+ * ],
48
+ * globalSecret: 'my-global-secret',
49
+ * },
50
+ * });
51
+ * ```
52
+ */
53
+ update(body, options) {
54
+ return this._client.put('/api/v2/account/webhooks', { body, ...options });
55
+ }
56
+ /**
57
+ * Get all webhooks configured for your account.
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * const webhooks = await client.webhooks.list();
62
+ * ```
63
+ */
64
+ list(options) {
65
+ return this._client.get('/api/v2/account/webhooks', options);
66
+ }
67
+ /**
68
+ * Delete specific webhooks from your account.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const webhook = await client.webhooks.delete({
73
+ * webhooks: ['https://example.com'],
74
+ * });
75
+ * ```
76
+ */
77
+ delete(body, options) {
78
+ return this._client.delete('/api/v2/account/webhooks', { body, ...options });
79
+ }
80
+ }
81
+ exports.Webhooks = Webhooks;
82
+ //# sourceMappingURL=webhooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC;CACF;AA7ED,4BA6EC"}
@@ -0,0 +1,78 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../core/resource.mjs";
3
+ export class Webhooks extends APIResource {
4
+ /**
5
+ * Add new webhooks to your account. This endpoint appends webhooks to the existing
6
+ * list.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const webhook = await client.webhooks.create({
11
+ * webhooks: [
12
+ * 'https://example.com/new-webhook',
13
+ * {
14
+ * url: 'https://example.com/webhook-with-secret',
15
+ * secret: 'my-webhook-secret',
16
+ * },
17
+ * ],
18
+ * globalSecret: 'optional-global-secret',
19
+ * type: 'receive',
20
+ * });
21
+ * ```
22
+ */
23
+ create(body, options) {
24
+ return this._client.post('/api/v2/account/webhooks', { body, ...options });
25
+ }
26
+ /**
27
+ * Replace all webhooks for your account. This endpoint completely replaces the
28
+ * existing webhook configuration.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const webhook = await client.webhooks.update({
33
+ * webhooks: {
34
+ * receive: [
35
+ * 'https://example.com/webhook1',
36
+ * {
37
+ * url: 'https://example.com/webhook2',
38
+ * secret: 'webhook-secret',
39
+ * },
40
+ * ],
41
+ * call_log: ['https://example.com/call-webhook'],
42
+ * contact_created: [
43
+ * 'https://example.com/contact-webhook',
44
+ * ],
45
+ * globalSecret: 'my-global-secret',
46
+ * },
47
+ * });
48
+ * ```
49
+ */
50
+ update(body, options) {
51
+ return this._client.put('/api/v2/account/webhooks', { body, ...options });
52
+ }
53
+ /**
54
+ * Get all webhooks configured for your account.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const webhooks = await client.webhooks.list();
59
+ * ```
60
+ */
61
+ list(options) {
62
+ return this._client.get('/api/v2/account/webhooks', options);
63
+ }
64
+ /**
65
+ * Delete specific webhooks from your account.
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * const webhook = await client.webhooks.delete({
70
+ * webhooks: ['https://example.com'],
71
+ * });
72
+ * ```
73
+ */
74
+ delete(body, options) {
75
+ return this._client.delete('/api/v2/account/webhooks', { body, ...options });
76
+ }
77
+ }
78
+ //# sourceMappingURL=webhooks.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.mjs","sourceRoot":"","sources":["../src/resources/webhooks.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,CAAC,OAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC;CACF"}