getricky 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +138 -2
- package/dist/cjs/client.d.ts +51 -0
- package/dist/cjs/client.js +124 -0
- package/dist/cjs/errors.d.ts +35 -0
- package/dist/cjs/errors.js +55 -0
- package/dist/cjs/generated/client/client.gen.d.ts +2 -0
- package/dist/cjs/generated/client/client.gen.js +220 -0
- package/dist/cjs/generated/client/index.d.ts +10 -0
- package/dist/cjs/generated/client/index.js +17 -0
- package/dist/cjs/generated/client/types.gen.d.ts +120 -0
- package/dist/cjs/generated/client/types.gen.js +3 -0
- package/dist/cjs/generated/client/utils.gen.d.ts +37 -0
- package/dist/cjs/generated/client/utils.gen.js +239 -0
- package/dist/cjs/generated/client.gen.d.ts +12 -0
- package/dist/cjs/generated/client.gen.js +6 -0
- package/dist/cjs/generated/core/auth.gen.d.ts +25 -0
- package/dist/cjs/generated/core/auth.gen.js +18 -0
- package/dist/cjs/generated/core/bodySerializer.gen.d.ts +25 -0
- package/dist/cjs/generated/core/bodySerializer.gen.js +60 -0
- package/dist/cjs/generated/core/params.gen.d.ts +43 -0
- package/dist/cjs/generated/core/params.gen.js +112 -0
- package/dist/cjs/generated/core/pathSerializer.gen.d.ts +33 -0
- package/dist/cjs/generated/core/pathSerializer.gen.js +115 -0
- package/dist/cjs/generated/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/cjs/generated/core/queryKeySerializer.gen.js +98 -0
- package/dist/cjs/generated/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/cjs/generated/core/serverSentEvents.gen.js +135 -0
- package/dist/cjs/generated/core/types.gen.d.ts +83 -0
- package/dist/cjs/generated/core/types.gen.js +3 -0
- package/dist/cjs/generated/core/utils.gen.d.ts +19 -0
- package/dist/cjs/generated/core/utils.gen.js +93 -0
- package/dist/cjs/generated/idempotency.gen.d.ts +2 -0
- package/dist/cjs/generated/idempotency.gen.js +16 -0
- package/dist/cjs/generated/index.d.ts +2 -0
- package/dist/cjs/generated/index.js +6 -0
- package/dist/cjs/generated/sdk.gen.d.ts +259 -0
- package/dist/cjs/generated/sdk.gen.js +493 -0
- package/dist/cjs/generated/types.gen.d.ts +2557 -0
- package/dist/cjs/generated/types.gen.js +3 -0
- package/dist/cjs/index.d.ts +7 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/webhooks.d.ts +25 -0
- package/dist/cjs/webhooks.js +59 -0
- package/dist/esm/client.d.ts +51 -0
- package/dist/esm/client.js +120 -0
- package/dist/esm/errors.d.ts +35 -0
- package/dist/esm/errors.js +49 -0
- package/dist/esm/generated/client/client.gen.d.ts +2 -0
- package/dist/esm/generated/client/client.gen.js +216 -0
- package/dist/esm/generated/client/index.d.ts +10 -0
- package/dist/esm/generated/client/index.js +6 -0
- package/dist/esm/generated/client/types.gen.d.ts +120 -0
- package/dist/esm/generated/client/types.gen.js +2 -0
- package/dist/esm/generated/client/utils.gen.d.ts +37 -0
- package/dist/esm/generated/client/utils.gen.js +228 -0
- package/dist/esm/generated/client.gen.d.ts +12 -0
- package/dist/esm/generated/client.gen.js +3 -0
- package/dist/esm/generated/core/auth.gen.d.ts +25 -0
- package/dist/esm/generated/core/auth.gen.js +14 -0
- package/dist/esm/generated/core/bodySerializer.gen.d.ts +25 -0
- package/dist/esm/generated/core/bodySerializer.gen.js +57 -0
- package/dist/esm/generated/core/params.gen.d.ts +43 -0
- package/dist/esm/generated/core/params.gen.js +109 -0
- package/dist/esm/generated/core/pathSerializer.gen.d.ts +33 -0
- package/dist/esm/generated/core/pathSerializer.gen.js +106 -0
- package/dist/esm/generated/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/esm/generated/core/queryKeySerializer.gen.js +92 -0
- package/dist/esm/generated/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/esm/generated/core/serverSentEvents.gen.js +132 -0
- package/dist/esm/generated/core/types.gen.d.ts +83 -0
- package/dist/esm/generated/core/types.gen.js +2 -0
- package/dist/esm/generated/core/utils.gen.d.ts +19 -0
- package/dist/esm/generated/core/utils.gen.js +87 -0
- package/dist/esm/generated/idempotency.gen.d.ts +2 -0
- package/dist/esm/generated/idempotency.gen.js +13 -0
- package/dist/esm/generated/index.d.ts +2 -0
- package/dist/esm/generated/index.js +2 -0
- package/dist/esm/generated/sdk.gen.d.ts +259 -0
- package/dist/esm/generated/sdk.gen.js +489 -0
- package/dist/esm/generated/types.gen.d.ts +2557 -0
- package/dist/esm/generated/types.gen.js +2 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/webhooks.d.ts +25 -0
- package/dist/esm/webhooks.js +56 -0
- package/package.json +64 -4
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.RickyApi = void 0;
|
|
5
|
+
const client_gen_js_1 = require("./client.gen.js");
|
|
6
|
+
class HeyApiClient {
|
|
7
|
+
client;
|
|
8
|
+
constructor(args) {
|
|
9
|
+
this.client = args?.client ?? client_gen_js_1.client;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
class HeyApiRegistry {
|
|
13
|
+
defaultKey = 'default';
|
|
14
|
+
instances = new Map();
|
|
15
|
+
get(key) {
|
|
16
|
+
const instance = this.instances.get(key ?? this.defaultKey);
|
|
17
|
+
if (!instance) {
|
|
18
|
+
throw new Error(`No SDK client found. Create one with "new RickyApi()" to fix this error.`);
|
|
19
|
+
}
|
|
20
|
+
return instance;
|
|
21
|
+
}
|
|
22
|
+
set(value, key) {
|
|
23
|
+
this.instances.set(key ?? this.defaultKey, value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
class RickyApi extends HeyApiClient {
|
|
27
|
+
static __registry = new HeyApiRegistry();
|
|
28
|
+
constructor(args) {
|
|
29
|
+
super(args);
|
|
30
|
+
RickyApi.__registry.set(this, args?.key);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* List contacts
|
|
34
|
+
*
|
|
35
|
+
* Most recently updated first. Filters combine.
|
|
36
|
+
*
|
|
37
|
+
* Scope: `contacts:read`.
|
|
38
|
+
*/
|
|
39
|
+
listContacts(options) {
|
|
40
|
+
return (options?.client ?? this.client).get({
|
|
41
|
+
responseStyle: 'data',
|
|
42
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
43
|
+
url: '/contacts',
|
|
44
|
+
...options
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create a contact
|
|
49
|
+
*
|
|
50
|
+
* Creates a CRM contact. It does not message anyone; to reach a phone, start a conversation.
|
|
51
|
+
*
|
|
52
|
+
* Scope: `contacts:write`.
|
|
53
|
+
*/
|
|
54
|
+
createContact(options) {
|
|
55
|
+
return (options.client ?? this.client).post({
|
|
56
|
+
responseStyle: 'data',
|
|
57
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
58
|
+
url: '/contacts',
|
|
59
|
+
...options,
|
|
60
|
+
headers: {
|
|
61
|
+
'Content-Type': 'application/json',
|
|
62
|
+
...options.headers
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get a contact
|
|
68
|
+
*
|
|
69
|
+
* One contact with its tags, identities and custom values.
|
|
70
|
+
*
|
|
71
|
+
* Scope: `contacts:read`.
|
|
72
|
+
*/
|
|
73
|
+
getContact(options) {
|
|
74
|
+
return (options.client ?? this.client).get({
|
|
75
|
+
responseStyle: 'data',
|
|
76
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
77
|
+
url: '/contacts/{contact_id}',
|
|
78
|
+
...options
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Update a contact
|
|
83
|
+
*
|
|
84
|
+
* Changes only the fields in the body. `tag_ids` replaces the whole tag set; `custom_values` merges by key.
|
|
85
|
+
*
|
|
86
|
+
* Scope: `contacts:write`.
|
|
87
|
+
*/
|
|
88
|
+
updateContact(options) {
|
|
89
|
+
return (options.client ?? this.client).patch({
|
|
90
|
+
responseStyle: 'data',
|
|
91
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
92
|
+
url: '/contacts/{contact_id}',
|
|
93
|
+
...options,
|
|
94
|
+
headers: {
|
|
95
|
+
'Content-Type': 'application/json',
|
|
96
|
+
...options.headers
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Add a note to a contact
|
|
102
|
+
*
|
|
103
|
+
* Adds text after the current `notes`, separated by a blank line, and answers the contact. To replace the notes, update the contact.
|
|
104
|
+
*
|
|
105
|
+
* Scope: `contacts:write`.
|
|
106
|
+
*/
|
|
107
|
+
addContactNote(options) {
|
|
108
|
+
return (options.client ?? this.client).post({
|
|
109
|
+
responseStyle: 'data',
|
|
110
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
111
|
+
url: '/contacts/{contact_id}/notes',
|
|
112
|
+
...options,
|
|
113
|
+
headers: {
|
|
114
|
+
'Content-Type': 'application/json',
|
|
115
|
+
...options.headers
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* List contact fields
|
|
121
|
+
*
|
|
122
|
+
* The custom fields whose IDs key `custom_values`.
|
|
123
|
+
*
|
|
124
|
+
* Scope: `contacts:read`.
|
|
125
|
+
*/
|
|
126
|
+
listContactFields(options) {
|
|
127
|
+
return (options?.client ?? this.client).get({
|
|
128
|
+
responseStyle: 'data',
|
|
129
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
130
|
+
url: '/contact-fields',
|
|
131
|
+
...options
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* List conversations
|
|
136
|
+
*
|
|
137
|
+
* Latest activity first.
|
|
138
|
+
*
|
|
139
|
+
* Scope: `conversations:read`.
|
|
140
|
+
*/
|
|
141
|
+
listConversations(options) {
|
|
142
|
+
return (options?.client ?? this.client).get({
|
|
143
|
+
responseStyle: 'data',
|
|
144
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
145
|
+
url: '/conversations',
|
|
146
|
+
...options
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Start a conversation
|
|
151
|
+
*
|
|
152
|
+
* Sends an approved WhatsApp template to a phone number. Ricky finds or creates the contact and reuses the number's conversation on that channel. Answers `202`: the send is queued; follow it with `GET /sends/{send_id}`.
|
|
153
|
+
*
|
|
154
|
+
* Scope: `messages:send`.
|
|
155
|
+
*/
|
|
156
|
+
startConversation(options) {
|
|
157
|
+
return (options.client ?? this.client).post({
|
|
158
|
+
responseStyle: 'data',
|
|
159
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
160
|
+
url: '/conversations',
|
|
161
|
+
...options,
|
|
162
|
+
headers: {
|
|
163
|
+
'Content-Type': 'application/json',
|
|
164
|
+
...options.headers
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Get a conversation
|
|
170
|
+
*
|
|
171
|
+
* One conversation.
|
|
172
|
+
*
|
|
173
|
+
* Scope: `conversations:read`.
|
|
174
|
+
*/
|
|
175
|
+
getConversation(options) {
|
|
176
|
+
return (options.client ?? this.client).get({
|
|
177
|
+
responseStyle: 'data',
|
|
178
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
179
|
+
url: '/conversations/{conversation_id}',
|
|
180
|
+
...options
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Assign a conversation
|
|
185
|
+
*
|
|
186
|
+
* Makes a member responsible for the conversation, or unassigns it.
|
|
187
|
+
*
|
|
188
|
+
* Scope: `conversations:write`.
|
|
189
|
+
*/
|
|
190
|
+
assignConversation(options) {
|
|
191
|
+
return (options.client ?? this.client).patch({
|
|
192
|
+
responseStyle: 'data',
|
|
193
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
194
|
+
url: '/conversations/{conversation_id}/assignment',
|
|
195
|
+
...options,
|
|
196
|
+
headers: {
|
|
197
|
+
'Content-Type': 'application/json',
|
|
198
|
+
...options.headers
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Close a conversation
|
|
204
|
+
*
|
|
205
|
+
* Closing an already closed conversation changes nothing.
|
|
206
|
+
*
|
|
207
|
+
* Scope: `conversations:write`.
|
|
208
|
+
*/
|
|
209
|
+
closeConversation(options) {
|
|
210
|
+
return (options.client ?? this.client).post({
|
|
211
|
+
responseStyle: 'data',
|
|
212
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
213
|
+
url: '/conversations/{conversation_id}/close',
|
|
214
|
+
...options,
|
|
215
|
+
headers: {
|
|
216
|
+
'Content-Type': 'application/json',
|
|
217
|
+
...options.headers
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Reopen a conversation
|
|
223
|
+
*
|
|
224
|
+
* Reopening an open conversation changes nothing. Send no body.
|
|
225
|
+
*
|
|
226
|
+
* Scope: `conversations:write`.
|
|
227
|
+
*/
|
|
228
|
+
reopenConversation(options) {
|
|
229
|
+
return (options.client ?? this.client).post({
|
|
230
|
+
responseStyle: 'data',
|
|
231
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
232
|
+
url: '/conversations/{conversation_id}/reopen',
|
|
233
|
+
...options
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* List messages
|
|
238
|
+
*
|
|
239
|
+
* Newest first.
|
|
240
|
+
*
|
|
241
|
+
* Scope: `conversations:read`.
|
|
242
|
+
*/
|
|
243
|
+
listMessages(options) {
|
|
244
|
+
return (options.client ?? this.client).get({
|
|
245
|
+
responseStyle: 'data',
|
|
246
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
247
|
+
url: '/conversations/{conversation_id}/messages',
|
|
248
|
+
...options
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Send a message
|
|
253
|
+
*
|
|
254
|
+
* Sends text, a file on WhatsApp or Instagram, or a template on WhatsApp. For a file, Ricky downloads `media.url` before answering. Answers `202`: the send is queued; follow it with `GET /sends/{send_id}`. A `message.sent` webhook fires once the provider accepts it.
|
|
255
|
+
*
|
|
256
|
+
* Scope: `messages:send`.
|
|
257
|
+
*/
|
|
258
|
+
sendMessage(options) {
|
|
259
|
+
return (options.client ?? this.client).post({
|
|
260
|
+
responseStyle: 'data',
|
|
261
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
262
|
+
url: '/conversations/{conversation_id}/messages',
|
|
263
|
+
...options,
|
|
264
|
+
headers: {
|
|
265
|
+
'Content-Type': 'application/json',
|
|
266
|
+
...options.headers
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Get a message
|
|
272
|
+
*
|
|
273
|
+
* One message, as the list shows it. A media `url` is signed again on each read.
|
|
274
|
+
*
|
|
275
|
+
* Scope: `conversations:read`.
|
|
276
|
+
*/
|
|
277
|
+
getMessage(options) {
|
|
278
|
+
return (options.client ?? this.client).get({
|
|
279
|
+
responseStyle: 'data',
|
|
280
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
281
|
+
url: '/conversations/{conversation_id}/messages/{message_id}',
|
|
282
|
+
...options
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Get a send
|
|
287
|
+
*
|
|
288
|
+
* Whether the provider accepted a message, and why not if it failed.
|
|
289
|
+
*
|
|
290
|
+
* Scope: `messages:send`.
|
|
291
|
+
*/
|
|
292
|
+
getSend(options) {
|
|
293
|
+
return (options.client ?? this.client).get({
|
|
294
|
+
responseStyle: 'data',
|
|
295
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
296
|
+
url: '/sends/{send_id}',
|
|
297
|
+
...options
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* List channels
|
|
302
|
+
*
|
|
303
|
+
* WhatsApp numbers, Instagram accounts and Facebook pages.
|
|
304
|
+
*
|
|
305
|
+
* Scope: `conversations:read`.
|
|
306
|
+
*/
|
|
307
|
+
listChannels(options) {
|
|
308
|
+
return (options?.client ?? this.client).get({
|
|
309
|
+
responseStyle: 'data',
|
|
310
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
311
|
+
url: '/channels',
|
|
312
|
+
...options
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* List members
|
|
317
|
+
*
|
|
318
|
+
* People in the organization; their IDs assign conversations and own contacts.
|
|
319
|
+
*
|
|
320
|
+
* Scope: `members:read`.
|
|
321
|
+
*/
|
|
322
|
+
listMembers(options) {
|
|
323
|
+
return (options?.client ?? this.client).get({
|
|
324
|
+
responseStyle: 'data',
|
|
325
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
326
|
+
url: '/members',
|
|
327
|
+
...options
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* List tags
|
|
332
|
+
*
|
|
333
|
+
* Contact tags.
|
|
334
|
+
*
|
|
335
|
+
* Scope: `tags:read`.
|
|
336
|
+
*/
|
|
337
|
+
listTags(options) {
|
|
338
|
+
return (options?.client ?? this.client).get({
|
|
339
|
+
responseStyle: 'data',
|
|
340
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
341
|
+
url: '/tags',
|
|
342
|
+
...options
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Create a tag
|
|
347
|
+
*
|
|
348
|
+
* Creates a contact tag. Apply it with `tag_ids` on a contact. A name already in use, in any case, answers `409 conflict`.
|
|
349
|
+
*
|
|
350
|
+
* Scope: `contacts:write`.
|
|
351
|
+
*/
|
|
352
|
+
createTag(options) {
|
|
353
|
+
return (options.client ?? this.client).post({
|
|
354
|
+
responseStyle: 'data',
|
|
355
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
356
|
+
url: '/tags',
|
|
357
|
+
...options,
|
|
358
|
+
headers: {
|
|
359
|
+
'Content-Type': 'application/json',
|
|
360
|
+
...options.headers
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* List templates
|
|
366
|
+
*
|
|
367
|
+
* WhatsApp templates of every connected business account, read live from Meta.
|
|
368
|
+
*
|
|
369
|
+
* Scope: `templates:read`.
|
|
370
|
+
*/
|
|
371
|
+
listTemplates(options) {
|
|
372
|
+
return (options?.client ?? this.client).get({
|
|
373
|
+
responseStyle: 'data',
|
|
374
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
375
|
+
url: '/templates',
|
|
376
|
+
...options
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* List webhooks
|
|
381
|
+
*
|
|
382
|
+
* Newest first, at most 100.
|
|
383
|
+
*
|
|
384
|
+
* Scope: `webhooks:manage`.
|
|
385
|
+
*/
|
|
386
|
+
listWebhooks(options) {
|
|
387
|
+
return (options?.client ?? this.client).get({
|
|
388
|
+
responseStyle: 'data',
|
|
389
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
390
|
+
url: '/webhooks',
|
|
391
|
+
...options
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Create a webhook
|
|
396
|
+
*
|
|
397
|
+
* The response carries `signing_secret`, the only time Ricky shows it.
|
|
398
|
+
*
|
|
399
|
+
* Scope: `webhooks:manage`.
|
|
400
|
+
*/
|
|
401
|
+
createWebhook(options) {
|
|
402
|
+
return (options.client ?? this.client).post({
|
|
403
|
+
responseStyle: 'data',
|
|
404
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
405
|
+
url: '/webhooks',
|
|
406
|
+
...options,
|
|
407
|
+
headers: {
|
|
408
|
+
'Content-Type': 'application/json',
|
|
409
|
+
...options.headers
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Disable a webhook
|
|
415
|
+
*
|
|
416
|
+
* Stops new and pending deliveries. Disabling twice answers `404`.
|
|
417
|
+
*
|
|
418
|
+
* Scope: `webhooks:manage`.
|
|
419
|
+
*/
|
|
420
|
+
disableWebhook(options) {
|
|
421
|
+
return (options.client ?? this.client).delete({
|
|
422
|
+
responseStyle: 'data',
|
|
423
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
424
|
+
url: '/webhooks/{webhook_id}',
|
|
425
|
+
...options
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Send a test event
|
|
430
|
+
*
|
|
431
|
+
* Sends one signed `webhook.test` event to the endpoint now and answers what it replied. It is not recorded as a delivery and is not retried.
|
|
432
|
+
*
|
|
433
|
+
* Scope: `webhooks:manage`.
|
|
434
|
+
*/
|
|
435
|
+
testWebhook(options) {
|
|
436
|
+
return (options.client ?? this.client).post({
|
|
437
|
+
responseStyle: 'data',
|
|
438
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
439
|
+
url: '/webhooks/{webhook_id}/test',
|
|
440
|
+
...options
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Rotate the signing secret
|
|
445
|
+
*
|
|
446
|
+
* Returns a new `signing_secret`, the only time Ricky shows it. Until `expire_previous_after_hours` passes, every delivery carries two signatures in `X-Ricky-Signature`, new first, so you can deploy the new secret without missing events. The body is optional.
|
|
447
|
+
*
|
|
448
|
+
* Scope: `webhooks:manage`.
|
|
449
|
+
*/
|
|
450
|
+
rotateWebhookSecret(options) {
|
|
451
|
+
return (options.client ?? this.client).post({
|
|
452
|
+
responseStyle: 'data',
|
|
453
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
454
|
+
url: '/webhooks/{webhook_id}/rotate-secret',
|
|
455
|
+
...options,
|
|
456
|
+
headers: {
|
|
457
|
+
'Content-Type': 'application/json',
|
|
458
|
+
...options.headers
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* List deliveries
|
|
464
|
+
*
|
|
465
|
+
* The 100 most recent deliveries of a webhook.
|
|
466
|
+
*
|
|
467
|
+
* Scope: `webhooks:manage`.
|
|
468
|
+
*/
|
|
469
|
+
listWebhookDeliveries(options) {
|
|
470
|
+
return (options.client ?? this.client).get({
|
|
471
|
+
responseStyle: 'data',
|
|
472
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
473
|
+
url: '/webhooks/{webhook_id}/deliveries',
|
|
474
|
+
...options
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Retry a delivery
|
|
479
|
+
*
|
|
480
|
+
* Queues a failed delivery again with a fresh attempt budget and sends it at once.
|
|
481
|
+
*
|
|
482
|
+
* Scope: `webhooks:manage`.
|
|
483
|
+
*/
|
|
484
|
+
retryWebhookDelivery(options) {
|
|
485
|
+
return (options.client ?? this.client).post({
|
|
486
|
+
responseStyle: 'data',
|
|
487
|
+
security: [{ scheme: 'bearer', type: 'http' }],
|
|
488
|
+
url: '/webhooks/{webhook_id}/deliveries/{delivery_id}/retry',
|
|
489
|
+
...options
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
exports.RickyApi = RickyApi;
|