@formbricks/hub 0.2.0 → 0.4.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.
- package/CHANGELOG.md +72 -0
- package/README.md +2 -2
- package/client.d.mts +15 -3
- package/client.d.mts.map +1 -1
- package/client.d.ts +15 -3
- package/client.d.ts.map +1 -1
- package/client.js +28 -18
- package/client.js.map +1 -1
- package/client.mjs +28 -18
- package/client.mjs.map +1 -1
- package/internal/tslib.js +17 -17
- package/internal/utils/query.d.mts +5 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +5 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +23 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +20 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils.d.mts +1 -0
- package/internal/utils.d.ts +1 -0
- package/internal/utils.js +1 -0
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs +1 -0
- package/package.json +7 -1
- package/resources/feedback-records/feedback-records.d.mts +473 -0
- package/resources/feedback-records/feedback-records.d.mts.map +1 -0
- package/resources/feedback-records/feedback-records.d.ts +473 -0
- package/resources/feedback-records/feedback-records.d.ts.map +1 -0
- package/resources/feedback-records/feedback-records.js +139 -0
- package/resources/feedback-records/feedback-records.js.map +1 -0
- package/resources/feedback-records/feedback-records.mjs +134 -0
- package/resources/feedback-records/feedback-records.mjs.map +1 -0
- package/resources/feedback-records/index.d.mts +3 -0
- package/resources/feedback-records/index.d.mts.map +1 -0
- package/resources/feedback-records/index.d.ts +3 -0
- package/resources/feedback-records/index.d.ts.map +1 -0
- package/resources/feedback-records/index.js +9 -0
- package/resources/feedback-records/index.js.map +1 -0
- package/resources/feedback-records/index.mjs +4 -0
- package/resources/feedback-records/index.mjs.map +1 -0
- package/resources/feedback-records/search.d.mts +98 -0
- package/resources/feedback-records/search.d.mts.map +1 -0
- package/resources/feedback-records/search.d.ts +98 -0
- package/resources/feedback-records/search.d.ts.map +1 -0
- package/resources/feedback-records/search.js +38 -0
- package/resources/feedback-records/search.js.map +1 -0
- package/resources/feedback-records/search.mjs +34 -0
- package/resources/feedback-records/search.mjs.map +1 -0
- package/resources/feedback-records.d.mts +1 -369
- package/resources/feedback-records.d.mts.map +1 -1
- package/resources/feedback-records.d.ts +1 -369
- package/resources/feedback-records.d.ts.map +1 -1
- package/resources/feedback-records.js +2 -102
- package/resources/feedback-records.js.map +1 -1
- package/resources/feedback-records.mjs +1 -100
- package/resources/feedback-records.mjs.map +1 -1
- package/resources/health.d.mts +3 -0
- package/resources/health.d.mts.map +1 -1
- package/resources/health.d.ts +3 -0
- package/resources/health.d.ts.map +1 -1
- package/resources/health.js +3 -0
- package/resources/health.js.map +1 -1
- package/resources/health.mjs +3 -0
- package/resources/health.mjs.map +1 -1
- package/resources/index.d.mts +2 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +4 -2
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -1
- package/resources/index.mjs.map +1 -1
- package/resources/webhooks.d.mts +338 -0
- package/resources/webhooks.d.mts.map +1 -0
- package/resources/webhooks.d.ts +338 -0
- package/resources/webhooks.d.ts.map +1 -0
- package/resources/webhooks.js +91 -0
- package/resources/webhooks.js.map +1 -0
- package/resources/webhooks.mjs +87 -0
- package/resources/webhooks.mjs.map +1 -0
- package/src/client.ts +56 -23
- package/src/internal/utils/query.ts +23 -0
- package/src/internal/utils.ts +1 -0
- package/src/resources/feedback-records/feedback-records.ts +601 -0
- package/src/resources/feedback-records/index.ts +19 -0
- package/src/resources/feedback-records/search.ts +126 -0
- package/src/resources/feedback-records.ts +1 -469
- package/src/resources/health.ts +3 -0
- package/src/resources/index.ts +13 -1
- package/src/resources/webhooks.ts +469 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { APIResource } from "../core/resource.js";
|
|
2
|
+
import { APIPromise } from "../core/api-promise.js";
|
|
3
|
+
import { RequestOptions } from "../internal/request-options.js";
|
|
4
|
+
/**
|
|
5
|
+
* Webhook subscription management
|
|
6
|
+
*/
|
|
7
|
+
export declare class Webhooks extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new webhook endpoint. When events occur (e.g.
|
|
10
|
+
* feedback*record.created), the Hub POSTs a signed payload to the webhook URL. If
|
|
11
|
+
* signing_key is omitted, a key is auto-generated (Standard Webhooks format,
|
|
12
|
+
* whsec*...). See WebhookDeliveryPayload for the payload structure sent to your
|
|
13
|
+
* URL.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const webhook = await client.webhooks.create({
|
|
18
|
+
* url: 'https://example.com/hub-events',
|
|
19
|
+
* enabled: true,
|
|
20
|
+
* event_types: [
|
|
21
|
+
* 'feedback_record.created',
|
|
22
|
+
* 'feedback_record.updated',
|
|
23
|
+
* 'feedback_record.deleted',
|
|
24
|
+
* ],
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
create(body: WebhookCreateParams, options?: RequestOptions): APIPromise<WebhookCreateResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* Retrieves a single webhook endpoint by its UUID. signing_key is omitted for
|
|
31
|
+
* security.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const webhook = await client.webhooks.retrieve(
|
|
36
|
+
* '018e1234-5678-9abc-def0-123456789abc',
|
|
37
|
+
* );
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<WebhookRetrieveResponse>;
|
|
41
|
+
/**
|
|
42
|
+
* Updates specific fields of a webhook endpoint
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const webhook = await client.webhooks.update(
|
|
47
|
+
* '018e1234-5678-9abc-def0-123456789abc',
|
|
48
|
+
* );
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
update(id: string, body: WebhookUpdateParams, options?: RequestOptions): APIPromise<WebhookUpdateResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* Lists webhook endpoints with optional filters and pagination
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const webhooks = await client.webhooks.list();
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
list(query?: WebhookListParams | null | undefined, options?: RequestOptions): APIPromise<WebhookListResponse>;
|
|
61
|
+
/**
|
|
62
|
+
* Permanently deletes a webhook endpoint. It will no longer receive events.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* await client.webhooks.delete(
|
|
67
|
+
* '018e1234-5678-9abc-def0-123456789abc',
|
|
68
|
+
* );
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
delete(id: string, options?: RequestOptions): APIPromise<void>;
|
|
72
|
+
}
|
|
73
|
+
export interface WebhookCreateResponse {
|
|
74
|
+
/**
|
|
75
|
+
* Webhook ID (UUID)
|
|
76
|
+
*/
|
|
77
|
+
id: string;
|
|
78
|
+
/**
|
|
79
|
+
* When the webhook was created
|
|
80
|
+
*/
|
|
81
|
+
created_at: string;
|
|
82
|
+
/**
|
|
83
|
+
* Whether the webhook is active
|
|
84
|
+
*/
|
|
85
|
+
enabled: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Key used to sign payloads (Standard Webhooks)
|
|
88
|
+
*/
|
|
89
|
+
signing_key: string;
|
|
90
|
+
/**
|
|
91
|
+
* When the webhook was last updated
|
|
92
|
+
*/
|
|
93
|
+
updated_at: string;
|
|
94
|
+
/**
|
|
95
|
+
* URL that receives webhook POSTs
|
|
96
|
+
*/
|
|
97
|
+
url: string;
|
|
98
|
+
/**
|
|
99
|
+
* Read-only. When the webhook was disabled. Omitted when null. Cleared when the
|
|
100
|
+
* webhook is re-enabled via PATCH.
|
|
101
|
+
*/
|
|
102
|
+
disabled_at?: string | null;
|
|
103
|
+
/**
|
|
104
|
+
* Read-only. Set by the system when the webhook was disabled (e.g. after 410 Gone
|
|
105
|
+
* or max delivery failures). Omitted when null.
|
|
106
|
+
*/
|
|
107
|
+
disabled_reason?: string | null;
|
|
108
|
+
/**
|
|
109
|
+
* Event types this webhook subscribes to (empty = all)
|
|
110
|
+
*/
|
|
111
|
+
event_types?: Array<'feedback_record.created' | 'feedback_record.updated' | 'feedback_record.deleted' | 'webhook.created' | 'webhook.updated' | 'webhook.deleted'>;
|
|
112
|
+
/**
|
|
113
|
+
* Tenant/organization identifier
|
|
114
|
+
*/
|
|
115
|
+
tenant_id?: string;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Webhook data for GET and LIST responses; signing_key is omitted for security
|
|
119
|
+
*/
|
|
120
|
+
export interface WebhookRetrieveResponse {
|
|
121
|
+
/**
|
|
122
|
+
* Webhook ID (UUID)
|
|
123
|
+
*/
|
|
124
|
+
id: string;
|
|
125
|
+
/**
|
|
126
|
+
* When the webhook was created
|
|
127
|
+
*/
|
|
128
|
+
created_at: string;
|
|
129
|
+
/**
|
|
130
|
+
* Whether the webhook is active
|
|
131
|
+
*/
|
|
132
|
+
enabled: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* When the webhook was last updated
|
|
135
|
+
*/
|
|
136
|
+
updated_at: string;
|
|
137
|
+
/**
|
|
138
|
+
* URL that receives webhook POSTs
|
|
139
|
+
*/
|
|
140
|
+
url: string;
|
|
141
|
+
/**
|
|
142
|
+
* Read-only. When the webhook was disabled. Omitted when null.
|
|
143
|
+
*/
|
|
144
|
+
disabled_at?: string | null;
|
|
145
|
+
/**
|
|
146
|
+
* Read-only. Set by the system when the webhook was disabled. Omitted when null.
|
|
147
|
+
*/
|
|
148
|
+
disabled_reason?: string | null;
|
|
149
|
+
/**
|
|
150
|
+
* Event types this webhook subscribes to (empty = all)
|
|
151
|
+
*/
|
|
152
|
+
event_types?: Array<'feedback_record.created' | 'feedback_record.updated' | 'feedback_record.deleted' | 'webhook.created' | 'webhook.updated' | 'webhook.deleted'>;
|
|
153
|
+
/**
|
|
154
|
+
* Tenant/organization identifier
|
|
155
|
+
*/
|
|
156
|
+
tenant_id?: string;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Webhook data for GET and LIST responses; signing_key is omitted for security
|
|
160
|
+
*/
|
|
161
|
+
export interface WebhookUpdateResponse {
|
|
162
|
+
/**
|
|
163
|
+
* Webhook ID (UUID)
|
|
164
|
+
*/
|
|
165
|
+
id: string;
|
|
166
|
+
/**
|
|
167
|
+
* When the webhook was created
|
|
168
|
+
*/
|
|
169
|
+
created_at: string;
|
|
170
|
+
/**
|
|
171
|
+
* Whether the webhook is active
|
|
172
|
+
*/
|
|
173
|
+
enabled: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* When the webhook was last updated
|
|
176
|
+
*/
|
|
177
|
+
updated_at: string;
|
|
178
|
+
/**
|
|
179
|
+
* URL that receives webhook POSTs
|
|
180
|
+
*/
|
|
181
|
+
url: string;
|
|
182
|
+
/**
|
|
183
|
+
* Read-only. When the webhook was disabled. Omitted when null.
|
|
184
|
+
*/
|
|
185
|
+
disabled_at?: string | null;
|
|
186
|
+
/**
|
|
187
|
+
* Read-only. Set by the system when the webhook was disabled. Omitted when null.
|
|
188
|
+
*/
|
|
189
|
+
disabled_reason?: string | null;
|
|
190
|
+
/**
|
|
191
|
+
* Event types this webhook subscribes to (empty = all)
|
|
192
|
+
*/
|
|
193
|
+
event_types?: Array<'feedback_record.created' | 'feedback_record.updated' | 'feedback_record.deleted' | 'webhook.created' | 'webhook.updated' | 'webhook.deleted'>;
|
|
194
|
+
/**
|
|
195
|
+
* Tenant/organization identifier
|
|
196
|
+
*/
|
|
197
|
+
tenant_id?: string;
|
|
198
|
+
}
|
|
199
|
+
export interface WebhookListResponse {
|
|
200
|
+
/**
|
|
201
|
+
* List of webhooks (signing_key omitted for security)
|
|
202
|
+
*/
|
|
203
|
+
data: Array<WebhookListResponse.Data>;
|
|
204
|
+
/**
|
|
205
|
+
* Limit used in query
|
|
206
|
+
*/
|
|
207
|
+
limit: number;
|
|
208
|
+
/**
|
|
209
|
+
* Opaque cursor for the next page (keyset paging). Present only when there may be
|
|
210
|
+
* more results. Use as the cursor query param for the next page.
|
|
211
|
+
*/
|
|
212
|
+
next_cursor?: string;
|
|
213
|
+
/**
|
|
214
|
+
* Offset used in query (present when offset-based; omitted when using cursor)
|
|
215
|
+
*/
|
|
216
|
+
offset?: number;
|
|
217
|
+
/**
|
|
218
|
+
* Total count matching filters (present when offset-based; omitted when using
|
|
219
|
+
* cursor)
|
|
220
|
+
*/
|
|
221
|
+
total?: number;
|
|
222
|
+
}
|
|
223
|
+
export declare namespace WebhookListResponse {
|
|
224
|
+
/**
|
|
225
|
+
* Webhook data for GET and LIST responses; signing_key is omitted for security
|
|
226
|
+
*/
|
|
227
|
+
interface Data {
|
|
228
|
+
/**
|
|
229
|
+
* Webhook ID (UUID)
|
|
230
|
+
*/
|
|
231
|
+
id: string;
|
|
232
|
+
/**
|
|
233
|
+
* When the webhook was created
|
|
234
|
+
*/
|
|
235
|
+
created_at: string;
|
|
236
|
+
/**
|
|
237
|
+
* Whether the webhook is active
|
|
238
|
+
*/
|
|
239
|
+
enabled: boolean;
|
|
240
|
+
/**
|
|
241
|
+
* When the webhook was last updated
|
|
242
|
+
*/
|
|
243
|
+
updated_at: string;
|
|
244
|
+
/**
|
|
245
|
+
* URL that receives webhook POSTs
|
|
246
|
+
*/
|
|
247
|
+
url: string;
|
|
248
|
+
/**
|
|
249
|
+
* Read-only. When the webhook was disabled. Omitted when null.
|
|
250
|
+
*/
|
|
251
|
+
disabled_at?: string | null;
|
|
252
|
+
/**
|
|
253
|
+
* Read-only. Set by the system when the webhook was disabled. Omitted when null.
|
|
254
|
+
*/
|
|
255
|
+
disabled_reason?: string | null;
|
|
256
|
+
/**
|
|
257
|
+
* Event types this webhook subscribes to (empty = all)
|
|
258
|
+
*/
|
|
259
|
+
event_types?: Array<'feedback_record.created' | 'feedback_record.updated' | 'feedback_record.deleted' | 'webhook.created' | 'webhook.updated' | 'webhook.deleted'>;
|
|
260
|
+
/**
|
|
261
|
+
* Tenant/organization identifier
|
|
262
|
+
*/
|
|
263
|
+
tenant_id?: string;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
export interface WebhookCreateParams {
|
|
267
|
+
/**
|
|
268
|
+
* URL to receive webhook POSTs. Must be an HTTP or HTTPS URL. NULL bytes not
|
|
269
|
+
* allowed.
|
|
270
|
+
*/
|
|
271
|
+
url: string;
|
|
272
|
+
/**
|
|
273
|
+
* Whether the webhook is active (default true)
|
|
274
|
+
*/
|
|
275
|
+
enabled?: boolean;
|
|
276
|
+
/**
|
|
277
|
+
* Event types this webhook subscribes to. Each value must be one of
|
|
278
|
+
* WebhookEventType. If empty, the webhook receives all event types.
|
|
279
|
+
*/
|
|
280
|
+
event_types?: Array<'feedback_record.created' | 'feedback_record.updated' | 'feedback_record.deleted' | 'webhook.created' | 'webhook.updated' | 'webhook.deleted'>;
|
|
281
|
+
/**
|
|
282
|
+
* Optional. If omitted, a key is auto-generated (whsec\_...). Used to sign
|
|
283
|
+
* payloads (Standard Webhooks). When provided, max 255 characters; NULL bytes not
|
|
284
|
+
* allowed.
|
|
285
|
+
*/
|
|
286
|
+
signing_key?: string;
|
|
287
|
+
/**
|
|
288
|
+
* Tenant/organization identifier. NULL bytes not allowed.
|
|
289
|
+
*/
|
|
290
|
+
tenant_id?: string;
|
|
291
|
+
}
|
|
292
|
+
export interface WebhookUpdateParams {
|
|
293
|
+
/**
|
|
294
|
+
* Enable or disable the webhook
|
|
295
|
+
*/
|
|
296
|
+
enabled?: boolean;
|
|
297
|
+
/**
|
|
298
|
+
* New list of event types (use empty array to clear). Each value must be one of
|
|
299
|
+
* WebhookEventType.
|
|
300
|
+
*/
|
|
301
|
+
event_types?: Array<'feedback_record.created' | 'feedback_record.updated' | 'feedback_record.deleted' | 'webhook.created' | 'webhook.updated' | 'webhook.deleted'>;
|
|
302
|
+
/**
|
|
303
|
+
* New signing key. NULL bytes not allowed.
|
|
304
|
+
*/
|
|
305
|
+
signing_key?: string;
|
|
306
|
+
/**
|
|
307
|
+
* Omit or send null to leave unchanged. Send empty string to clear (store as
|
|
308
|
+
* null).
|
|
309
|
+
*/
|
|
310
|
+
tenant_id?: string | null;
|
|
311
|
+
/**
|
|
312
|
+
* New webhook URL. Must be an HTTP or HTTPS URL. NULL bytes not allowed.
|
|
313
|
+
*/
|
|
314
|
+
url?: string;
|
|
315
|
+
}
|
|
316
|
+
export interface WebhookListParams {
|
|
317
|
+
/**
|
|
318
|
+
* Omit for the first page. For the next page, use the exact value from the
|
|
319
|
+
* previous response's next_cursor. Opaque (base64-encoded); keyset pagination.
|
|
320
|
+
*/
|
|
321
|
+
cursor?: string;
|
|
322
|
+
/**
|
|
323
|
+
* Filter by enabled status
|
|
324
|
+
*/
|
|
325
|
+
enabled?: boolean;
|
|
326
|
+
/**
|
|
327
|
+
* Number of results to return (max 1000)
|
|
328
|
+
*/
|
|
329
|
+
limit?: number;
|
|
330
|
+
/**
|
|
331
|
+
* Filter by tenant ID. NULL bytes not allowed.
|
|
332
|
+
*/
|
|
333
|
+
tenant_id?: string;
|
|
334
|
+
}
|
|
335
|
+
export declare namespace Webhooks {
|
|
336
|
+
export { type WebhookCreateResponse as WebhookCreateResponse, type WebhookRetrieveResponse as WebhookRetrieveResponse, type WebhookUpdateResponse as WebhookUpdateResponse, type WebhookListResponse as WebhookListResponse, type WebhookCreateParams as WebhookCreateParams, type WebhookUpdateParams as WebhookUpdateParams, type WebhookListParams as WebhookListParams, };
|
|
337
|
+
}
|
|
338
|
+
//# sourceMappingURL=webhooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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B,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,CACpB,CAAC;IAEF;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,WAAW,CAAC,EAAE,KAAK,CACf,yBAAyB,GACzB,yBAAyB,GACzB,yBAAyB,GACzB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,CACpB,CAAC;IAEF;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;CACH"}
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
const headers_1 = require("../internal/headers.js");
|
|
7
|
+
const path_1 = require("../internal/utils/path.js");
|
|
8
|
+
/**
|
|
9
|
+
* Webhook subscription management
|
|
10
|
+
*/
|
|
11
|
+
class Webhooks extends resource_1.APIResource {
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new webhook endpoint. When events occur (e.g.
|
|
14
|
+
* feedback*record.created), the Hub POSTs a signed payload to the webhook URL. If
|
|
15
|
+
* signing_key is omitted, a key is auto-generated (Standard Webhooks format,
|
|
16
|
+
* whsec*...). See WebhookDeliveryPayload for the payload structure sent to your
|
|
17
|
+
* URL.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const webhook = await client.webhooks.create({
|
|
22
|
+
* url: 'https://example.com/hub-events',
|
|
23
|
+
* enabled: true,
|
|
24
|
+
* event_types: [
|
|
25
|
+
* 'feedback_record.created',
|
|
26
|
+
* 'feedback_record.updated',
|
|
27
|
+
* 'feedback_record.deleted',
|
|
28
|
+
* ],
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
create(body, options) {
|
|
33
|
+
return this._client.post('/v1/webhooks', { body, ...options });
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves a single webhook endpoint by its UUID. signing_key is omitted for
|
|
37
|
+
* security.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const webhook = await client.webhooks.retrieve(
|
|
42
|
+
* '018e1234-5678-9abc-def0-123456789abc',
|
|
43
|
+
* );
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
retrieve(id, options) {
|
|
47
|
+
return this._client.get((0, path_1.path) `/v1/webhooks/${id}`, options);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Updates specific fields of a webhook endpoint
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* const webhook = await client.webhooks.update(
|
|
55
|
+
* '018e1234-5678-9abc-def0-123456789abc',
|
|
56
|
+
* );
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
update(id, body, options) {
|
|
60
|
+
return this._client.patch((0, path_1.path) `/v1/webhooks/${id}`, { body, ...options });
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Lists webhook endpoints with optional filters and pagination
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* const webhooks = await client.webhooks.list();
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
list(query = {}, options) {
|
|
71
|
+
return this._client.get('/v1/webhooks', { query, ...options });
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Permanently deletes a webhook endpoint. It will no longer receive events.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* await client.webhooks.delete(
|
|
79
|
+
* '018e1234-5678-9abc-def0-123456789abc',
|
|
80
|
+
* );
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
delete(id, options) {
|
|
84
|
+
return this._client.delete((0, path_1.path) `/v1/webhooks/${id}`, {
|
|
85
|
+
...options,
|
|
86
|
+
headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.Webhooks = Webhooks;
|
|
91
|
+
//# 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;AAE/C,oDAAmD;AAEnD,oDAA8C;AAE9C;;GAEG;AACH,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,gBAAgB,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAU,EAAE,IAAyB,EAAE,OAAwB;QACpE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAA,WAAI,EAAA,gBAAgB,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,CACF,QAA8C,EAAE,EAChD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAU,EAAE,OAAwB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,gBAAgB,EAAE,EAAE,EAAE;YACnD,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AArFD,4BAqFC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../core/resource.mjs";
|
|
3
|
+
import { buildHeaders } from "../internal/headers.mjs";
|
|
4
|
+
import { path } from "../internal/utils/path.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* Webhook subscription management
|
|
7
|
+
*/
|
|
8
|
+
export class Webhooks extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new webhook endpoint. When events occur (e.g.
|
|
11
|
+
* feedback*record.created), the Hub POSTs a signed payload to the webhook URL. If
|
|
12
|
+
* signing_key is omitted, a key is auto-generated (Standard Webhooks format,
|
|
13
|
+
* whsec*...). See WebhookDeliveryPayload for the payload structure sent to your
|
|
14
|
+
* URL.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const webhook = await client.webhooks.create({
|
|
19
|
+
* url: 'https://example.com/hub-events',
|
|
20
|
+
* enabled: true,
|
|
21
|
+
* event_types: [
|
|
22
|
+
* 'feedback_record.created',
|
|
23
|
+
* 'feedback_record.updated',
|
|
24
|
+
* 'feedback_record.deleted',
|
|
25
|
+
* ],
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
create(body, options) {
|
|
30
|
+
return this._client.post('/v1/webhooks', { body, ...options });
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves a single webhook endpoint by its UUID. signing_key is omitted for
|
|
34
|
+
* security.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const webhook = await client.webhooks.retrieve(
|
|
39
|
+
* '018e1234-5678-9abc-def0-123456789abc',
|
|
40
|
+
* );
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
retrieve(id, options) {
|
|
44
|
+
return this._client.get(path `/v1/webhooks/${id}`, options);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Updates specific fields of a webhook endpoint
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const webhook = await client.webhooks.update(
|
|
52
|
+
* '018e1234-5678-9abc-def0-123456789abc',
|
|
53
|
+
* );
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
update(id, body, options) {
|
|
57
|
+
return this._client.patch(path `/v1/webhooks/${id}`, { body, ...options });
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Lists webhook endpoints with optional filters and pagination
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* const webhooks = await client.webhooks.list();
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
list(query = {}, options) {
|
|
68
|
+
return this._client.get('/v1/webhooks', { query, ...options });
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Permanently deletes a webhook endpoint. It will no longer receive events.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* await client.webhooks.delete(
|
|
76
|
+
* '018e1234-5678-9abc-def0-123456789abc',
|
|
77
|
+
* );
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
delete(id, options) {
|
|
81
|
+
return this._client.delete(path `/v1/webhooks/${id}`, {
|
|
82
|
+
...options,
|
|
83
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# 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;OAEf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,MAAM,CAAC,IAAyB,EAAE,OAAwB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,gBAAgB,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAU,EAAE,IAAyB,EAAE,OAAwB;QACpE,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAA,gBAAgB,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,CACF,QAA8C,EAAE,EAChD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAU,EAAE,OAAwB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,gBAAgB,EAAE,EAAE,EAAE;YACnD,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/src/client.ts
CHANGED
|
@@ -11,11 +11,23 @@ import type { APIResponseProps } from './internal/parse';
|
|
|
11
11
|
import { getPlatformHeaders } from './internal/detect-platform';
|
|
12
12
|
import * as Shims from './internal/shims';
|
|
13
13
|
import * as Opts from './internal/request-options';
|
|
14
|
+
import { stringifyQuery } from './internal/utils/query';
|
|
14
15
|
import { VERSION } from './version';
|
|
15
16
|
import * as Errors from './core/error';
|
|
16
17
|
import * as Uploads from './core/uploads';
|
|
17
18
|
import * as API from './resources/index';
|
|
18
19
|
import { APIPromise } from './core/api-promise';
|
|
20
|
+
import { Health, HealthCheckResponse } from './resources/health';
|
|
21
|
+
import {
|
|
22
|
+
WebhookCreateParams,
|
|
23
|
+
WebhookCreateResponse,
|
|
24
|
+
WebhookListParams,
|
|
25
|
+
WebhookListResponse,
|
|
26
|
+
WebhookRetrieveResponse,
|
|
27
|
+
WebhookUpdateParams,
|
|
28
|
+
WebhookUpdateResponse,
|
|
29
|
+
Webhooks,
|
|
30
|
+
} from './resources/webhooks';
|
|
19
31
|
import {
|
|
20
32
|
FeedbackRecordBulkDeleteParams,
|
|
21
33
|
FeedbackRecordBulkDeleteResponse,
|
|
@@ -23,10 +35,11 @@ import {
|
|
|
23
35
|
FeedbackRecordData,
|
|
24
36
|
FeedbackRecordListParams,
|
|
25
37
|
FeedbackRecordListResponse,
|
|
38
|
+
FeedbackRecordRetrieveSimilarParams,
|
|
39
|
+
FeedbackRecordRetrieveSimilarResponse,
|
|
26
40
|
FeedbackRecordUpdateParams,
|
|
27
41
|
FeedbackRecords,
|
|
28
|
-
} from './resources/feedback-records';
|
|
29
|
-
import { Health, HealthCheckResponse } from './resources/health';
|
|
42
|
+
} from './resources/feedback-records/feedback-records';
|
|
30
43
|
import { type Fetch } from './internal/builtin-types';
|
|
31
44
|
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
|
|
32
45
|
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
|
|
@@ -223,21 +236,8 @@ export class FormbricksHub {
|
|
|
223
236
|
/**
|
|
224
237
|
* Basic re-implementation of `qs.stringify` for primitive types.
|
|
225
238
|
*/
|
|
226
|
-
protected stringifyQuery(query: Record<string, unknown>): string {
|
|
227
|
-
return
|
|
228
|
-
.filter(([_, value]) => typeof value !== 'undefined')
|
|
229
|
-
.map(([key, value]) => {
|
|
230
|
-
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
231
|
-
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
|
|
232
|
-
}
|
|
233
|
-
if (value === null) {
|
|
234
|
-
return `${encodeURIComponent(key)}=`;
|
|
235
|
-
}
|
|
236
|
-
throw new Errors.FormbricksHubError(
|
|
237
|
-
`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
|
|
238
|
-
);
|
|
239
|
-
})
|
|
240
|
-
.join('&');
|
|
239
|
+
protected stringifyQuery(query: object | Record<string, unknown>): string {
|
|
240
|
+
return stringifyQuery(query);
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
private getUserAgent(): string {
|
|
@@ -269,12 +269,13 @@ export class FormbricksHub {
|
|
|
269
269
|
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
|
|
270
270
|
|
|
271
271
|
const defaultQuery = this.defaultQuery();
|
|
272
|
-
|
|
273
|
-
|
|
272
|
+
const pathQuery = Object.fromEntries(url.searchParams);
|
|
273
|
+
if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
|
|
274
|
+
query = { ...pathQuery, ...defaultQuery, ...query };
|
|
274
275
|
}
|
|
275
276
|
|
|
276
277
|
if (typeof query === 'object' && query && !Array.isArray(query)) {
|
|
277
|
-
url.search = this.stringifyQuery(query
|
|
278
|
+
url.search = this.stringifyQuery(query);
|
|
278
279
|
}
|
|
279
280
|
|
|
280
281
|
return url.toString();
|
|
@@ -579,9 +580,9 @@ export class FormbricksHub {
|
|
|
579
580
|
}
|
|
580
581
|
}
|
|
581
582
|
|
|
582
|
-
// If the API asks us to wait a certain amount of time
|
|
583
|
-
//
|
|
584
|
-
if (
|
|
583
|
+
// If the API asks us to wait a certain amount of time, just do what it
|
|
584
|
+
// says, but otherwise calculate a default
|
|
585
|
+
if (timeoutMillis === undefined) {
|
|
585
586
|
const maxRetries = options.maxRetries ?? this.maxRetries;
|
|
586
587
|
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
|
|
587
588
|
}
|
|
@@ -707,6 +708,14 @@ export class FormbricksHub {
|
|
|
707
708
|
(Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))
|
|
708
709
|
) {
|
|
709
710
|
return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable<Uint8Array>) };
|
|
711
|
+
} else if (
|
|
712
|
+
typeof body === 'object' &&
|
|
713
|
+
headers.values.get('content-type') === 'application/x-www-form-urlencoded'
|
|
714
|
+
) {
|
|
715
|
+
return {
|
|
716
|
+
bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
|
|
717
|
+
body: this.stringifyQuery(body),
|
|
718
|
+
};
|
|
710
719
|
} else {
|
|
711
720
|
return this.#encoder({ body, headers });
|
|
712
721
|
}
|
|
@@ -731,12 +740,23 @@ export class FormbricksHub {
|
|
|
731
740
|
|
|
732
741
|
static toFile = Uploads.toFile;
|
|
733
742
|
|
|
743
|
+
/**
|
|
744
|
+
* Health check endpoints
|
|
745
|
+
*/
|
|
734
746
|
health: API.Health = new API.Health(this);
|
|
747
|
+
/**
|
|
748
|
+
* Feedback record CRUD and search
|
|
749
|
+
*/
|
|
735
750
|
feedbackRecords: API.FeedbackRecords = new API.FeedbackRecords(this);
|
|
751
|
+
/**
|
|
752
|
+
* Webhook subscription management
|
|
753
|
+
*/
|
|
754
|
+
webhooks: API.Webhooks = new API.Webhooks(this);
|
|
736
755
|
}
|
|
737
756
|
|
|
738
757
|
FormbricksHub.Health = Health;
|
|
739
758
|
FormbricksHub.FeedbackRecords = FeedbackRecords;
|
|
759
|
+
FormbricksHub.Webhooks = Webhooks;
|
|
740
760
|
|
|
741
761
|
export declare namespace FormbricksHub {
|
|
742
762
|
export type RequestOptions = Opts.RequestOptions;
|
|
@@ -748,9 +768,22 @@ export declare namespace FormbricksHub {
|
|
|
748
768
|
type FeedbackRecordData as FeedbackRecordData,
|
|
749
769
|
type FeedbackRecordListResponse as FeedbackRecordListResponse,
|
|
750
770
|
type FeedbackRecordBulkDeleteResponse as FeedbackRecordBulkDeleteResponse,
|
|
771
|
+
type FeedbackRecordRetrieveSimilarResponse as FeedbackRecordRetrieveSimilarResponse,
|
|
751
772
|
type FeedbackRecordCreateParams as FeedbackRecordCreateParams,
|
|
752
773
|
type FeedbackRecordUpdateParams as FeedbackRecordUpdateParams,
|
|
753
774
|
type FeedbackRecordListParams as FeedbackRecordListParams,
|
|
754
775
|
type FeedbackRecordBulkDeleteParams as FeedbackRecordBulkDeleteParams,
|
|
776
|
+
type FeedbackRecordRetrieveSimilarParams as FeedbackRecordRetrieveSimilarParams,
|
|
777
|
+
};
|
|
778
|
+
|
|
779
|
+
export {
|
|
780
|
+
Webhooks as Webhooks,
|
|
781
|
+
type WebhookCreateResponse as WebhookCreateResponse,
|
|
782
|
+
type WebhookRetrieveResponse as WebhookRetrieveResponse,
|
|
783
|
+
type WebhookUpdateResponse as WebhookUpdateResponse,
|
|
784
|
+
type WebhookListResponse as WebhookListResponse,
|
|
785
|
+
type WebhookCreateParams as WebhookCreateParams,
|
|
786
|
+
type WebhookUpdateParams as WebhookUpdateParams,
|
|
787
|
+
type WebhookListParams as WebhookListParams,
|
|
755
788
|
};
|
|
756
789
|
}
|