@oursprivacy/platform-sdk 1.44.3 → 1.46.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +3 -5
  3. package/client.d.mts +5 -2
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +5 -2
  6. package/client.d.ts.map +1 -1
  7. package/client.js +3 -0
  8. package/client.js.map +1 -1
  9. package/client.mjs +3 -0
  10. package/client.mjs.map +1 -1
  11. package/package.json +4 -1
  12. package/resources/destinations.d.mts +7 -7
  13. package/resources/destinations.d.mts.map +1 -1
  14. package/resources/destinations.d.ts +7 -7
  15. package/resources/destinations.d.ts.map +1 -1
  16. package/resources/index.d.mts +2 -1
  17. package/resources/index.d.mts.map +1 -1
  18. package/resources/index.d.ts +2 -1
  19. package/resources/index.d.ts.map +1 -1
  20. package/resources/index.js +3 -1
  21. package/resources/index.js.map +1 -1
  22. package/resources/index.mjs +1 -0
  23. package/resources/index.mjs.map +1 -1
  24. package/resources/personalization-properties.d.mts +547 -0
  25. package/resources/personalization-properties.d.mts.map +1 -0
  26. package/resources/personalization-properties.d.ts +547 -0
  27. package/resources/personalization-properties.d.ts.map +1 -0
  28. package/resources/personalization-properties.js +100 -0
  29. package/resources/personalization-properties.js.map +1 -0
  30. package/resources/personalization-properties.mjs +96 -0
  31. package/resources/personalization-properties.mjs.map +1 -0
  32. package/resources/versions.d.mts +52 -1
  33. package/resources/versions.d.mts.map +1 -1
  34. package/resources/versions.d.ts +52 -1
  35. package/resources/versions.d.ts.map +1 -1
  36. package/resources/versions.js +20 -0
  37. package/resources/versions.js.map +1 -1
  38. package/resources/versions.mjs +20 -0
  39. package/resources/versions.mjs.map +1 -1
  40. package/resources/videos.d.mts +129 -41
  41. package/resources/videos.d.mts.map +1 -1
  42. package/resources/videos.d.ts +129 -41
  43. package/resources/videos.d.ts.map +1 -1
  44. package/resources/videos.js +90 -14
  45. package/resources/videos.js.map +1 -1
  46. package/resources/videos.mjs +90 -14
  47. package/resources/videos.mjs.map +1 -1
  48. package/src/client.ts +31 -0
  49. package/src/resources/destinations.ts +7 -0
  50. package/src/resources/index.ts +14 -0
  51. package/src/resources/personalization-properties.ts +662 -0
  52. package/src/resources/versions.ts +95 -0
  53. package/src/resources/videos.ts +164 -67
  54. package/src/version.ts +1 -1
  55. package/version.d.mts +1 -1
  56. package/version.d.ts +1 -1
  57. package/version.js +1 -1
  58. package/version.mjs +1 -1
