Skip to content

Commit 40e23bf

Browse files
release: 1.18.0 (#66)
* chore(internal): grammar fix (it's -> its) * feat: correct channel data schemas Ensure the config has the latest channel data schemas * feat(api): api update * feat(api): support specifying a branch * release: 1.18.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 0fb5750 commit 40e23bf

38 files changed

+353
-428
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.17.0"
2+
".": "1.18.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-092c2b568690b68f1683b668b1d14db02854ef1a6e70d9f96efcd5f6e3e95ed7.yml
3-
openapi_spec_hash: 0ddb0d27c5cb719cddddbf204394d9fa
4-
config_hash: 658c551418df454aa40794f8ac679c18
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-1584eaacf779edacf947595928550c8914bd5f39e68c9ef7d8af8dd65e36187a.yml
3+
openapi_spec_hash: 1e56a42e6985e71dfe1a58ff352b57cd
4+
config_hash: 1470ae08f436e4d00dd096cb585b41fd

CHANGELOG.md

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

3+
## 1.18.0 (2025-11-07)
4+
5+
Full Changelog: [v1.17.0...v1.18.0](https://github.com/knocklabs/knock-python/compare/v1.17.0...v1.18.0)
6+
7+
### Features
8+
9+
* **api:** api update ([be33019](https://github.com/knocklabs/knock-python/commit/be33019381cfb5ee35be3960c8ea28a7078b234a))
10+
* **api:** support specifying a branch ([cbed5ed](https://github.com/knocklabs/knock-python/commit/cbed5ed3d3a8995d6167008addadec5e138e63e5))
11+
* correct channel data schemas ([fadc24d](https://github.com/knocklabs/knock-python/commit/fadc24d9363b9cf33377e696cd6863dff8e38e55))
12+
13+
14+
### Chores
15+
16+
* **internal:** grammar fix (it's -&gt; its) ([49b5e48](https://github.com/knocklabs/knock-python/commit/49b5e48c10abe112361fd92f4c7a74fc7543706a))
17+
318
## 1.17.0 (2025-10-30)
419

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

api.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Types:
2828
from knockapi.types.recipients import (
2929
InlinePreferenceSetRequest,
3030
PreferenceSet,
31+
PreferenceSetChannelSetting,
3132
PreferenceSetChannelTypeSetting,
3233
PreferenceSetChannelTypes,
3334
PreferenceSetRequest,
@@ -40,11 +41,16 @@ Types:
4041

4142
```python
4243
from knockapi.types.recipients import (
44+
AwsSnsPushChannelDataDevicesOnly,
45+
AwsSnsPushChannelDataTargetArnsOnly,
4346
ChannelData,
4447
ChannelDataRequest,
4548
DiscordChannelData,
4649
InlineChannelDataRequest,
4750
MsTeamsChannelData,
51+
OneSignalChannelDataPlayerIDsOnly,
52+
PushChannelDataDevicesOnly,
53+
PushChannelDataTokensOnly,
4854
SlackChannelData,
4955
)
5056
```

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.17.0"
3+
version = "1.18.0"
44
description = "The official Python library for the knock API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/knockapi/_client.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,13 @@ class Knock(SyncAPIClient):
5858

5959
# client options
6060
api_key: str
61+
branch: str | None
6162

6263
def __init__(
6364
self,
6465
*,
6566
api_key: str | None = None,
67+
branch: str | None = None,
6668
base_url: str | httpx.URL | None = None,
6769
timeout: float | Timeout | None | NotGiven = not_given,
6870
max_retries: int = DEFAULT_MAX_RETRIES,
@@ -84,7 +86,9 @@ def __init__(
8486
) -> None:
8587
"""Construct a new synchronous Knock client instance.
8688
87-
This automatically infers the `api_key` argument from the `KNOCK_API_KEY` environment variable if it is not provided.
89+
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
90+
- `api_key` from `KNOCK_API_KEY`
91+
- `branch` from `KNOCK_BRANCH`
8892
"""
8993
if api_key is None:
9094
api_key = os.environ.get("KNOCK_API_KEY")
@@ -94,6 +98,10 @@ def __init__(
9498
)
9599
self.api_key = api_key
96100

101+
if branch is None:
102+
branch = os.environ.get("KNOCK_BRANCH")
103+
self.branch = branch
104+
97105
if base_url is None:
98106
base_url = os.environ.get("KNOCK_BASE_URL")
99107
if base_url is None:
@@ -143,13 +151,15 @@ def default_headers(self) -> dict[str, str | Omit]:
143151
return {
144152
**super().default_headers,
145153
"X-Stainless-Async": "false",
154+
"X-Knock-Branch": self.branch if self.branch is not None else Omit(),
146155
**self._custom_headers,
147156
}
148157

149158
def copy(
150159
self,
151160
*,
152161
api_key: str | None = None,
162+
branch: str | None = None,
153163
base_url: str | httpx.URL | None = None,
154164
timeout: float | Timeout | None | NotGiven = not_given,
155165
http_client: httpx.Client | None = None,
@@ -184,6 +194,7 @@ def copy(
184194
http_client = http_client or self._client
185195
return self.__class__(
186196
api_key=api_key or self.api_key,
197+
branch=branch or self.branch,
187198
base_url=base_url or self.base_url,
188199
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
189200
http_client=http_client,
@@ -248,11 +259,13 @@ class AsyncKnock(AsyncAPIClient):
248259

249260
# client options
250261
api_key: str
262+
branch: str | None
251263

252264
def __init__(
253265
self,
254266
*,
255267
api_key: str | None = None,
268+
branch: str | None = None,
256269
base_url: str | httpx.URL | None = None,
257270
timeout: float | Timeout | None | NotGiven = not_given,
258271
max_retries: int = DEFAULT_MAX_RETRIES,
@@ -274,7 +287,9 @@ def __init__(
274287
) -> None:
275288
"""Construct a new async AsyncKnock client instance.
276289
277-
This automatically infers the `api_key` argument from the `KNOCK_API_KEY` environment variable if it is not provided.
290+
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
291+
- `api_key` from `KNOCK_API_KEY`
292+
- `branch` from `KNOCK_BRANCH`
278293
"""
279294
if api_key is None:
280295
api_key = os.environ.get("KNOCK_API_KEY")
@@ -284,6 +299,10 @@ def __init__(
284299
)
285300
self.api_key = api_key
286301

302+
if branch is None:
303+
branch = os.environ.get("KNOCK_BRANCH")
304+
self.branch = branch
305+
287306
if base_url is None:
288307
base_url = os.environ.get("KNOCK_BASE_URL")
289308
if base_url is None:
@@ -333,13 +352,15 @@ def default_headers(self) -> dict[str, str | Omit]:
333352
return {
334353
**super().default_headers,
335354
"X-Stainless-Async": f"async:{get_async_library()}",
355+
"X-Knock-Branch": self.branch if self.branch is not None else Omit(),
336356
**self._custom_headers,
337357
}
338358

339359
def copy(
340360
self,
341361
*,
342362
api_key: str | None = None,
363+
branch: str | None = None,
343364
base_url: str | httpx.URL | None = None,
344365
timeout: float | Timeout | None | NotGiven = not_given,
345366
http_client: httpx.AsyncClient | None = None,
@@ -374,6 +395,7 @@ def copy(
374395
http_client = http_client or self._client
375396
return self.__class__(
376397
api_key=api_key or self.api_key,
398+
branch=branch or self.branch,
377399
base_url=base_url or self.base_url,
378400
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
379401
http_client=http_client,

src/knockapi/_utils/_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]:
133133
# Type safe methods for narrowing types with TypeVars.
134134
# The default narrowing for isinstance(obj, dict) is dict[unknown, unknown],
135135
# however this cause Pyright to rightfully report errors. As we know we don't
136-
# care about the contained types we can safely use `object` in it's place.
136+
# care about the contained types we can safely use `object` in its place.
137137
#
138138
# There are two separate functions defined, `is_*` and `is_*_t` for different use cases.
139139
# `is_*` is for when you're dealing with an unknown input

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

src/knockapi/resources/objects/objects.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,7 @@ def set(
710710
*,
711711
channel_data: InlineChannelDataRequestParam | Omit = omit,
712712
locale: Optional[str] | Omit = omit,
713+
name: Optional[str] | Omit = omit,
713714
preferences: InlinePreferenceSetRequestParam | Omit = omit,
714715
timezone: Optional[str] | Omit = omit,
715716
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -731,6 +732,8 @@ def set(
731732
locale: The locale of the object. Used for
732733
[message localization](/concepts/translations).
733734
735+
name: An optional name for the object.
736+
734737
preferences: Inline set preferences for a recipient, where the key is the preference set id.
735738
Preferences that are set inline will be merged into any existing preferences
736739
rather than replacing them.
@@ -760,6 +763,7 @@ def set(
760763
{
761764
"channel_data": channel_data,
762765
"locale": locale,
766+
"name": name,
763767
"preferences": preferences,
764768
"timezone": timezone,
765769
},
@@ -1617,6 +1621,7 @@ async def set(
16171621
*,
16181622
channel_data: InlineChannelDataRequestParam | Omit = omit,
16191623
locale: Optional[str] | Omit = omit,
1624+
name: Optional[str] | Omit = omit,
16201625
preferences: InlinePreferenceSetRequestParam | Omit = omit,
16211626
timezone: Optional[str] | Omit = omit,
16221627
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -1638,6 +1643,8 @@ async def set(
16381643
locale: The locale of the object. Used for
16391644
[message localization](/concepts/translations).
16401645
1646+
name: An optional name for the object.
1647+
16411648
preferences: Inline set preferences for a recipient, where the key is the preference set id.
16421649
Preferences that are set inline will be merged into any existing preferences
16431650
rather than replacing them.
@@ -1667,6 +1674,7 @@ async def set(
16671674
{
16681675
"channel_data": channel_data,
16691676
"locale": locale,
1677+
"name": name,
16701678
"preferences": preferences,
16711679
"timezone": timezone,
16721680
},

src/knockapi/resources/tenants/tenants.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ def set(
196196
id: str,
197197
*,
198198
channel_data: Optional[InlineChannelDataRequestParam] | Omit = omit,
199+
name: Optional[str] | Omit = omit,
199200
settings: tenant_set_params.Settings | Omit = omit,
200201
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
201202
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -213,6 +214,8 @@ def set(
213214
Args:
214215
channel_data: A request to set channel data for a type of channel inline.
215216
217+
name: An optional name for the tenant.
218+
216219
settings: The settings for the tenant. Includes branding and preference set.
217220
218221
extra_headers: Send extra headers
@@ -232,6 +235,7 @@ def set(
232235
body=maybe_transform(
233236
{
234237
"channel_data": channel_data,
238+
"name": name,
235239
"settings": settings,
236240
},
237241
tenant_set_params.TenantSetParams,
@@ -410,6 +414,7 @@ async def set(
410414
id: str,
411415
*,
412416
channel_data: Optional[InlineChannelDataRequestParam] | Omit = omit,
417+
name: Optional[str] | Omit = omit,
413418
settings: tenant_set_params.Settings | Omit = omit,
414419
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
415420
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -427,6 +432,8 @@ async def set(
427432
Args:
428433
channel_data: A request to set channel data for a type of channel inline.
429434
435+
name: An optional name for the tenant.
436+
430437
settings: The settings for the tenant. Includes branding and preference set.
431438
432439
extra_headers: Send extra headers
@@ -446,6 +453,7 @@ async def set(
446453
body=await async_maybe_transform(
447454
{
448455
"channel_data": channel_data,
456+
"name": name,
449457
"settings": settings,
450458
},
451459
tenant_set_params.TenantSetParams,

0 commit comments

Comments
 (0)