@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.
Files changed (96) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/README.md +2 -2
  3. package/client.d.mts +15 -3
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +15 -3
  6. package/client.d.ts.map +1 -1
  7. package/client.js +28 -18
  8. package/client.js.map +1 -1
  9. package/client.mjs +28 -18
  10. package/client.mjs.map +1 -1
  11. package/internal/tslib.js +17 -17
  12. package/internal/utils/query.d.mts +5 -0
  13. package/internal/utils/query.d.mts.map +1 -0
  14. package/internal/utils/query.d.ts +5 -0
  15. package/internal/utils/query.d.ts.map +1 -0
  16. package/internal/utils/query.js +23 -0
  17. package/internal/utils/query.js.map +1 -0
  18. package/internal/utils/query.mjs +20 -0
  19. package/internal/utils/query.mjs.map +1 -0
  20. package/internal/utils.d.mts +1 -0
  21. package/internal/utils.d.ts +1 -0
  22. package/internal/utils.js +1 -0
  23. package/internal/utils.js.map +1 -1
  24. package/internal/utils.mjs +1 -0
  25. package/package.json +7 -1
  26. package/resources/feedback-records/feedback-records.d.mts +473 -0
  27. package/resources/feedback-records/feedback-records.d.mts.map +1 -0
  28. package/resources/feedback-records/feedback-records.d.ts +473 -0
  29. package/resources/feedback-records/feedback-records.d.ts.map +1 -0
  30. package/resources/feedback-records/feedback-records.js +139 -0
  31. package/resources/feedback-records/feedback-records.js.map +1 -0
  32. package/resources/feedback-records/feedback-records.mjs +134 -0
  33. package/resources/feedback-records/feedback-records.mjs.map +1 -0
  34. package/resources/feedback-records/index.d.mts +3 -0
  35. package/resources/feedback-records/index.d.mts.map +1 -0
  36. package/resources/feedback-records/index.d.ts +3 -0
  37. package/resources/feedback-records/index.d.ts.map +1 -0
  38. package/resources/feedback-records/index.js +9 -0
  39. package/resources/feedback-records/index.js.map +1 -0
  40. package/resources/feedback-records/index.mjs +4 -0
  41. package/resources/feedback-records/index.mjs.map +1 -0
  42. package/resources/feedback-records/search.d.mts +98 -0
  43. package/resources/feedback-records/search.d.mts.map +1 -0
  44. package/resources/feedback-records/search.d.ts +98 -0
  45. package/resources/feedback-records/search.d.ts.map +1 -0
  46. package/resources/feedback-records/search.js +38 -0
  47. package/resources/feedback-records/search.js.map +1 -0
  48. package/resources/feedback-records/search.mjs +34 -0
  49. package/resources/feedback-records/search.mjs.map +1 -0
  50. package/resources/feedback-records.d.mts +1 -369
  51. package/resources/feedback-records.d.mts.map +1 -1
  52. package/resources/feedback-records.d.ts +1 -369
  53. package/resources/feedback-records.d.ts.map +1 -1
  54. package/resources/feedback-records.js +2 -102
  55. package/resources/feedback-records.js.map +1 -1
  56. package/resources/feedback-records.mjs +1 -100
  57. package/resources/feedback-records.mjs.map +1 -1
  58. package/resources/health.d.mts +3 -0
  59. package/resources/health.d.mts.map +1 -1
  60. package/resources/health.d.ts +3 -0
  61. package/resources/health.d.ts.map +1 -1
  62. package/resources/health.js +3 -0
  63. package/resources/health.js.map +1 -1
  64. package/resources/health.mjs +3 -0
  65. package/resources/health.mjs.map +1 -1
  66. package/resources/index.d.mts +2 -1
  67. package/resources/index.d.mts.map +1 -1
  68. package/resources/index.d.ts +2 -1
  69. package/resources/index.d.ts.map +1 -1
  70. package/resources/index.js +4 -2
  71. package/resources/index.js.map +1 -1
  72. package/resources/index.mjs +2 -1
  73. package/resources/index.mjs.map +1 -1
  74. package/resources/webhooks.d.mts +338 -0
  75. package/resources/webhooks.d.mts.map +1 -0
  76. package/resources/webhooks.d.ts +338 -0
  77. package/resources/webhooks.d.ts.map +1 -0
  78. package/resources/webhooks.js +91 -0
  79. package/resources/webhooks.js.map +1 -0
  80. package/resources/webhooks.mjs +87 -0
  81. package/resources/webhooks.mjs.map +1 -0
  82. package/src/client.ts +56 -23
  83. package/src/internal/utils/query.ts +23 -0
  84. package/src/internal/utils.ts +1 -0
  85. package/src/resources/feedback-records/feedback-records.ts +601 -0
  86. package/src/resources/feedback-records/index.ts +19 -0
  87. package/src/resources/feedback-records/search.ts +126 -0
  88. package/src/resources/feedback-records.ts +1 -469
  89. package/src/resources/health.ts +3 -0
  90. package/src/resources/index.ts +13 -1
  91. package/src/resources/webhooks.ts +469 -0
  92. package/src/version.ts +1 -1
  93. package/version.d.mts +1 -1
  94. package/version.d.ts +1 -1
  95. package/version.js +1 -1
  96. package/version.mjs +1 -1
