@@ -345,11 +345,13 @@ export class Objects extends APIResource {
345
345
}
346
346
347
347
/**
348
- * Sets preferences within the given preference set. This is a destructive
349
- * operation and will replace any existing preferences with the preferences given.
350
- * If no object exists in the current environment for the given `:collection` and
351
- * `:object_id`, Knock will create the object as part of this request. The
352
- * preference set `:id` can be either `default` or a `tenant.id`. Learn more about
348
+ * Sets preferences within the given preference set. By default, this is a
349
+ * destructive operation and will replace any existing preferences with the
350
+ * preferences given. Use '\_\_persistence_strategy': 'merge' to merge with
351
+ * existing preferences instead. If no object exists in the current environment for
352
+ * the given `:collection` and `:object_id`, Knock will create the object as part
353
+ * of this request. The preference set `:id` can be either `default` or a
354
+ * `tenant.id`. Learn more about
353
355
* [per-tenant preferences](/preferences/tenant-preferences).
354
356
*
355
357
* @example
@@ -359,6 +361,7 @@ export class Objects extends APIResource {
359
361
* 'object_id',
360
362
* 'default',
361
363
* {
364
+ * __persistence_strategy__: 'merge',
362
365
* categories: {
363
366
* marketing: false,
364
367
* transactional: { channel_types: { email: false } },
@@ -717,6 +720,12 @@ export interface ObjectSetChannelDataParams {
717
720
}
718
721
719
722
export interface ObjectSetPreferencesParams {
723
+ /**
724
+ * Controls how the preference set is persisted. 'replace' will completely replace
725
+ * the preference set, 'merge' will merge with existing preferences.
726
+ */
727
+ __persistence_strategy__ ?: 'merge' | 'replace' ;
728
+
720
729
/**
721
730
* An object where the key is the category and the values are the preference
722
731
* settings for that category.
0 commit comments