@@ -798,6 +798,7 @@ def set_preferences(
798798 object_id : str ,
799799 id : str ,
800800 * ,
801+ _persistence_strategy : Literal ["merge" , "replace" ] | NotGiven = NOT_GIVEN ,
801802 categories : Optional [Dict [str , object_set_preferences_params .Categories ]] | NotGiven = NOT_GIVEN ,
802803 channel_types : Optional [PreferenceSetChannelTypesParam ] | NotGiven = NOT_GIVEN ,
803804 workflows : Optional [Dict [str , object_set_preferences_params .Workflows ]] | NotGiven = NOT_GIVEN ,
@@ -810,14 +811,19 @@ def set_preferences(
810811 ) -> PreferenceSet :
811812 """Sets preferences within the given preference set.
812813
813- This is a destructive
814- operation and will replace any existing preferences with the preferences given.
815- If no object exists in the current environment for the given `:collection` and
816- `:object_id`, Knock will create the object as part of this request. The
817- preference set `:id` can be either `default` or a `tenant.id`. Learn more about
814+ By default, this is a
815+ destructive operation and will replace any existing preferences with the
816+ preferences given. Use '\\ __\\ __persistence_strategy': 'merge' to merge with
817+ existing preferences instead. If no object exists in the current environment for
818+ the given `:collection` and `:object_id`, Knock will create the object as part
819+ of this request. The preference set `:id` can be either `default` or a
820+ `tenant.id`. Learn more about
818821 [per-tenant preferences](/preferences/tenant-preferences).
819822
820823 Args:
824+ _persistence_strategy: Controls how the preference set is persisted. 'replace' will completely replace
825+ the preference set, 'merge' will merge with existing preferences.
826+
821827 categories: An object where the key is the category and the values are the preference
822828 settings for that category.
823829
@@ -844,6 +850,7 @@ def set_preferences(
844850 f"/v1/objects/{ collection } /{ object_id } /preferences/{ id } " ,
845851 body = maybe_transform (
846852 {
853+ "_persistence_strategy" : _persistence_strategy ,
847854 "categories" : categories ,
848855 "channel_types" : channel_types ,
849856 "workflows" : workflows ,
@@ -1638,6 +1645,7 @@ async def set_preferences(
16381645 object_id : str ,
16391646 id : str ,
16401647 * ,
1648+ _persistence_strategy : Literal ["merge" , "replace" ] | NotGiven = NOT_GIVEN ,
16411649 categories : Optional [Dict [str , object_set_preferences_params .Categories ]] | NotGiven = NOT_GIVEN ,
16421650 channel_types : Optional [PreferenceSetChannelTypesParam ] | NotGiven = NOT_GIVEN ,
16431651 workflows : Optional [Dict [str , object_set_preferences_params .Workflows ]] | NotGiven = NOT_GIVEN ,
@@ -1650,14 +1658,19 @@ async def set_preferences(
16501658 ) -> PreferenceSet :
16511659 """Sets preferences within the given preference set.
16521660
1653- This is a destructive
1654- operation and will replace any existing preferences with the preferences given.
1655- If no object exists in the current environment for the given `:collection` and
1656- `:object_id`, Knock will create the object as part of this request. The
1657- preference set `:id` can be either `default` or a `tenant.id`. Learn more about
1661+ By default, this is a
1662+ destructive operation and will replace any existing preferences with the
1663+ preferences given. Use '\\ __\\ __persistence_strategy': 'merge' to merge with
1664+ existing preferences instead. If no object exists in the current environment for
1665+ the given `:collection` and `:object_id`, Knock will create the object as part
1666+ of this request. The preference set `:id` can be either `default` or a
1667+ `tenant.id`. Learn more about
16581668 [per-tenant preferences](/preferences/tenant-preferences).
16591669
16601670 Args:
1671+ _persistence_strategy: Controls how the preference set is persisted. 'replace' will completely replace
1672+ the preference set, 'merge' will merge with existing preferences.
1673+
16611674 categories: An object where the key is the category and the values are the preference
16621675 settings for that category.
16631676
@@ -1684,6 +1697,7 @@ async def set_preferences(
16841697 f"/v1/objects/{ collection } /{ object_id } /preferences/{ id } " ,
16851698 body = await async_maybe_transform (
16861699 {
1700+ "_persistence_strategy" : _persistence_strategy ,
16871701 "categories" : categories ,
16881702 "channel_types" : channel_types ,
16891703 "workflows" : workflows ,
0 commit comments