@formbricks/hub 0.3.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 (95) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/client.d.mts +15 -3
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +15 -3
  5. package/client.d.ts.map +1 -1
  6. package/client.js +28 -18
  7. package/client.js.map +1 -1
  8. package/client.mjs +28 -18
  9. package/client.mjs.map +1 -1
  10. package/internal/tslib.js +17 -17
  11. package/internal/utils/query.d.mts +5 -0
  12. package/internal/utils/query.d.mts.map +1 -0
  13. package/internal/utils/query.d.ts +5 -0
  14. package/internal/utils/query.d.ts.map +1 -0
  15. package/internal/utils/query.js +23 -0
  16. package/internal/utils/query.js.map +1 -0
  17. package/internal/utils/query.mjs +20 -0
  18. package/internal/utils/query.mjs.map +1 -0
  19. package/internal/utils.d.mts +1 -0
  20. package/internal/utils.d.ts +1 -0
  21. package/internal/utils.js +1 -0
  22. package/internal/utils.js.map +1 -1
  23. package/internal/utils.mjs +1 -0
  24. package/package.json +7 -1
  25. package/resources/feedback-records/feedback-records.d.mts +473 -0
  26. package/resources/feedback-records/feedback-records.d.mts.map +1 -0
  27. package/resources/feedback-records/feedback-records.d.ts +473 -0
  28. package/resources/feedback-records/feedback-records.d.ts.map +1 -0
  29. package/resources/feedback-records/feedback-records.js +139 -0
  30. package/resources/feedback-records/feedback-records.js.map +1 -0
  31. package/resources/feedback-records/feedback-records.mjs +134 -0
  32. package/resources/feedback-records/feedback-records.mjs.map +1 -0
  33. package/resources/feedback-records/index.d.mts +3 -0
  34. package/resources/feedback-records/index.d.mts.map +1 -0
  35. package/resources/feedback-records/index.d.ts +3 -0
  36. package/resources/feedback-records/index.d.ts.map +1 -0
  37. package/resources/feedback-records/index.js +9 -0
  38. package/resources/feedback-records/index.js.map +1 -0
  39. package/resources/feedback-records/index.mjs +4 -0
  40. package/resources/feedback-records/index.mjs.map +1 -0
  41. package/resources/feedback-records/search.d.mts +98 -0
  42. package/resources/feedback-records/search.d.mts.map +1 -0
  43. package/resources/feedback-records/search.d.ts +98 -0
  44. package/resources/feedback-records/search.d.ts.map +1 -0
  45. package/resources/feedback-records/search.js +38 -0
  46. package/resources/feedback-records/search.js.map +1 -0
  47. package/resources/feedback-records/search.mjs +34 -0
  48. package/resources/feedback-records/search.mjs.map +1 -0
  49. package/resources/feedback-records.d.mts +1 -369
  50. package/resources/feedback-records.d.mts.map +1 -1
  51. package/resources/feedback-records.d.ts +1 -369
  52. package/resources/feedback-records.d.ts.map +1 -1
  53. package/resources/feedback-records.js +2 -102
  54. package/resources/feedback-records.js.map +1 -1
  55. package/resources/feedback-records.mjs +1 -100
  56. package/resources/feedback-records.mjs.map +1 -1
  57. package/resources/health.d.mts +3 -0
  58. package/resources/health.d.mts.map +1 -1
  59. package/resources/health.d.ts +3 -0
  60. package/resources/health.d.ts.map +1 -1
  61. package/resources/health.js +3 -0
  62. package/resources/health.js.map +1 -1
  63. package/resources/health.mjs +3 -0
  64. package/resources/health.mjs.map +1 -1
  65. package/resources/index.d.mts +2 -1
  66. package/resources/index.d.mts.map +1 -1
  67. package/resources/index.d.ts +2 -1
  68. package/resources/index.d.ts.map +1 -1
  69. package/resources/index.js +4 -2
  70. package/resources/index.js.map +1 -1
  71. package/resources/index.mjs +2 -1
  72. package/resources/index.mjs.map +1 -1
  73. package/resources/webhooks.d.mts +338 -0
  74. package/resources/webhooks.d.mts.map +1 -0
  75. package/resources/webhooks.d.ts +338 -0
  76. package/resources/webhooks.d.ts.map +1 -0
  77. package/resources/webhooks.js +91 -0
  78. package/resources/webhooks.js.map +1 -0
  79. package/resources/webhooks.mjs +87 -0
  80. package/resources/webhooks.mjs.map +1 -0
  81. package/src/client.ts +56 -23
  82. package/src/internal/utils/query.ts +23 -0
  83. package/src/internal/utils.ts +1 -0
  84. package/src/resources/feedback-records/feedback-records.ts +601 -0
  85. package/src/resources/feedback-records/index.ts +19 -0
  86. package/src/resources/feedback-records/search.ts +126 -0
  87. package/src/resources/feedback-records.ts +1 -469
  88. package/src/resources/health.ts +3 -0
  89. package/src/resources/index.ts +13 -1
  90. package/src/resources/webhooks.ts +469 -0
  91. package/src/version.ts +1 -1
  92. package/version.d.mts +1 -1
  93. package/version.d.ts +1 -1
  94. package/version.js +1 -1
  95. package/version.mjs +1 -1