@@ -0,0 +1,469 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { buildHeaders } from '../internal/headers';
6
+ import { RequestOptions } from '../internal/request-options';
7
+ import { path } from '../internal/utils/path';
8
+
9
+ /**
10
+ * Webhook subscription management
11
+ */
12
+ export class Webhooks extends APIResource {
13
+ /**
14
+ * Creates a new webhook endpoint. When events occur (e.g.
15
+ * feedback*record.created), the Hub POSTs a signed payload to the webhook URL. If
16
+ * signing_key is omitted, a key is auto-generated (Standard Webhooks format,
17
+ * whsec*...). See WebhookDeliveryPayload for the payload structure sent to your
18
+ * URL.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const webhook = await client.webhooks.create({
23
+ * url: 'https://example.com/hub-events',
24
+ * enabled: true,
25
+ * event_types: [
26
+ * 'feedback_record.created',
27
+ * 'feedback_record.updated',
28
+ * 'feedback_record.deleted',
29
+ * ],
30
+ * });
31
+ * ```
32
+ */
33
+ create(body: WebhookCreateParams, options?: RequestOptions): APIPromise<WebhookCreateResponse> {
34
+ return this._client.post('/v1/webhooks', { body, ...options });
35
+ }
36
+
37
+ /**
38
+ * Retrieves a single webhook endpoint by its UUID. signing_key is omitted for
39
+ * security.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * const webhook = await client.webhooks.retrieve(
44
+ * '018e1234-5678-9abc-def0-123456789abc',
45
+ * );
46
+ * ```
47
+ */
48
+ retrieve(id: string, options?: RequestOptions): APIPromise<WebhookRetrieveResponse> {
49
+ return this._client.get(path`/v1/webhooks/${id}`, options);
50
+ }
51
+
52
+ /**
53
+ * Updates specific fields of a webhook endpoint
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * const webhook = await client.webhooks.update(
58
+ * '018e1234-5678-9abc-def0-123456789abc',
59
+ * );
60
+ * ```
61
+ */
62
+ update(id: string, body: WebhookUpdateParams, options?: RequestOptions): APIPromise<WebhookUpdateResponse> {
63
+ return this._client.patch(path`/v1/webhooks/${id}`, { body, ...options });
64
+ }
65
+
66
+ /**
67
+ * Lists webhook endpoints with optional filters and pagination
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * const webhooks = await client.webhooks.list();
72
+ * ```
73
+ */
74
+ list(
75
+ query: WebhookListParams | null | undefined = {},
76
+ options?: RequestOptions,
77
+ ): APIPromise<WebhookListResponse> {
78
+ return this._client.get('/v1/webhooks', { query, ...options });
79
+ }
80
+
81
+ /**
82
+ * Permanently deletes a webhook endpoint. It will no longer receive events.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * await client.webhooks.delete(
87
+ * '018e1234-5678-9abc-def0-123456789abc',
88
+ * );
89
+ * ```
90
+ */
91
+ delete(id: string, options?: RequestOptions): APIPromise<void> {
92
+ return this._client.delete(path`/v1/webhooks/${id}`, {
93
+ ...options,
94
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
95
+ });
96
+ }
97
+ }
98
+
99
+ export interface WebhookCreateResponse {
100
+ /**
101
+ * Webhook ID (UUID)
102
+ */
103
+ id: string;
104
+
105
+ /**
106
+ * When the webhook was created
107
+ */
108
+ created_at: string;
109
+
110
+ /**
111
+ * Whether the webhook is active
112
+ */
113
+ enabled: boolean;
114
+
115
+ /**
116
+ * Key used to sign payloads (Standard Webhooks)
117
+ */
118
+ signing_key: string;
119
+
120
+ /**
121
+ * When the webhook was last updated
122
+ */
123
+ updated_at: string;
124
+
125
+ /**
126
+ * URL that receives webhook POSTs
127
+ */
128
+ url: string;
129
+
130
+ /**
131
+ * Read-only. When the webhook was disabled. Omitted when null. Cleared when the
132
+ * webhook is re-enabled via PATCH.
133
+ */
134
+ disabled_at?: string | null;
135
+
136
+ /**
137
+ * Read-only. Set by the system when the webhook was disabled (e.g. after 410 Gone
138
+ * or max delivery failures). Omitted when null.
139
+ */
140
+ disabled_reason?: string | null;
141
+
142
+ /**
143
+ * Event types this webhook subscribes to (empty = all)
144
+ */
145
+ event_types?: Array<
146
+ | 'feedback_record.created'
147
+ | 'feedback_record.updated'
148
+ | 'feedback_record.deleted'
149
+ | 'webhook.created'
150
+ | 'webhook.updated'
151
+ | 'webhook.deleted'
152
+ >;
153
+
154
+ /**
155
+ * Tenant/organization identifier
156
+ */
157
+ tenant_id?: string;
158
+ }
159
+
160
+ /**
161
+ * Webhook data for GET and LIST responses; signing_key is omitted for security
162
+ */
163
+ export interface WebhookRetrieveResponse {
164
+ /**
165
+ * Webhook ID (UUID)
166
+ */
167
+ id: string;
168
+
169
+ /**
170
+ * When the webhook was created
171
+ */
172
+ created_at: string;
173
+
174
+ /**
175
+ * Whether the webhook is active
176
+ */
177
+ enabled: boolean;
178
+
179
+ /**
180
+ * When the webhook was last updated
181
+ */
182
+ updated_at: string;
183
+
184
+ /**
185
+ * URL that receives webhook POSTs
186
+ */
187
+ url: string;
188
+
189
+ /**
190
+ * Read-only. When the webhook was disabled. Omitted when null.
191
+ */
192
+ disabled_at?: string | null;
193
+
194
+ /**
195
+ * Read-only. Set by the system when the webhook was disabled. Omitted when null.
196
+ */
197
+ disabled_reason?: string | null;
198
+
199
+ /**
200
+ * Event types this webhook subscribes to (empty = all)
201
+ */
202
+ event_types?: Array<
203
+ | 'feedback_record.created'
204
+ | 'feedback_record.updated'
205
+ | 'feedback_record.deleted'
206
+ | 'webhook.created'
207
+ | 'webhook.updated'
208
+ | 'webhook.deleted'
209
+ >;
210
+
211
+ /**
212
+ * Tenant/organization identifier
213
+ */
214
+ tenant_id?: string;
215
+ }
216
+
217
+ /**
218
+ * Webhook data for GET and LIST responses; signing_key is omitted for security
219
+ */
220
+ export interface WebhookUpdateResponse {
221
+ /**
222
+ * Webhook ID (UUID)
223
+ */
224
+ id: string;
225
+
226
+ /**
227
+ * When the webhook was created
228
+ */
229
+ created_at: string;
230
+
231
+ /**
232
+ * Whether the webhook is active
233
+ */
234
+ enabled: boolean;
235
+
236
+ /**
237
+ * When the webhook was last updated
238
+ */
239
+ updated_at: string;
240
+
241
+ /**
242
+ * URL that receives webhook POSTs
243
+ */
244
+ url: string;
245
+
246
+ /**
247
+ * Read-only. When the webhook was disabled. Omitted when null.
248
+ */
249
+ disabled_at?: string | null;
250
+
251
+ /**
252
+ * Read-only. Set by the system when the webhook was disabled. Omitted when null.
253
+ */
254
+ disabled_reason?: string | null;
255
+
256
+ /**
257
+ * Event types this webhook subscribes to (empty = all)
258
+ */
259
+ event_types?: Array<
260
+ | 'feedback_record.created'
261
+ | 'feedback_record.updated'
262
+ | 'feedback_record.deleted'
263
+ | 'webhook.created'
264
+ | 'webhook.updated'
265
+ | 'webhook.deleted'
266
+ >;
267
+
268
+ /**
269
+ * Tenant/organization identifier
270
+ */
271
+ tenant_id?: string;
272
+ }
273
+
274
+ export interface WebhookListResponse {
275
+ /**
276
+ * List of webhooks (signing_key omitted for security)
277
+ */
278
+ data: Array<WebhookListResponse.Data>;
279
+
280
+ /**
281
+ * Limit used in query
282
+ */
283
+ limit: number;
284
+
285
+ /**
286
+ * Opaque cursor for the next page (keyset paging). Present only when there may be
287
+ * more results. Use as the cursor query param for the next page.
288
+ */
289
+ next_cursor?: string;
290
+
291
+ /**
292
+ * Offset used in query (present when offset-based; omitted when using cursor)
293
+ */
294
+ offset?: number;
295
+
296
+ /**
297
+ * Total count matching filters (present when offset-based; omitted when using
298
+ * cursor)
299
+ */
300
+ total?: number;
301
+ }
302
+
303
+ export namespace WebhookListResponse {
304
+ /**
305
+ * Webhook data for GET and LIST responses; signing_key is omitted for security
306
+ */
307
+ export interface Data {
308
+ /**
309
+ * Webhook ID (UUID)
310
+ */
311
+ id: string;
312
+
313
+ /**
314
+ * When the webhook was created
315
+ */
316
+ created_at: string;
317
+
318
+ /**
319
+ * Whether the webhook is active
320
+ */
321
+ enabled: boolean;
322
+
323
+ /**
324
+ * When the webhook was last updated
325
+ */
326
+ updated_at: string;
327
+
328
+ /**
329
+ * URL that receives webhook POSTs
330
+ */
331
+ url: string;
332
+
333
+ /**
334
+ * Read-only. When the webhook was disabled. Omitted when null.
335
+ */
336
+ disabled_at?: string | null;
337
+
338
+ /**
339
+ * Read-only. Set by the system when the webhook was disabled. Omitted when null.
340
+ */
341
+ disabled_reason?: string | null;
342
+
343
+ /**
344
+ * Event types this webhook subscribes to (empty = all)
345
+ */
346
+ event_types?: Array<
347
+ | 'feedback_record.created'
348
+ | 'feedback_record.updated'
349
+ | 'feedback_record.deleted'
350
+ | 'webhook.created'
351
+ | 'webhook.updated'
352
+ | 'webhook.deleted'
353
+ >;
354
+
355
+ /**
356
+ * Tenant/organization identifier
357
+ */
358
+ tenant_id?: string;
359
+ }
360
+ }
361
+
362
+ export interface WebhookCreateParams {
363
+ /**
364
+ * URL to receive webhook POSTs. Must be an HTTP or HTTPS URL. NULL bytes not
365
+ * allowed.
366
+ */
367
+ url: string;
368
+
369
+ /**
370
+ * Whether the webhook is active (default true)
371
+ */
372
+ enabled?: boolean;
373
+
374
+ /**
375
+ * Event types this webhook subscribes to. Each value must be one of
376
+ * WebhookEventType. If empty, the webhook receives all event types.
377
+ */
378
+ event_types?: Array<
379
+ | 'feedback_record.created'
380
+ | 'feedback_record.updated'
381
+ | 'feedback_record.deleted'
382
+ | 'webhook.created'
383
+ | 'webhook.updated'
384
+ | 'webhook.deleted'
385
+ >;
386
+
387
+ /**
388
+ * Optional. If omitted, a key is auto-generated (whsec\_...). Used to sign
389
+ * payloads (Standard Webhooks). When provided, max 255 characters; NULL bytes not
390
+ * allowed.
391
+ */
392
+ signing_key?: string;
393
+
394
+ /**
395
+ * Tenant/organization identifier. NULL bytes not allowed.
396
+ */
397
+ tenant_id?: string;
398
+ }
399
+
400
+ export interface WebhookUpdateParams {
401
+ /**
402
+ * Enable or disable the webhook
403
+ */
404
+ enabled?: boolean;
405
+
406
+ /**
407
+ * New list of event types (use empty array to clear). Each value must be one of
408
+ * WebhookEventType.
409
+ */
410
+ event_types?: Array<
411
+ | 'feedback_record.created'
412
+ | 'feedback_record.updated'
413
+ | 'feedback_record.deleted'
414
+ | 'webhook.created'
415
+ | 'webhook.updated'
416
+ | 'webhook.deleted'
417
+ >;
418
+
419
+ /**
420
+ * New signing key. NULL bytes not allowed.
421
+ */
422
+ signing_key?: string;
423
+
424
+ /**
425
+ * Omit or send null to leave unchanged. Send empty string to clear (store as
426
+ * null).
427
+ */
428
+ tenant_id?: string | null;
429
+
430
+ /**
431
+ * New webhook URL. Must be an HTTP or HTTPS URL. NULL bytes not allowed.
432
+ */
433
+ url?: string;
434
+ }
435
+
436
+ export interface WebhookListParams {
437
+ /**
438
+ * Omit for the first page. For the next page, use the exact value from the
439
+ * previous response's next_cursor. Opaque (base64-encoded); keyset pagination.
440
+ */
441
+ cursor?: string;
442
+
443
+ /**
444
+ * Filter by enabled status
445
+ */
446
+ enabled?: boolean;
447
+
448
+ /**
449
+ * Number of results to return (max 1000)
450
+ */
451
+ limit?: number;
452
+
453
+ /**
454
+ * Filter by tenant ID. NULL bytes not allowed.
455
+ */
456
+ tenant_id?: string;
457
+ }
458
+
459
+ export declare namespace Webhooks {
460
+ export {
461
+ type WebhookCreateResponse as WebhookCreateResponse,
462
+ type WebhookRetrieveResponse as WebhookRetrieveResponse,
463
+ type WebhookUpdateResponse as WebhookUpdateResponse,
464
+ type WebhookListResponse as WebhookListResponse,
465
+ type WebhookCreateParams as WebhookCreateParams,
466
+ type WebhookUpdateParams as WebhookUpdateParams,
467
+ type WebhookListParams as WebhookListParams,
468
+ };
469
+ }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.2.0'; // x-release-please-version
1
+ export const VERSION = '0.4.1'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.2.0";
1
+ export declare const VERSION = "0.4.1";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.2.0";
1
+ export declare const VERSION = "0.4.1";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.2.0'; // x-release-please-version
4
+ exports.VERSION = '0.4.1'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.2.0'; // x-release-please-version
1
+ export const VERSION = '0.4.1'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map