@@ -0,0 +1,547 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import { APIPromise } from "../core/api-promise.js";
3
+ import { Cursor, type CursorParams, PagePromise } from "../core/pagination.js";
4
+ import { RequestOptions } from "../internal/request-options.js";
5
+ export declare class PersonalizationProperties extends APIResource {
6
+ /**
7
+ * List personalization properties for one experiment settings record. Requires the
8
+ * `experimentSettingsId` query parameter — properties are always scoped to a
9
+ * single record; list the records with `GET /rest/v1/experiment-settings`.
10
+ * Supports cursor pagination via `limit` and `cursor`; the limit clamp is 1000 so
11
+ * a single request can return the full set. Requires scope:
12
+ * experimentSettings:list
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // Automatically fetches more pages as needed.
17
+ * for await (const personalizationPropertyListResponse of client.personalizationProperties.list(
18
+ * {
19
+ * experimentSettingsId:
20
+ * '08524dc8-5289-48e8-bf40-b3a7cfa6ca0a',
21
+ * },
22
+ * )) {
23
+ * // ...
24
+ * }
25
+ * ```
26
+ */
27
+ list(query: PersonalizationPropertyListParams, options?: RequestOptions): PagePromise<PersonalizationPropertyListResponsesCursor, PersonalizationPropertyListResponse>;
28
+ /**
29
+ * Create a personalization property on an experiment settings record. The new rule
30
+ * is published automatically and starts accumulating from the next matching event
31
+ * — no separate publish call is needed. `propertyKey` must be unique within the
32
+ * parent record. Requires scope: experimentSettings:update
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const personalizationProperty =
37
+ * await client.personalizationProperties.create({
38
+ * accumulator: 'set_true',
39
+ * experimentSettingsId:
40
+ * '08524dc8-5289-48e8-bf40-b3a7cfa6ca0a',
41
+ * propertyKey: 'visited_pricing',
42
+ * triggerEventName: 'page_view',
43
+ * });
44
+ * ```
45
+ */
46
+ create(body: PersonalizationPropertyCreateParams, options?: RequestOptions): APIPromise<PersonalizationPropertyCreateResponse>;
47
+ /**
48
+ * Find a single personalization property by ID. Returns 404 when no property
49
+ * matches the supplied id. Requires scope: experimentSettings:find
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * const personalizationProperty =
54
+ * await client.personalizationProperties.retrieve('id');
55
+ * ```
56
+ */
57
+ retrieve(id: string, options?: RequestOptions): APIPromise<PersonalizationPropertyRetrieveResponse>;
58
+ /**
59
+ * Partially update a personalization property. Only the fields you send are
60
+ * changed, and the update is published automatically. Sending `triggerConditions`
61
+ * replaces the prior list — partial-array merging is not supported. Values already
62
+ * accumulated for visitors are kept; the new rule applies to events from here on.
63
+ * Returns 404 when no property matches the supplied id. Requires scope:
64
+ * experimentSettings:update
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * const personalizationProperty =
69
+ * await client.personalizationProperties.update('id');
70
+ * ```
71
+ */
72
+ update(id: string, body: PersonalizationPropertyUpdateParams, options?: RequestOptions): APIPromise<PersonalizationPropertyUpdateResponse>;
73
+ /**
74
+ * Delete a personalization property. The rule stops accumulating immediately;
75
+ * values already recorded for visitors are no longer maintained. Returns 404 when
76
+ * no property matches the supplied id. Requires scope: experimentSettings:update
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * const personalizationProperty =
81
+ * await client.personalizationProperties.delete('id');
82
+ * ```
83
+ */
84
+ delete(id: string, options?: RequestOptions): APIPromise<PersonalizationPropertyDeleteResponse>;
85
+ }
86
+ export type PersonalizationPropertyListResponsesCursor = Cursor<PersonalizationPropertyListResponse>;
87
+ export interface PersonalizationPropertyListResponse {
88
+ /**
89
+ * Unique identifier for this personalization property.
90
+ */
91
+ id: string;
92
+ /**
93
+ * How repeated trigger events fold into the stored value. `set_true` records
94
+ * `true` the first time the event matches — use it for one-shot interest flags.
95
+ * `increment` counts matching events as a number. `latest_value` stores the most
96
+ * recent value read from `valueField`, replacing whatever was there before.
97
+ */
98
+ accumulator: 'increment' | 'latest_value' | 'set_true';
99
+ /**
100
+ * ISO 8601 timestamp of when the property was created.
101
+ */
102
+ createdAt: string;
103
+ /**
104
+ * Experiment settings record that owns this property.
105
+ */
106
+ experimentSettingsId: string;
107
+ /**
108
+ * Name this value is stored and read under. Must be unique within the parent
109
+ * experiment settings record — a duplicate key is rejected with 409. Because
110
+ * accumulated values are delivered to the visitor's browser and are readable
111
+ * there, never accumulate secrets, credentials, PHI, or confidential data into a
112
+ * property.
113
+ */
114
+ propertyKey: string;
115
+ /**
116
+ * Whether the property is accumulating. `Disabled` properties stop accumulating
117
+ * but keep values already recorded.
118
+ */
119
+ status: 'Disabled' | 'Enabled';
120
+ /**
121
+ * Name of the tracked event that advances this property. Every event with this
122
+ * name is evaluated against `triggerConditions`.
123
+ */
124
+ triggerEventName: string;
125
+ /**
126
+ * Optional filters the triggering event must satisfy. All conditions must match
127
+ * (AND). Omit or send an empty list to accumulate on every event with the matching
128
+ * name.
129
+ */
130
+ triggerConditions?: Array<PersonalizationPropertyListResponse.TriggerCondition> | null;
131
+ /**
132
+ * ISO 8601 timestamp of the last update, or null when never updated.
133
+ */
134
+ updatedAt?: string | null;
135
+ /**
136
+ * Event field to read the stored value from. Required for `latest_value`; ignored
137
+ * by `set_true` and `increment`. Only scalar values (string, number, boolean) are
138
+ * stored. Must be one of `event.name`, `event.properties.<name>`, or
139
+ * `event.context.<name>` where `<name>` is one of `current_url`, `referrer`,
140
+ * `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, or `utm_term`. Any
141
+ * other path is rejected with 400.
142
+ */
143
+ valueField?: string | null;
144
+ }
145
+ export declare namespace PersonalizationPropertyListResponse {
146
+ interface TriggerCondition {
147
+ /**
148
+ * Event field the condition reads. Must be one of `event.name`,
149
+ * `event.properties.<name>`, or `event.context.<name>` where `<name>` is one of
150
+ * `current_url`, `referrer`, `utm_source`, `utm_medium`, `utm_campaign`,
151
+ * `utm_content`, or `utm_term`. Any other path is rejected with 400.
152
+ */
153
+ field: string;
154
+ /**
155
+ * Comparison applied to the field. `exists` and `not_exists` ignore `value`;
156
+ * `regex` matches the field against `value` as a regular expression.
157
+ */
158
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists' | 'regex';
159
+ /**
160
+ * Scalar value the operator compares against. Omit for `exists` and `not_exists`.
161
+ * Nested objects and arrays are rejected.
162
+ */
163
+ value?: string | null;
164
+ }
165
+ }
166
+ export interface PersonalizationPropertyCreateResponse {
167
+ /**
168
+ * Unique identifier for this personalization property.
169
+ */
170
+ id: string;
171
+ /**
172
+ * How repeated trigger events fold into the stored value. `set_true` records
173
+ * `true` the first time the event matches — use it for one-shot interest flags.
174
+ * `increment` counts matching events as a number. `latest_value` stores the most
175
+ * recent value read from `valueField`, replacing whatever was there before.
176
+ */
177
+ accumulator: 'increment' | 'latest_value' | 'set_true';
178
+ /**
179
+ * ISO 8601 timestamp of when the property was created.
180
+ */
181
+ createdAt: string;
182
+ /**
183
+ * Experiment settings record that owns this property.
184
+ */
185
+ experimentSettingsId: string;
186
+ /**
187
+ * Name this value is stored and read under. Must be unique within the parent
188
+ * experiment settings record — a duplicate key is rejected with 409. Because
189
+ * accumulated values are delivered to the visitor's browser and are readable
190
+ * there, never accumulate secrets, credentials, PHI, or confidential data into a
191
+ * property.
192
+ */
193
+ propertyKey: string;
194
+ /**
195
+ * Whether the property is accumulating. `Disabled` properties stop accumulating
196
+ * but keep values already recorded.
197
+ */
198
+ status: 'Disabled' | 'Enabled';
199
+ /**
200
+ * Name of the tracked event that advances this property. Every event with this
201
+ * name is evaluated against `triggerConditions`.
202
+ */
203
+ triggerEventName: string;
204
+ /**
205
+ * Optional filters the triggering event must satisfy. All conditions must match
206
+ * (AND). Omit or send an empty list to accumulate on every event with the matching
207
+ * name.
208
+ */
209
+ triggerConditions?: Array<PersonalizationPropertyCreateResponse.TriggerCondition> | null;
210
+ /**
211
+ * ISO 8601 timestamp of the last update, or null when never updated.
212
+ */
213
+ updatedAt?: string | null;
214
+ /**
215
+ * Event field to read the stored value from. Required for `latest_value`; ignored
216
+ * by `set_true` and `increment`. Only scalar values (string, number, boolean) are
217
+ * stored. Must be one of `event.name`, `event.properties.<name>`, or
218
+ * `event.context.<name>` where `<name>` is one of `current_url`, `referrer`,
219
+ * `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, or `utm_term`. Any
220
+ * other path is rejected with 400.
221
+ */
222
+ valueField?: string | null;
223
+ }
224
+ export declare namespace PersonalizationPropertyCreateResponse {
225
+ interface TriggerCondition {
226
+ /**
227
+ * Event field the condition reads. Must be one of `event.name`,
228
+ * `event.properties.<name>`, or `event.context.<name>` where `<name>` is one of
229
+ * `current_url`, `referrer`, `utm_source`, `utm_medium`, `utm_campaign`,
230
+ * `utm_content`, or `utm_term`. Any other path is rejected with 400.
231
+ */
232
+ field: string;
233
+ /**
234
+ * Comparison applied to the field. `exists` and `not_exists` ignore `value`;
235
+ * `regex` matches the field against `value` as a regular expression.
236
+ */
237
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists' | 'regex';
238
+ /**
239
+ * Scalar value the operator compares against. Omit for `exists` and `not_exists`.
240
+ * Nested objects and arrays are rejected.
241
+ */
242
+ value?: string | null;
243
+ }
244
+ }
245
+ export interface PersonalizationPropertyRetrieveResponse {
246
+ /**
247
+ * Unique identifier for this personalization property.
248
+ */
249
+ id: string;
250
+ /**
251
+ * How repeated trigger events fold into the stored value. `set_true` records
252
+ * `true` the first time the event matches — use it for one-shot interest flags.
253
+ * `increment` counts matching events as a number. `latest_value` stores the most
254
+ * recent value read from `valueField`, replacing whatever was there before.
255
+ */
256
+ accumulator: 'increment' | 'latest_value' | 'set_true';
257
+ /**
258
+ * ISO 8601 timestamp of when the property was created.
259
+ */
260
+ createdAt: string;
261
+ /**
262
+ * Experiment settings record that owns this property.
263
+ */
264
+ experimentSettingsId: string;
265
+ /**
266
+ * Name this value is stored and read under. Must be unique within the parent
267
+ * experiment settings record — a duplicate key is rejected with 409. Because
268
+ * accumulated values are delivered to the visitor's browser and are readable
269
+ * there, never accumulate secrets, credentials, PHI, or confidential data into a
270
+ * property.
271
+ */
272
+ propertyKey: string;
273
+ /**
274
+ * Whether the property is accumulating. `Disabled` properties stop accumulating
275
+ * but keep values already recorded.
276
+ */
277
+ status: 'Disabled' | 'Enabled';
278
+ /**
279
+ * Name of the tracked event that advances this property. Every event with this
280
+ * name is evaluated against `triggerConditions`.
281
+ */
282
+ triggerEventName: string;
283
+ /**
284
+ * Optional filters the triggering event must satisfy. All conditions must match
285
+ * (AND). Omit or send an empty list to accumulate on every event with the matching
286
+ * name.
287
+ */
288
+ triggerConditions?: Array<PersonalizationPropertyRetrieveResponse.TriggerCondition> | null;
289
+ /**
290
+ * ISO 8601 timestamp of the last update, or null when never updated.
291
+ */
292
+ updatedAt?: string | null;
293
+ /**
294
+ * Event field to read the stored value from. Required for `latest_value`; ignored
295
+ * by `set_true` and `increment`. Only scalar values (string, number, boolean) are
296
+ * stored. Must be one of `event.name`, `event.properties.<name>`, or
297
+ * `event.context.<name>` where `<name>` is one of `current_url`, `referrer`,
298
+ * `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, or `utm_term`. Any
299
+ * other path is rejected with 400.
300
+ */
301
+ valueField?: string | null;
302
+ }
303
+ export declare namespace PersonalizationPropertyRetrieveResponse {
304
+ interface TriggerCondition {
305
+ /**
306
+ * Event field the condition reads. Must be one of `event.name`,
307
+ * `event.properties.<name>`, or `event.context.<name>` where `<name>` is one of
308
+ * `current_url`, `referrer`, `utm_source`, `utm_medium`, `utm_campaign`,
309
+ * `utm_content`, or `utm_term`. Any other path is rejected with 400.
310
+ */
311
+ field: string;
312
+ /**
313
+ * Comparison applied to the field. `exists` and `not_exists` ignore `value`;
314
+ * `regex` matches the field against `value` as a regular expression.
315
+ */
316
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists' | 'regex';
317
+ /**
318
+ * Scalar value the operator compares against. Omit for `exists` and `not_exists`.
319
+ * Nested objects and arrays are rejected.
320
+ */
321
+ value?: string | null;
322
+ }
323
+ }
324
+ export interface PersonalizationPropertyUpdateResponse {
325
+ /**
326
+ * Unique identifier for this personalization property.
327
+ */
328
+ id: string;
329
+ /**
330
+ * How repeated trigger events fold into the stored value. `set_true` records
331
+ * `true` the first time the event matches — use it for one-shot interest flags.
332
+ * `increment` counts matching events as a number. `latest_value` stores the most
333
+ * recent value read from `valueField`, replacing whatever was there before.
334
+ */
335
+ accumulator: 'increment' | 'latest_value' | 'set_true';
336
+ /**
337
+ * ISO 8601 timestamp of when the property was created.
338
+ */
339
+ createdAt: string;
340
+ /**
341
+ * Experiment settings record that owns this property.
342
+ */
343
+ experimentSettingsId: string;
344
+ /**
345
+ * Name this value is stored and read under. Must be unique within the parent
346
+ * experiment settings record — a duplicate key is rejected with 409. Because
347
+ * accumulated values are delivered to the visitor's browser and are readable
348
+ * there, never accumulate secrets, credentials, PHI, or confidential data into a
349
+ * property.
350
+ */
351
+ propertyKey: string;
352
+ /**
353
+ * Whether the property is accumulating. `Disabled` properties stop accumulating
354
+ * but keep values already recorded.
355
+ */
356
+ status: 'Disabled' | 'Enabled';
357
+ /**
358
+ * Name of the tracked event that advances this property. Every event with this
359
+ * name is evaluated against `triggerConditions`.
360
+ */
361
+ triggerEventName: string;
362
+ /**
363
+ * Optional filters the triggering event must satisfy. All conditions must match
364
+ * (AND). Omit or send an empty list to accumulate on every event with the matching
365
+ * name.
366
+ */
367
+ triggerConditions?: Array<PersonalizationPropertyUpdateResponse.TriggerCondition> | null;
368
+ /**
369
+ * ISO 8601 timestamp of the last update, or null when never updated.
370
+ */
371
+ updatedAt?: string | null;
372
+ /**
373
+ * Event field to read the stored value from. Required for `latest_value`; ignored
374
+ * by `set_true` and `increment`. Only scalar values (string, number, boolean) are
375
+ * stored. Must be one of `event.name`, `event.properties.<name>`, or
376
+ * `event.context.<name>` where `<name>` is one of `current_url`, `referrer`,
377
+ * `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, or `utm_term`. Any
378
+ * other path is rejected with 400.
379
+ */
380
+ valueField?: string | null;
381
+ }
382
+ export declare namespace PersonalizationPropertyUpdateResponse {
383
+ interface TriggerCondition {
384
+ /**
385
+ * Event field the condition reads. Must be one of `event.name`,
386
+ * `event.properties.<name>`, or `event.context.<name>` where `<name>` is one of
387
+ * `current_url`, `referrer`, `utm_source`, `utm_medium`, `utm_campaign`,
388
+ * `utm_content`, or `utm_term`. Any other path is rejected with 400.
389
+ */
390
+ field: string;
391
+ /**
392
+ * Comparison applied to the field. `exists` and `not_exists` ignore `value`;
393
+ * `regex` matches the field against `value` as a regular expression.
394
+ */
395
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists' | 'regex';
396
+ /**
397
+ * Scalar value the operator compares against. Omit for `exists` and `not_exists`.
398
+ * Nested objects and arrays are rejected.
399
+ */
400
+ value?: string | null;
401
+ }
402
+ }
403
+ /**
404
+ * Whether the personalization property was deleted successfully.
405
+ */
406
+ export type PersonalizationPropertyDeleteResponse = boolean;
407
+ export interface PersonalizationPropertyListParams extends CursorParams {
408
+ /**
409
+ * Required. List properties belonging to this experiment settings record. Get the
410
+ * id from `GET /rest/v1/experiment-settings`.
411
+ */
412
+ experimentSettingsId: string;
413
+ }
414
+ export interface PersonalizationPropertyCreateParams {
415
+ /**
416
+ * How repeated trigger events fold into the stored value. `set_true` records
417
+ * `true` the first time the event matches — use it for one-shot interest flags.
418
+ * `increment` counts matching events as a number. `latest_value` stores the most
419
+ * recent value read from `valueField`, replacing whatever was there before.
420
+ */
421
+ accumulator: 'increment' | 'latest_value' | 'set_true';
422
+ /**
423
+ * Experiment settings record that will own this property. Get the id from
424
+ * `GET /rest/v1/experiment-settings`.
425
+ */
426
+ experimentSettingsId: string;
427
+ /**
428
+ * Name this value is stored and read under. Must be unique within the parent
429
+ * experiment settings record — a duplicate key is rejected with 409. Because
430
+ * accumulated values are delivered to the visitor's browser and are readable
431
+ * there, never accumulate secrets, credentials, PHI, or confidential data into a
432
+ * property.
433
+ */
434
+ propertyKey: string;
435
+ /**
436
+ * Name of the tracked event that advances this property. Every event with this
437
+ * name is evaluated against `triggerConditions`.
438
+ */
439
+ triggerEventName: string;
440
+ /**
441
+ * Optional filters the triggering event must satisfy. All conditions must match
442
+ * (AND). Omit or send an empty list to accumulate on every event with the matching
443
+ * name.
444
+ */
445
+ triggerConditions?: Array<PersonalizationPropertyCreateParams.TriggerCondition> | null;
446
+ /**
447
+ * Event field to read the stored value from. Required for `latest_value`; ignored
448
+ * by `set_true` and `increment`. Only scalar values (string, number, boolean) are
449
+ * stored. Must be one of `event.name`, `event.properties.<name>`, or
450
+ * `event.context.<name>` where `<name>` is one of `current_url`, `referrer`,
451
+ * `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, or `utm_term`. Any
452
+ * other path is rejected with 400.
453
+ */
454
+ valueField?: string | null;
455
+ }
456
+ export declare namespace PersonalizationPropertyCreateParams {
457
+ interface TriggerCondition {
458
+ /**
459
+ * Event field the condition reads. Must be one of `event.name`,
460
+ * `event.properties.<name>`, or `event.context.<name>` where `<name>` is one of
461
+ * `current_url`, `referrer`, `utm_source`, `utm_medium`, `utm_campaign`,
462
+ * `utm_content`, or `utm_term`. Any other path is rejected with 400.
463
+ */
464
+ field: string;
465
+ /**
466
+ * Comparison applied to the field. `exists` and `not_exists` ignore `value`;
467
+ * `regex` matches the field against `value` as a regular expression.
468
+ */
469
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists' | 'regex';
470
+ /**
471
+ * Scalar value the operator compares against. Omit for `exists` and `not_exists`.
472
+ * Nested objects and arrays are rejected.
473
+ */
474
+ value?: string | null;
475
+ }
476
+ }
477
+ export interface PersonalizationPropertyUpdateParams {
478
+ /**
479
+ * How repeated trigger events fold into the stored value. `set_true` records
480
+ * `true` the first time the event matches — use it for one-shot interest flags.
481
+ * `increment` counts matching events as a number. `latest_value` stores the most
482
+ * recent value read from `valueField`, replacing whatever was there before. Omit
483
+ * this field or send `null` to leave it unchanged.
484
+ */
485
+ accumulator?: 'increment' | 'latest_value' | 'set_true' | null;
486
+ /**
487
+ * Renamed key. Name this value is stored and read under. Must be unique within the
488
+ * parent experiment settings record — a duplicate key is rejected with 409.
489
+ * Because accumulated values are delivered to the visitor's browser and are
490
+ * readable there, never accumulate secrets, credentials, PHI, or confidential data
491
+ * into a property. Omit this field or send `null` to leave it unchanged.
492
+ */
493
+ propertyKey?: string | null;
494
+ /**
495
+ * Pause or resume accumulation. `Disabled` stops accumulating without discarding
496
+ * values already recorded. Omit this field or send `null` to leave it unchanged.
497
+ */
498
+ status?: 'Disabled' | 'Enabled' | null;
499
+ /**
500
+ * Optional filters the triggering event must satisfy. All conditions must match
501
+ * (AND). Omit or send an empty list to accumulate on every event with the matching
502
+ * name. Sending this field replaces the prior list — partial-array merging is not
503
+ * supported. Send `null` or an empty array to clear every condition, which makes
504
+ * the rule fire on each occurrence of the trigger event.
505
+ */
506
+ triggerConditions?: Array<PersonalizationPropertyUpdateParams.TriggerCondition> | null;
507
+ /**
508
+ * Name of the tracked event that advances this property. Every event with this
509
+ * name is evaluated against `triggerConditions`. Omit this field or send `null` to
510
+ * leave it unchanged.
511
+ */
512
+ triggerEventName?: string | null;
513
+ /**
514
+ * Event field to read the stored value from. Required for `latest_value`; ignored
515
+ * by `set_true` and `increment`. Only scalar values (string, number, boolean) are
516
+ * stored. Must be one of `event.name`, `event.properties.<name>`, or
517
+ * `event.context.<name>` where `<name>` is one of `current_url`, `referrer`,
518
+ * `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, or `utm_term`. Any
519
+ * other path is rejected with 400.
520
+ */
521
+ valueField?: string | null;
522
+ }
523
+ export declare namespace PersonalizationPropertyUpdateParams {
524
+ interface TriggerCondition {
525
+ /**
526
+ * Event field the condition reads. Must be one of `event.name`,
527
+ * `event.properties.<name>`, or `event.context.<name>` where `<name>` is one of
528
+ * `current_url`, `referrer`, `utm_source`, `utm_medium`, `utm_campaign`,
529
+ * `utm_content`, or `utm_term`. Any other path is rejected with 400.
530
+ */
531
+ field: string;
532
+ /**
533
+ * Comparison applied to the field. `exists` and `not_exists` ignore `value`;
534
+ * `regex` matches the field against `value` as a regular expression.
535
+ */
536
+ operator: 'contains' | 'equals' | 'exists' | 'not_equals' | 'not_exists' | 'regex';
537
+ /**
538
+ * Scalar value the operator compares against. Omit for `exists` and `not_exists`.
539
+ * Nested objects and arrays are rejected.
540
+ */
541
+ value?: string | null;
542
+ }
543
+ }
544
+ export declare namespace PersonalizationProperties {
545
+ export { type PersonalizationPropertyListResponse as PersonalizationPropertyListResponse, type PersonalizationPropertyCreateResponse as PersonalizationPropertyCreateResponse, type PersonalizationPropertyRetrieveResponse as PersonalizationPropertyRetrieveResponse, type PersonalizationPropertyUpdateResponse as PersonalizationPropertyUpdateResponse, type PersonalizationPropertyDeleteResponse as PersonalizationPropertyDeleteResponse, type PersonalizationPropertyListResponsesCursor as PersonalizationPropertyListResponsesCursor, type PersonalizationPropertyListParams as PersonalizationPropertyListParams, type PersonalizationPropertyCreateParams as PersonalizationPropertyCreateParams, type PersonalizationPropertyUpdateParams as PersonalizationPropertyUpdateParams, };
546
+ }
547
+ //# sourceMappingURL=personalization-properties.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personalization-properties.d.ts","sourceRoot":"","sources":["../src/resources/personalization-properties.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4BAAyB;AAC/C,OAAO,EAAE,UAAU,EAAE,+BAA4B;AACjD,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,8BAA2B;AAC5E,OAAO,EAAE,cAAc,EAAE,uCAAoC;AAG7D,qBAAa,yBAA0B,SAAQ,WAAW;IACxD;;;;;;;;;;;;;;;;;;;;OAoBG;IAC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K,iCAAiC,IAAI,iCAAiC,EAC3E,KAAK,mCAAmC,IAAI,mCAAmC,EAC/E,KAAK,mCAAmC,IAAI,mCAAmC,GAChF,CAAC;CACH"}
@@ -0,0 +1,100 @@
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.PersonalizationProperties = void 0;
5
+ const resource_1 = require("../core/resource.js");
6
+ const pagination_1 = require("../core/pagination.js");
7
+ const path_1 = require("../internal/utils/path.js");
8
+ class PersonalizationProperties extends resource_1.APIResource {
9
+ /**
10
+ * List personalization properties for one experiment settings record. Requires the
11
+ * `experimentSettingsId` query parameter — properties are always scoped to a
12
+ * single record; list the records with `GET /rest/v1/experiment-settings`.
13
+ * Supports cursor pagination via `limit` and `cursor`; the limit clamp is 1000 so
14
+ * a single request can return the full set. Requires scope:
15
+ * experimentSettings:list
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * // Automatically fetches more pages as needed.
20
+ * for await (const personalizationPropertyListResponse of client.personalizationProperties.list(
21
+ * {
22
+ * experimentSettingsId:
23
+ * '08524dc8-5289-48e8-bf40-b3a7cfa6ca0a',
24
+ * },
25
+ * )) {
26
+ * // ...
27
+ * }
28
+ * ```
29
+ */
30
+ list(query, options) {
31
+ return this._client.getAPIList('/rest/v1/personalization-properties', (pagination_1.Cursor), { query, ...options });
32
+ }
33
+ /**
34
+ * Create a personalization property on an experiment settings record. The new rule
35
+ * is published automatically and starts accumulating from the next matching event
36
+ * — no separate publish call is needed. `propertyKey` must be unique within the
37
+ * parent record. Requires scope: experimentSettings:update
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const personalizationProperty =
42
+ * await client.personalizationProperties.create({
43
+ * accumulator: 'set_true',
44
+ * experimentSettingsId:
45
+ * '08524dc8-5289-48e8-bf40-b3a7cfa6ca0a',
46
+ * propertyKey: 'visited_pricing',
47
+ * triggerEventName: 'page_view',
48
+ * });
49
+ * ```
50
+ */
51
+ create(body, options) {
52
+ return this._client.post('/rest/v1/personalization-properties', { body, ...options });
53
+ }
54
+ /**
55
+ * Find a single personalization property by ID. Returns 404 when no property
56
+ * matches the supplied id. Requires scope: experimentSettings:find
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const personalizationProperty =
61
+ * await client.personalizationProperties.retrieve('id');
62
+ * ```
63
+ */
64
+ retrieve(id, options) {
65
+ return this._client.get((0, path_1.path) `/rest/v1/personalization-properties/${id}`, options);
66
+ }
67
+ /**
68
+ * Partially update a personalization property. Only the fields you send are
69
+ * changed, and the update is published automatically. Sending `triggerConditions`
70
+ * replaces the prior list — partial-array merging is not supported. Values already
71
+ * accumulated for visitors are kept; the new rule applies to events from here on.
72
+ * Returns 404 when no property matches the supplied id. Requires scope:
73
+ * experimentSettings:update
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * const personalizationProperty =
78
+ * await client.personalizationProperties.update('id');
79
+ * ```
80
+ */
81
+ update(id, body, options) {
82
+ return this._client.patch((0, path_1.path) `/rest/v1/personalization-properties/${id}`, { body, ...options });
83
+ }
84
+ /**
85
+ * Delete a personalization property. The rule stops accumulating immediately;
86
+ * values already recorded for visitors are no longer maintained. Returns 404 when
87
+ * no property matches the supplied id. Requires scope: experimentSettings:update
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * const personalizationProperty =
92
+ * await client.personalizationProperties.delete('id');
93
+ * ```
94
+ */
95
+ delete(id, options) {
96
+ return this._client.delete((0, path_1.path) `/rest/v1/personalization-properties/${id}`, options);
97
+ }
98
+ }
99
+ exports.PersonalizationProperties = PersonalizationProperties;
100
+ //# sourceMappingURL=personalization-properties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personalization-properties.js","sourceRoot":"","sources":["../src/resources/personalization-properties.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAE/C,sDAA4E;AAE5E,oDAA8C;AAE9C,MAAa,yBAA0B,SAAQ,sBAAW;IACxD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,IAAI,CACF,KAAwC,EACxC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAC5B,qCAAqC,EACrC,CAAA,mBAA2C,CAAA,EAC3C,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CACtB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CACJ,IAAyC,EACzC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,qCAAqC,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxF,CAAC;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,uCAAuC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACpF,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,MAAM,CACJ,EAAU,EACV,IAAyC,EACzC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAA,WAAI,EAAA,uCAAuC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnG,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAU,EAAE,OAAwB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,uCAAuC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACvF,CAAC;CACF;AA5GD,8DA4GC"}