@@ -0,0 +1,473 @@
1
+ import { APIResource } from "../../core/resource.js";
2
+ import * as SearchAPI from "./search.js";
3
+ import { Search, SearchPerformSemanticSearchParams, SearchPerformSemanticSearchResponse } from "./search.js";
4
+ import { APIPromise } from "../../core/api-promise.js";
5
+ import { RequestOptions } from "../../internal/request-options.js";
6
+ /**
7
+ * Feedback record CRUD and search
8
+ */
9
+ export declare class FeedbackRecords extends APIResource {
10
+ search: SearchAPI.Search;
11
+ /**
12
+ * Creates a new feedback record data point
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const feedbackRecordData =
17
+ * await client.feedbackRecords.create({
18
+ * field_id: 'q1',
19
+ * field_type: 'rating',
20
+ * source_type: 'survey',
21
+ * submission_id: '550e8400-e29b-41d4-a716-446655440000',
22
+ * tenant_id: 'org-123',
23
+ * field_label: 'How satisfied are you?',
24
+ * language: 'en',
25
+ * source_id: 'survey-123',
26
+ * source_name: 'Q1 NPS Survey',
27
+ * user_identifier: 'user-abc-123',
28
+ * value_number: 9,
29
+ * });
30
+ * ```
31
+ */
32
+ create(body: FeedbackRecordCreateParams, options?: RequestOptions): APIPromise<FeedbackRecordData>;
33
+ /**
34
+ * Retrieves a single feedback record data point by its UUID
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const feedbackRecordData =
39
+ * await client.feedbackRecords.retrieve(
40
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
41
+ * );
42
+ * ```
43
+ */
44
+ retrieve(id: string, options?: RequestOptions): APIPromise<FeedbackRecordData>;
45
+ /**
46
+ * Updates specific fields of a feedback record data point
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const feedbackRecordData =
51
+ * await client.feedbackRecords.update(
52
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
53
+ * { value_text: 'Updated feedback text' },
54
+ * );
55
+ * ```
56
+ */
57
+ update(id: string, body: FeedbackRecordUpdateParams, options?: RequestOptions): APIPromise<FeedbackRecordData>;
58
+ /**
59
+ * Lists feedback records with optional filters and pagination
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const feedbackRecords = await client.feedbackRecords.list({
64
+ * tenant_id: 'org-123',
65
+ * });
66
+ * ```
67
+ */
68
+ list(query: FeedbackRecordListParams, options?: RequestOptions): APIPromise<FeedbackRecordListResponse>;
69
+ /**
70
+ * Permanently deletes a feedback record data point
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * await client.feedbackRecords.delete(
75
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
76
+ * );
77
+ * ```
78
+ */
79
+ delete(id: string, options?: RequestOptions): APIPromise<void>;
80
+ /**
81
+ * Permanently deletes all feedback record data points matching the specified
82
+ * user_identifier. This endpoint supports GDPR Article 17 (Right to Erasure)
83
+ * requests.
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * const response = await client.feedbackRecords.bulkDelete({
88
+ * user_identifier: 'user-abc-123',
89
+ * });
90
+ * ```
91
+ */
92
+ bulkDelete(params: FeedbackRecordBulkDeleteParams, options?: RequestOptions): APIPromise<FeedbackRecordBulkDeleteResponse>;
93
+ /**
94
+ * Returns feedback record IDs and similarity scores for records similar to the
95
+ * given one (by embedding). **Only available when embeddings are configured**
96
+ * (EMBEDDING_PROVIDER and EMBEDDING_MODEL set). When embeddings are disabled, this
97
+ * endpoint returns 503 Service Unavailable. The source feedback record must belong
98
+ * to the given tenant_id (enforced).
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * const response =
103
+ * await client.feedbackRecords.retrieveSimilar(
104
+ * '018e1234-5678-9abc-def0-123456789abc',
105
+ * { tenant_id: 'org-123' },
106
+ * );
107
+ * ```
108
+ */
109
+ retrieveSimilar(id: string, query: FeedbackRecordRetrieveSimilarParams, options?: RequestOptions): APIPromise<FeedbackRecordRetrieveSimilarResponse>;
110
+ }
111
+ export interface FeedbackRecordData {
112
+ /**
113
+ * UUIDv7 primary key
114
+ */
115
+ id: string;
116
+ /**
117
+ * When the feedback was collected
118
+ */
119
+ collected_at: string;
120
+ /**
121
+ * When this record was created
122
+ */
123
+ created_at: string;
124
+ /**
125
+ * Identifier for the question/field
126
+ */
127
+ field_id: string;
128
+ /**
129
+ * Type of field
130
+ */
131
+ field_type: 'text' | 'categorical' | 'nps' | 'csat' | 'ces' | 'rating' | 'number' | 'boolean' | 'date';
132
+ /**
133
+ * Type of feedback source
134
+ */
135
+ source_type: string;
136
+ /**
137
+ * Identifier for the logical submission this record belongs to (required).
138
+ */
139
+ submission_id: string;
140
+ /**
141
+ * Tenant/organization identifier. NULL bytes not allowed.
142
+ */
143
+ tenant_id: string;
144
+ /**
145
+ * When this record was last updated
146
+ */
147
+ updated_at: string;
148
+ /**
149
+ * Stable identifier grouping related fields (for ranking, matrix, grid questions)
150
+ */
151
+ field_group_id?: string;
152
+ /**
153
+ * Human-readable question text for the group
154
+ */
155
+ field_group_label?: string;
156
+ /**
157
+ * The actual question text
158
+ */
159
+ field_label?: string;
160
+ /**
161
+ * ISO language code. NULL bytes not allowed.
162
+ */
163
+ language?: string;
164
+ /**
165
+ * Additional context
166
+ */
167
+ metadata?: {
168
+ [key: string]: unknown;
169
+ };
170
+ /**
171
+ * Reference to survey/form/ticket ID
172
+ */
173
+ source_id?: string;
174
+ /**
175
+ * Human-readable name
176
+ */
177
+ source_name?: string;
178
+ /**
179
+ * User identifier
180
+ */
181
+ user_identifier?: string;
182
+ /**
183
+ * Boolean response
184
+ */
185
+ value_boolean?: boolean;
186
+ /**
187
+ * Date response
188
+ */
189
+ value_date?: string;
190
+ /**
191
+ * Numeric response
192
+ */
193
+ value_number?: number;
194
+ /**
195
+ * Text response. NULL bytes not allowed.
196
+ */
197
+ value_text?: string;
198
+ }
199
+ export interface FeedbackRecordListResponse {
200
+ /**
201
+ * List of feedback records
202
+ */
203
+ data: Array<FeedbackRecordData>;
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
+ export interface FeedbackRecordBulkDeleteResponse {
215
+ /**
216
+ * Number of records deleted
217
+ */
218
+ deleted_count: number;
219
+ /**
220
+ * Human-readable status message
221
+ */
222
+ message: string;
223
+ }
224
+ export interface FeedbackRecordRetrieveSimilarResponse {
225
+ /**
226
+ * List of feedback record IDs with similarity scores (0 = unrelated, 1 =
227
+ * identical). Consistent with list endpoints.
228
+ */
229
+ data: Array<FeedbackRecordRetrieveSimilarResponse.Data>;
230
+ /**
231
+ * Limit used in query (echoed for consistency with list endpoints)
232
+ */
233
+ limit: number;
234
+ /**
235
+ * Opaque cursor for the next page (keyset paging). Present only when there may be
236
+ * more results (full page returned). Omit when no next page. Use this exact value
237
+ * as the cursor query param for the next page.
238
+ */
239
+ next_cursor?: string;
240
+ }
241
+ export declare namespace FeedbackRecordRetrieveSimilarResponse {
242
+ interface Data {
243
+ /**
244
+ * Feedback record UUID
245
+ */
246
+ feedback_record_id: string;
247
+ /**
248
+ * Label of the feedback field (included in embedding for context). May be empty if
249
+ * the source record had no label.
250
+ */
251
+ field_label: string;
252
+ /**
253
+ * Similarity score (0..1)
254
+ */
255
+ score: number;
256
+ /**
257
+ * value_text of the feedback record (the text that was embedded). May be empty if
258
+ * the source had no text; embeddings are only created for records with non-empty
259
+ * value_text, but the field can be cleared after embedding creation.
260
+ */
261
+ value_text: string;
262
+ }
263
+ }
264
+ export interface FeedbackRecordCreateParams {
265
+ /**
266
+ * Identifier for the question/field. NULL bytes not allowed.
267
+ */
268
+ field_id: string;
269
+ /**
270
+ * Field type: text (enrichable), categorical, nps, csat, ces, rating, number,
271
+ * boolean, date
272
+ */
273
+ field_type: 'text' | 'categorical' | 'nps' | 'csat' | 'ces' | 'rating' | 'number' | 'boolean' | 'date';
274
+ /**
275
+ * Type of feedback source (e.g., survey, review, feedback_form). NULL bytes not
276
+ * allowed.
277
+ */
278
+ source_type: string;
279
+ /**
280
+ * Identifier for the logical submission this record belongs to (tenant-scoped).
281
+ * Required. Enables grouping multi-field submissions and idempotent ingestion.
282
+ * Unique per (tenant_id, submission_id, field_id). If a record has no logical
283
+ * submission, use e.g. field_id.
284
+ */
285
+ submission_id: string;
286
+ /**
287
+ * Tenant/organization identifier for multi-tenancy. Required.
288
+ */
289
+ tenant_id: string;
290
+ /**
291
+ * When the feedback was collected (defaults to now). Must be between 1970-01-01
292
+ * and 2080-12-31.
293
+ */
294
+ collected_at?: string;
295
+ /**
296
+ * Stable identifier grouping related fields (for ranking, matrix, grid questions).
297
+ * NULL bytes not allowed.
298
+ */
299
+ field_group_id?: string;
300
+ /**
301
+ * Human-readable question text for the group
302
+ */
303
+ field_group_label?: string | null;
304
+ /**
305
+ * The actual question text
306
+ */
307
+ field_label?: string | null;
308
+ /**
309
+ * ISO language code. NULL bytes not allowed.
310
+ */
311
+ language?: string;
312
+ /**
313
+ * User agent, device, location, referrer, tags, etc. NULL bytes (\x00 or \u0000)
314
+ * are not allowed in JSON keys or values.
315
+ */
316
+ metadata?: {
317
+ [key: string]: unknown;
318
+ };
319
+ /**
320
+ * Reference to survey/form/ticket ID
321
+ */
322
+ source_id?: string | null;
323
+ /**
324
+ * Human-readable name
325
+ */
326
+ source_name?: string | null;
327
+ /**
328
+ * Anonymous ID or email hash
329
+ */
330
+ user_identifier?: string;
331
+ /**
332
+ * For yes/no questions
333
+ */
334
+ value_boolean?: boolean;
335
+ /**
336
+ * For date responses. Must be between 1970-01-01 and 2080-12-31.
337
+ */
338
+ value_date?: string;
339
+ /**
340
+ * For ratings, NPS scores, numeric responses. Must be between -1e15 and +1e15.
341
+ */
342
+ value_number?: number;
343
+ /**
344
+ * For open-ended text responses. Omit or null if not applicable. NULL bytes not
345
+ * allowed when present.
346
+ */
347
+ value_text?: string | null;
348
+ }
349
+ export interface FeedbackRecordUpdateParams {
350
+ /**
351
+ * Update language. NULL bytes not allowed.
352
+ */
353
+ language?: string;
354
+ /**
355
+ * Update metadata. NULL bytes (\x00 or \u0000) are not allowed in JSON keys or
356
+ * values.
357
+ */
358
+ metadata?: {
359
+ [key: string]: unknown;
360
+ };
361
+ /**
362
+ * Update user identifier
363
+ */
364
+ user_identifier?: string;
365
+ /**
366
+ * Update boolean response
367
+ */
368
+ value_boolean?: boolean;
369
+ /**
370
+ * Update date response. Must be between 1970-01-01 and 2080-12-31.
371
+ */
372
+ value_date?: string;
373
+ /**
374
+ * Update numeric response. Must be between -1e15 and +1e15.
375
+ */
376
+ value_number?: number;
377
+ /**
378
+ * Update text response. NULL bytes not allowed.
379
+ */
380
+ value_text?: string;
381
+ }
382
+ export interface FeedbackRecordListParams {
383
+ /**
384
+ * Tenant ID (required for isolation). NULL bytes not allowed.
385
+ */
386
+ tenant_id: string;
387
+ /**
388
+ * Omit for the first page. For the next page, use the exact value from the
389
+ * previous response's next_cursor. Opaque (base64-encoded); keyset pagination.
390
+ */
391
+ cursor?: string;
392
+ /**
393
+ * Filter by field group ID (for ranking/matrix questions). NULL bytes not allowed.
394
+ */
395
+ field_group_id?: string;
396
+ /**
397
+ * Filter by field ID. NULL bytes not allowed.
398
+ */
399
+ field_id?: string;
400
+ /**
401
+ * Filter by field type. NULL bytes not allowed.
402
+ */
403
+ field_type?: 'text' | 'categorical' | 'nps' | 'csat' | 'ces' | 'rating' | 'number' | 'boolean' | 'date';
404
+ /**
405
+ * Number of results to return (max 1000)
406
+ */
407
+ limit?: number;
408
+ /**
409
+ * Filter by collected_at >= since (ISO 8601 format). Must be between 1970-01-01
410
+ * and 2080-12-31.
411
+ */
412
+ since?: string;
413
+ /**
414
+ * Filter by source ID (NULL bytes not allowed)
415
+ */
416
+ source_id?: string;
417
+ /**
418
+ * Filter by source type. NULL bytes not allowed.
419
+ */
420
+ source_type?: string;
421
+ /**
422
+ * Filter by submission ID to group records belonging to one logical submission.
423
+ * NULL bytes not allowed.
424
+ */
425
+ submission_id?: string;
426
+ /**
427
+ * Filter by collected_at <= until (ISO 8601 format). Must be between 1970-01-01
428
+ * and 2080-12-31.
429
+ */
430
+ until?: string;
431
+ /**
432
+ * Filter by user identifier. NULL bytes not allowed.
433
+ */
434
+ user_identifier?: string;
435
+ }
436
+ export interface FeedbackRecordBulkDeleteParams {
437
+ /**
438
+ * Delete all records matching this user identifier (required). NULL bytes not
439
+ * allowed.
440
+ */
441
+ user_identifier: string;
442
+ /**
443
+ * Filter by tenant ID (optional, for multi-tenant deployments). NULL bytes not
444
+ * allowed.
445
+ */
446
+ tenant_id?: string;
447
+ }
448
+ export interface FeedbackRecordRetrieveSimilarParams {
449
+ /**
450
+ * Tenant ID (required for isolation; must match feedback record tenant_id)
451
+ */
452
+ tenant_id: string;
453
+ /**
454
+ * Omit for the first page. For the next page, use the exact value from the
455
+ * previous response's next_cursor. Opaque (base64-encoded); keyset pagination.
456
+ */
457
+ cursor?: string;
458
+ /**
459
+ * Number of results to return (default 10, max 100). Consistent with list
460
+ * endpoints.
461
+ */
462
+ limit?: number;
463
+ /**
464
+ * Minimum similarity score (0..1); only results with score >= min_score are
465
+ * returned. Default 0.7 to reduce noise.
466
+ */
467
+ min_score?: number;
468
+ }
469
+ export declare namespace FeedbackRecords {
470
+ export { type FeedbackRecordData as FeedbackRecordData, type FeedbackRecordListResponse as FeedbackRecordListResponse, type FeedbackRecordBulkDeleteResponse as FeedbackRecordBulkDeleteResponse, type FeedbackRecordRetrieveSimilarResponse as FeedbackRecordRetrieveSimilarResponse, type FeedbackRecordCreateParams as FeedbackRecordCreateParams, type FeedbackRecordUpdateParams as FeedbackRecordUpdateParams, type FeedbackRecordListParams as FeedbackRecordListParams, type FeedbackRecordBulkDeleteParams as FeedbackRecordBulkDeleteParams, type FeedbackRecordRetrieveSimilarParams as FeedbackRecordRetrieveSimilarParams, };
471
+ export { Search as Search, type SearchPerformSemanticSearchResponse as SearchPerformSemanticSearchResponse, type SearchPerformSemanticSearchParams as SearchPerformSemanticSearchParams, };
472
+ }
473
+ //# sourceMappingURL=feedback-records.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedback-records.d.ts","sourceRoot":"","sources":["../../src/resources/feedback-records/feedback-records.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,SAAS;OACd,EAAE,MAAM,EAAE,iCAAiC,EAAE,mCAAmC,EAAE;OAClF,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB;;GAEG;AACH,qBAAa,eAAgB,SAAQ,WAAW;IAC9C,MAAM,EAAE,SAAS,CAAC,MAAM,CAAsC;IAE9D;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,IAAI,EAAE,0BAA0B,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,kBAAkB,CAAC;IAIlG;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,kBAAkB,CAAC;IAI9E;;;;;;;;;;;OAWG;IACH,MAAM,CACJ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,0BAA0B,EAChC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,kBAAkB,CAAC;IAIjC;;;;;;;;;OASG;IACH,IAAI,CAAC,KAAK,EAAE,wBAAwB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,0BAA0B,CAAC;IAIvG;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;IAO9D;;;;;;;;;;;OAWG;IACH,UAAU,CACR,MAAM,EAAE,8BAA8B,EACt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A0B,EAC7D,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,mCAAmC,IAAI,mCAAmC,GAChF,CAAC;IAEF,OAAO,EACL,MAAM,IAAI,MAAM,EAChB,KAAK,mCAAmC,IAAI,mCAAmC,EAC/E,KAAK,iCAAiC,IAAI,iCAAiC,GAC5E,CAAC;CACH"}
@@ -0,0 +1,139 @@
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.FeedbackRecords = void 0;
5
+ const tslib_1 = require("../../internal/tslib.js");
6
+ const resource_1 = require("../../core/resource.js");
7
+ const SearchAPI = tslib_1.__importStar(require("./search.js"));
8
+ const search_1 = require("./search.js");
9
+ const headers_1 = require("../../internal/headers.js");
10
+ const path_1 = require("../../internal/utils/path.js");
11
+ /**
12
+ * Feedback record CRUD and search
13
+ */
14
+ class FeedbackRecords extends resource_1.APIResource {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.search = new SearchAPI.Search(this._client);
18
+ }
19
+ /**
20
+ * Creates a new feedback record data point
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const feedbackRecordData =
25
+ * await client.feedbackRecords.create({
26
+ * field_id: 'q1',
27
+ * field_type: 'rating',
28
+ * source_type: 'survey',
29
+ * submission_id: '550e8400-e29b-41d4-a716-446655440000',
30
+ * tenant_id: 'org-123',
31
+ * field_label: 'How satisfied are you?',
32
+ * language: 'en',
33
+ * source_id: 'survey-123',
34
+ * source_name: 'Q1 NPS Survey',
35
+ * user_identifier: 'user-abc-123',
36
+ * value_number: 9,
37
+ * });
38
+ * ```
39
+ */
40
+ create(body, options) {
41
+ return this._client.post('/v1/feedback-records', { body, ...options });
42
+ }
43
+ /**
44
+ * Retrieves a single feedback record data point by its UUID
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * const feedbackRecordData =
49
+ * await client.feedbackRecords.retrieve(
50
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
51
+ * );
52
+ * ```
53
+ */
54
+ retrieve(id, options) {
55
+ return this._client.get((0, path_1.path) `/v1/feedback-records/${id}`, options);
56
+ }
57
+ /**
58
+ * Updates specific fields of a feedback record data point
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * const feedbackRecordData =
63
+ * await client.feedbackRecords.update(
64
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
65
+ * { value_text: 'Updated feedback text' },
66
+ * );
67
+ * ```
68
+ */
69
+ update(id, body, options) {
70
+ return this._client.patch((0, path_1.path) `/v1/feedback-records/${id}`, { body, ...options });
71
+ }
72
+ /**
73
+ * Lists feedback records with optional filters and pagination
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * const feedbackRecords = await client.feedbackRecords.list({
78
+ * tenant_id: 'org-123',
79
+ * });
80
+ * ```
81
+ */
82
+ list(query, options) {
83
+ return this._client.get('/v1/feedback-records', { query, ...options });
84
+ }
85
+ /**
86
+ * Permanently deletes a feedback record data point
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * await client.feedbackRecords.delete(
91
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
92
+ * );
93
+ * ```
94
+ */
95
+ delete(id, options) {
96
+ return this._client.delete((0, path_1.path) `/v1/feedback-records/${id}`, {
97
+ ...options,
98
+ headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
99
+ });
100
+ }
101
+ /**
102
+ * Permanently deletes all feedback record data points matching the specified
103
+ * user_identifier. This endpoint supports GDPR Article 17 (Right to Erasure)
104
+ * requests.
105
+ *
106
+ * @example
107
+ * ```ts
108
+ * const response = await client.feedbackRecords.bulkDelete({
109
+ * user_identifier: 'user-abc-123',
110
+ * });
111
+ * ```
112
+ */
113
+ bulkDelete(params, options) {
114
+ const { user_identifier, tenant_id } = params;
115
+ return this._client.delete('/v1/feedback-records', { query: { user_identifier, tenant_id }, ...options });
116
+ }
117
+ /**
118
+ * Returns feedback record IDs and similarity scores for records similar to the
119
+ * given one (by embedding). **Only available when embeddings are configured**
120
+ * (EMBEDDING_PROVIDER and EMBEDDING_MODEL set). When embeddings are disabled, this
121
+ * endpoint returns 503 Service Unavailable. The source feedback record must belong
122
+ * to the given tenant_id (enforced).
123
+ *
124
+ * @example
125
+ * ```ts
126
+ * const response =
127
+ * await client.feedbackRecords.retrieveSimilar(
128
+ * '018e1234-5678-9abc-def0-123456789abc',
129
+ * { tenant_id: 'org-123' },
130
+ * );
131
+ * ```
132
+ */
133
+ retrieveSimilar(id, query, options) {
134
+ return this._client.get((0, path_1.path) `/v1/feedback-records/${id}/similar`, { query, ...options });
135
+ }
136
+ }
137
+ exports.FeedbackRecords = FeedbackRecords;
138
+ FeedbackRecords.Search = search_1.Search;
139
+ //# sourceMappingURL=feedback-records.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedback-records.js","sourceRoot":"","sources":["../../src/resources/feedback-records/feedback-records.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAClD,+DAAsC;AACtC,wCAA0G;AAE1G,uDAAsD;AAEtD,uDAAiD;AAEjD;;GAEG;AACH,MAAa,eAAgB,SAAQ,sBAAW;IAAhD;;QACE,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAwIhE,CAAC;IAtIC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,IAAgC,EAAE,OAAwB;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,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