Skip to content

Commit e319ce4

Browse files
release: 1.12.0 (#59)
* codegen metadata * chore(internal): fix ruff target version * chore: update @stainless-api/prism-cli to v5.15.0 * chore(internal): update comment in script * chore(internal): codegen related update * feat(api): api update * release: 1.12.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 413ee5d commit e319ce4

32 files changed

+857
-2271
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.11.0"
2+
".": "1.12.0"
33
}

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 89
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-f83c849e3e1c614100e19d79e4bd38ae67353a8316264cf89e4e721f3c1a5739.yml
3-
openapi_spec_hash: 01ad62e55b345d5c077dad6144249e32
4-
config_hash: bc9a0a4aa4fd3ff568da7da96bf17419
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-e4ea1ded040ebfa923df0d24ef37ae3c742383828cda85e1489bc2cb5e14da29.yml
3+
openapi_spec_hash: 4cfd1f5f0d42e1b821f70ba12089b606
4+
config_hash: 5c872aa99cad9b9602e84668f5b38a8a

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Changelog
22

3+
## 1.12.0 (2025-08-15)
4+
5+
Full Changelog: [v1.11.0...v1.12.0](https://github.com/knocklabs/knock-python/compare/v1.11.0...v1.12.0)
6+
7+
### Features
8+
9+
* **api:** api update ([f70a0b6](https://github.com/knocklabs/knock-python/commit/f70a0b69abdc524615482436e5b37d8b1322b604))
10+
11+
12+
### Chores
13+
14+
* **internal:** codegen related update ([9ed4c52](https://github.com/knocklabs/knock-python/commit/9ed4c5232de6966be6fb11bc7b8177a8f0e439d2))
15+
* **internal:** fix ruff target version ([be7a302](https://github.com/knocklabs/knock-python/commit/be7a30216cd43a35f08586000ec9ac04ac1aa8e9))
16+
* **internal:** update comment in script ([e7b7278](https://github.com/knocklabs/knock-python/commit/e7b7278927e9d83e7860e2e94f3427f08626d5b1))
17+
* update @stainless-api/prism-cli to v5.15.0 ([a6f9e47](https://github.com/knocklabs/knock-python/commit/a6f9e4701fde8bb018d4a120fa28da17de54e117))
18+
319
## 1.11.0 (2025-08-05)
420

521
Full Changelog: [v1.10.1...v1.11.0](https://github.com/knocklabs/knock-python/compare/v1.10.1...v1.11.0)

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "knockapi"
3-
version = "1.11.0"
3+
version = "1.12.0"
44
description = "The official Python library for the knock API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
@@ -159,7 +159,7 @@ reportPrivateUsage = false
159159
[tool.ruff]
160160
line-length = 120
161161
output-format = "grouped"
162-
target-version = "py37"
162+
target-version = "py38"
163163

164164
[tool.ruff.format]
165165
docstring-code-format = true

scripts/mock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}"
2121

2222
# Run prism mock on the given spec
2323
if [ "$1" == "--daemon" ]; then
24-
npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log &
24+
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log &
2525

2626
# Wait for server to come online
2727
echo -n "Waiting for server"
@@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then
3737

3838
echo
3939
else
40-
npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL"
40+
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL"
4141
fi

scripts/test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ elif ! prism_is_running ; then
4343
echo -e "To run the server, pass in the path or url of your OpenAPI"
4444
echo -e "spec to the prism command:"
4545
echo
46-
echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}"
46+
echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
4747
echo
4848

4949
exit 1

src/knockapi/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "knockapi"
4-
__version__ = "1.11.0" # x-release-please-version
4+
__version__ = "1.12.0" # x-release-please-version

src/knockapi/resources/objects/objects.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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,

src/knockapi/resources/users/users.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,7 @@ def set_preferences(
739739
user_id: str,
740740
id: str,
741741
*,
742+
_persistence_strategy: Literal["merge", "replace"] | NotGiven = NOT_GIVEN,
742743
categories: Optional[Dict[str, user_set_preferences_params.Categories]] | NotGiven = NOT_GIVEN,
743744
channel_types: Optional[PreferenceSetChannelTypesParam] | NotGiven = NOT_GIVEN,
744745
workflows: Optional[Dict[str, user_set_preferences_params.Workflows]] | NotGiven = NOT_GIVEN,
@@ -751,10 +752,15 @@ def set_preferences(
751752
) -> PreferenceSet:
752753
"""Updates a complete preference set for a user.
753754
754-
This is a destructive operation
755-
that will replace the existing preference set for the user.
755+
By default, this is a destructive
756+
operation and will replace any existing preferences with the preferences given.
757+
Use '**persistence_strategy**': 'merge' to merge with existing preferences
758+
instead.
756759
757760
Args:
761+
_persistence_strategy: Controls how the preference set is persisted. 'replace' will completely replace
762+
the preference set, 'merge' will merge with existing preferences.
763+
758764
categories: An object where the key is the category and the values are the preference
759765
settings for that category.
760766
@@ -779,6 +785,7 @@ def set_preferences(
779785
f"/v1/users/{user_id}/preferences/{id}",
780786
body=maybe_transform(
781787
{
788+
"_persistence_strategy": _persistence_strategy,
782789
"categories": categories,
783790
"channel_types": channel_types,
784791
"workflows": workflows,
@@ -1499,6 +1506,7 @@ async def set_preferences(
14991506
user_id: str,
15001507
id: str,
15011508
*,
1509+
_persistence_strategy: Literal["merge", "replace"] | NotGiven = NOT_GIVEN,
15021510
categories: Optional[Dict[str, user_set_preferences_params.Categories]] | NotGiven = NOT_GIVEN,
15031511
channel_types: Optional[PreferenceSetChannelTypesParam] | NotGiven = NOT_GIVEN,
15041512
workflows: Optional[Dict[str, user_set_preferences_params.Workflows]] | NotGiven = NOT_GIVEN,
@@ -1511,10 +1519,15 @@ async def set_preferences(
15111519
) -> PreferenceSet:
15121520
"""Updates a complete preference set for a user.
15131521
1514-
This is a destructive operation
1515-
that will replace the existing preference set for the user.
1522+
By default, this is a destructive
1523+
operation and will replace any existing preferences with the preferences given.
1524+
Use '**persistence_strategy**': 'merge' to merge with existing preferences
1525+
instead.
15161526
15171527
Args:
1528+
_persistence_strategy: Controls how the preference set is persisted. 'replace' will completely replace
1529+
the preference set, 'merge' will merge with existing preferences.
1530+
15181531
categories: An object where the key is the category and the values are the preference
15191532
settings for that category.
15201533
@@ -1539,6 +1552,7 @@ async def set_preferences(
15391552
f"/v1/users/{user_id}/preferences/{id}",
15401553
body=await async_maybe_transform(
15411554
{
1555+
"_persistence_strategy": _persistence_strategy,
15421556
"categories": categories,
15431557
"channel_types": channel_types,
15441558
"workflows": workflows,

src/knockapi/types/object_set_preferences_params.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
from __future__ import annotations
44

55
from typing import Dict, Union, Iterable, Optional
6-
from typing_extensions import TypeAlias, TypedDict
6+
from typing_extensions import Literal, Annotated, TypeAlias, TypedDict
77

8+
from .._utils import PropertyInfo
89
from .condition_param import ConditionParam
910
from .recipients.preference_set_channel_types_param import PreferenceSetChannelTypesParam
1011

@@ -18,6 +19,13 @@
1819

1920

2021
class ObjectSetPreferencesParams(TypedDict, total=False):
22+
_persistence_strategy: Annotated[Literal["merge", "replace"], PropertyInfo(alias="__persistence_strategy__")]
23+
"""Controls how the preference set is persisted.
24+
25+
'replace' will completely replace the preference set, 'merge' will merge with
26+
existing preferences.
27+
"""
28+
2129
categories: Optional[Dict[str, Categories]]
2230
"""
2331
An object where the key is the category and the values are the preference

0 commit comments

Comments
 (0)