Skip to content

Commit 0fb5750

Browse files
release: 1.17.0 (#65)
* feat(api): api update * feat(api): api update * feat(api): api update * feat(api): api update * fix(client): close streams without requiring full consumption * chore(internal/tests): avoid race condition with implicit client cleanup * feat(api): api update * release: 1.17.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 90174df commit 0fb5750

File tree

10 files changed

+440
-188
lines changed

10 files changed

+440
-188
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.16.0"
2+
".": "1.17.0"
33
}

.stats.yml

Lines changed: 2 additions & 2 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-40ca41599f579fdd44c2e3e32a7d1bba51ba567050c0dcd5bc099ce8d48bba97.yml
3-
openapi_spec_hash: 72e32d434bbd7ccf7296a2eed7c642ef
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-092c2b568690b68f1683b668b1d14db02854ef1a6e70d9f96efcd5f6e3e95ed7.yml
3+
openapi_spec_hash: 0ddb0d27c5cb719cddddbf204394d9fa
44
config_hash: 658c551418df454aa40794f8ac679c18

CHANGELOG.md

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

3+
## 1.17.0 (2025-10-30)
4+
5+
Full Changelog: [v1.16.0...v1.17.0](https://github.com/knocklabs/knock-python/compare/v1.16.0...v1.17.0)
6+
7+
### Features
8+
9+
* **api:** api update ([7c98b41](https://github.com/knocklabs/knock-python/commit/7c98b41d8a73fb28f15094760ce8e8981017616f))
10+
* **api:** api update ([da9738c](https://github.com/knocklabs/knock-python/commit/da9738cdc04fb7d602636f64be5fe089b9992660))
11+
* **api:** api update ([ed246b8](https://github.com/knocklabs/knock-python/commit/ed246b8f6739ca8b2fde96173cb372d7b519c250))
12+
* **api:** api update ([68227fd](https://github.com/knocklabs/knock-python/commit/68227fd65152d45667c893f552d14723c62ae0c2))
13+
* **api:** api update ([f2d1c34](https://github.com/knocklabs/knock-python/commit/f2d1c34ea755e2a1f9e0320c6bd8ff2acf4d6fff))
14+
15+
16+
### Bug Fixes
17+
18+
* **client:** close streams without requiring full consumption ([34ef2a9](https://github.com/knocklabs/knock-python/commit/34ef2a90d3a7d6f107f0e7bf0359e50b01623554))
19+
20+
21+
### Chores
22+
23+
* **internal/tests:** avoid race condition with implicit client cleanup ([8126c82](https://github.com/knocklabs/knock-python/commit/8126c829c0d8ca30f80498c475bdae2c74990a59))
24+
325
## 1.16.0 (2025-10-24)
426

527
Full Changelog: [v1.15.0...v1.16.0](https://github.com/knocklabs/knock-python/compare/v1.15.0...v1.16.0)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "knockapi"
3-
version = "1.16.0"
3+
version = "1.17.0"
44
description = "The official Python library for the knock API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/knockapi/_streaming.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@ def __stream__(self) -> Iterator[_T]:
5757
for sse in iterator:
5858
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
5959

60-
# Ensure the entire stream is consumed
61-
for _sse in iterator:
62-
...
60+
# As we might not fully consume the response stream, we need to close it explicitly
61+
response.close()
6362

6463
def __enter__(self) -> Self:
6564
return self
@@ -121,9 +120,8 @@ async def __stream__(self) -> AsyncIterator[_T]:
121120
async for sse in iterator:
122121
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
123122

124-
# Ensure the entire stream is consumed
125-
async for _sse in iterator:
126-
...
123+
# As we might not fully consume the response stream, we need to close it explicitly
124+
await response.aclose()
127125

128126
async def __aenter__(self) -> Self:
129127
return self

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.16.0" # x-release-please-version
4+
__version__ = "1.17.0" # x-release-please-version

src/knockapi/types/object_set_channel_data_params.py

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Union
5+
from typing import Union, Iterable, Optional
66
from typing_extensions import Required, TypeAlias, TypedDict
77

88
from .._types import SequenceNotStr
@@ -14,7 +14,11 @@
1414
"ObjectSetChannelDataParams",
1515
"Data",
1616
"DataPushChannelDataTokensOnly",
17+
"DataPushChannelDataDevicesOnly",
18+
"DataPushChannelDataDevicesOnlyDevice",
1719
"DataAwssnsPushChannelDataTargetArNsOnly",
20+
"DataAwssnsPushChannelDataDevicesOnly",
21+
"DataAwssnsPushChannelDataDevicesOnlyDevice",
1822
"DataOneSignalChannelDataPlayerIDsOnly",
1923
]
2024

@@ -29,6 +33,34 @@ class DataPushChannelDataTokensOnly(TypedDict, total=False):
2933
"""A list of push channel tokens."""
3034

3135

36+
class DataPushChannelDataDevicesOnlyDevice(TypedDict, total=False):
37+
token: Required[str]
38+
"""The device token to send the push notification to."""
39+
40+
locale: Optional[str]
41+
"""The locale of the object.
42+
43+
Used for [message localization](/concepts/translations).
44+
"""
45+
46+
timezone: Optional[str]
47+
"""The timezone of the object.
48+
49+
Must be a
50+
valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
51+
Used
52+
for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients).
53+
"""
54+
55+
56+
class DataPushChannelDataDevicesOnly(TypedDict, total=False):
57+
devices: Required[Iterable[DataPushChannelDataDevicesOnlyDevice]]
58+
"""A list of devices.
59+
60+
Each device contains a token, and optionally a locale and timezone.
61+
"""
62+
63+
3264
class DataAwssnsPushChannelDataTargetArNsOnly(TypedDict, total=False):
3365
target_arns: Required[SequenceNotStr[str]]
3466
"""A list of platform endpoint ARNs.
@@ -38,14 +70,48 @@ class DataAwssnsPushChannelDataTargetArNsOnly(TypedDict, total=False):
3870
"""
3971

4072

73+
class DataAwssnsPushChannelDataDevicesOnlyDevice(TypedDict, total=False):
74+
target_arn: Required[str]
75+
"""
76+
The ARN of a platform endpoint associated with a platform application and a
77+
device token. See
78+
[Setting up an Amazon SNS platform endpoint for mobile notifications](https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html).
79+
"""
80+
81+
locale: Optional[str]
82+
"""The locale of the object.
83+
84+
Used for [message localization](/concepts/translations).
85+
"""
86+
87+
timezone: Optional[str]
88+
"""The timezone of the object.
89+
90+
Must be a
91+
valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
92+
Used
93+
for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients).
94+
"""
95+
96+
97+
class DataAwssnsPushChannelDataDevicesOnly(TypedDict, total=False):
98+
devices: Required[Iterable[DataAwssnsPushChannelDataDevicesOnlyDevice]]
99+
"""A list of devices.
100+
101+
Each device contains a target_arn, and optionally a locale and timezone.
102+
"""
103+
104+
41105
class DataOneSignalChannelDataPlayerIDsOnly(TypedDict, total=False):
42106
player_ids: Required[SequenceNotStr[str]]
43107
"""A list of OneSignal player IDs."""
44108

45109

46110
Data: TypeAlias = Union[
47111
DataPushChannelDataTokensOnly,
112+
DataPushChannelDataDevicesOnly,
48113
DataAwssnsPushChannelDataTargetArNsOnly,
114+
DataAwssnsPushChannelDataDevicesOnly,
49115
DataOneSignalChannelDataPlayerIDsOnly,
50116
SlackChannelDataParam,
51117
MsTeamsChannelDataParam,

src/knockapi/types/recipients/inline_channel_data_request_param.py

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, Union
5+
from typing import Dict, Union, Iterable, Optional
66
from typing_extensions import Required, TypeAlias, TypedDict
77

88
from ..._types import SequenceNotStr
@@ -14,7 +14,11 @@
1414
"InlineChannelDataRequestParam",
1515
"InlineChannelDataRequestParamItem",
1616
"InlineChannelDataRequestParamItemPushChannelDataTokensOnly",
17+
"InlineChannelDataRequestParamItemPushChannelDataDevicesOnly",
18+
"InlineChannelDataRequestParamItemPushChannelDataDevicesOnlyDevice",
1719
"InlineChannelDataRequestParamItemAwssnsPushChannelDataTargetArNsOnly",
20+
"InlineChannelDataRequestParamItemAwssnsPushChannelDataDevicesOnly",
21+
"InlineChannelDataRequestParamItemAwssnsPushChannelDataDevicesOnlyDevice",
1822
"InlineChannelDataRequestParamItemOneSignalChannelDataPlayerIDsOnly",
1923
]
2024

@@ -24,6 +28,34 @@ class InlineChannelDataRequestParamItemPushChannelDataTokensOnly(TypedDict, tota
2428
"""A list of push channel tokens."""
2529

2630

31+
class InlineChannelDataRequestParamItemPushChannelDataDevicesOnlyDevice(TypedDict, total=False):
32+
token: Required[str]
33+
"""The device token to send the push notification to."""
34+
35+
locale: Optional[str]
36+
"""The locale of the object.
37+
38+
Used for [message localization](/concepts/translations).
39+
"""
40+
41+
timezone: Optional[str]
42+
"""The timezone of the object.
43+
44+
Must be a
45+
valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
46+
Used
47+
for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients).
48+
"""
49+
50+
51+
class InlineChannelDataRequestParamItemPushChannelDataDevicesOnly(TypedDict, total=False):
52+
devices: Required[Iterable[InlineChannelDataRequestParamItemPushChannelDataDevicesOnlyDevice]]
53+
"""A list of devices.
54+
55+
Each device contains a token, and optionally a locale and timezone.
56+
"""
57+
58+
2759
class InlineChannelDataRequestParamItemAwssnsPushChannelDataTargetArNsOnly(TypedDict, total=False):
2860
target_arns: Required[SequenceNotStr[str]]
2961
"""A list of platform endpoint ARNs.
@@ -33,14 +65,48 @@ class InlineChannelDataRequestParamItemAwssnsPushChannelDataTargetArNsOnly(Typed
3365
"""
3466

3567

68+
class InlineChannelDataRequestParamItemAwssnsPushChannelDataDevicesOnlyDevice(TypedDict, total=False):
69+
target_arn: Required[str]
70+
"""
71+
The ARN of a platform endpoint associated with a platform application and a
72+
device token. See
73+
[Setting up an Amazon SNS platform endpoint for mobile notifications](https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html).
74+
"""
75+
76+
locale: Optional[str]
77+
"""The locale of the object.
78+
79+
Used for [message localization](/concepts/translations).
80+
"""
81+
82+
timezone: Optional[str]
83+
"""The timezone of the object.
84+
85+
Must be a
86+
valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
87+
Used
88+
for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients).
89+
"""
90+
91+
92+
class InlineChannelDataRequestParamItemAwssnsPushChannelDataDevicesOnly(TypedDict, total=False):
93+
devices: Required[Iterable[InlineChannelDataRequestParamItemAwssnsPushChannelDataDevicesOnlyDevice]]
94+
"""A list of devices.
95+
96+
Each device contains a target_arn, and optionally a locale and timezone.
97+
"""
98+
99+
36100
class InlineChannelDataRequestParamItemOneSignalChannelDataPlayerIDsOnly(TypedDict, total=False):
37101
player_ids: Required[SequenceNotStr[str]]
38102
"""A list of OneSignal player IDs."""
39103

40104

41105
InlineChannelDataRequestParamItem: TypeAlias = Union[
42106
InlineChannelDataRequestParamItemPushChannelDataTokensOnly,
107+
InlineChannelDataRequestParamItemPushChannelDataDevicesOnly,
43108
InlineChannelDataRequestParamItemAwssnsPushChannelDataTargetArNsOnly,
109+
InlineChannelDataRequestParamItemAwssnsPushChannelDataDevicesOnly,
44110
InlineChannelDataRequestParamItemOneSignalChannelDataPlayerIDsOnly,
45111
SlackChannelDataParam,
46112
MsTeamsChannelDataParam,

src/knockapi/types/user_set_channel_data_params.py

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Union
5+
from typing import Union, Iterable, Optional
66
from typing_extensions import Required, TypeAlias, TypedDict
77

88
from .._types import SequenceNotStr
@@ -14,7 +14,11 @@
1414
"UserSetChannelDataParams",
1515
"Data",
1616
"DataPushChannelDataTokensOnly",
17+
"DataPushChannelDataDevicesOnly",
18+
"DataPushChannelDataDevicesOnlyDevice",
1719
"DataAwssnsPushChannelDataTargetArNsOnly",
20+
"DataAwssnsPushChannelDataDevicesOnly",
21+
"DataAwssnsPushChannelDataDevicesOnlyDevice",
1822
"DataOneSignalChannelDataPlayerIDsOnly",
1923
]
2024

@@ -29,6 +33,34 @@ class DataPushChannelDataTokensOnly(TypedDict, total=False):
2933
"""A list of push channel tokens."""
3034

3135

36+
class DataPushChannelDataDevicesOnlyDevice(TypedDict, total=False):
37+
token: Required[str]
38+
"""The device token to send the push notification to."""
39+
40+
locale: Optional[str]
41+
"""The locale of the object.
42+
43+
Used for [message localization](/concepts/translations).
44+
"""
45+
46+
timezone: Optional[str]
47+
"""The timezone of the object.
48+
49+
Must be a
50+
valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
51+
Used
52+
for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients).
53+
"""
54+
55+
56+
class DataPushChannelDataDevicesOnly(TypedDict, total=False):
57+
devices: Required[Iterable[DataPushChannelDataDevicesOnlyDevice]]
58+
"""A list of devices.
59+
60+
Each device contains a token, and optionally a locale and timezone.
61+
"""
62+
63+
3264
class DataAwssnsPushChannelDataTargetArNsOnly(TypedDict, total=False):
3365
target_arns: Required[SequenceNotStr[str]]
3466
"""A list of platform endpoint ARNs.
@@ -38,14 +70,48 @@ class DataAwssnsPushChannelDataTargetArNsOnly(TypedDict, total=False):
3870
"""
3971

4072

73+
class DataAwssnsPushChannelDataDevicesOnlyDevice(TypedDict, total=False):
74+
target_arn: Required[str]
75+
"""
76+
The ARN of a platform endpoint associated with a platform application and a
77+
device token. See
78+
[Setting up an Amazon SNS platform endpoint for mobile notifications](https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html).
79+
"""
80+
81+
locale: Optional[str]
82+
"""The locale of the object.
83+
84+
Used for [message localization](/concepts/translations).
85+
"""
86+
87+
timezone: Optional[str]
88+
"""The timezone of the object.
89+
90+
Must be a
91+
valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
92+
Used
93+
for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients).
94+
"""
95+
96+
97+
class DataAwssnsPushChannelDataDevicesOnly(TypedDict, total=False):
98+
devices: Required[Iterable[DataAwssnsPushChannelDataDevicesOnlyDevice]]
99+
"""A list of devices.
100+
101+
Each device contains a target_arn, and optionally a locale and timezone.
102+
"""
103+
104+
41105
class DataOneSignalChannelDataPlayerIDsOnly(TypedDict, total=False):
42106
player_ids: Required[SequenceNotStr[str]]
43107
"""A list of OneSignal player IDs."""
44108

45109

46110
Data: TypeAlias = Union[
47111
DataPushChannelDataTokensOnly,
112+
DataPushChannelDataDevicesOnly,
48113
DataAwssnsPushChannelDataTargetArNsOnly,
114+
DataAwssnsPushChannelDataDevicesOnly,
49115
DataOneSignalChannelDataPlayerIDsOnly,
50116
SlackChannelDataParam,
51117
MsTeamsChannelDataParam,

0 commit comments

Comments
 (0)