Skip to content

Commit f7c8ed5

Browse files
release: 1.19.0 (#68)
* fix(compat): update signatures of `model_dump` and `model_dump_json` for Pydantic v1 * feat(api): api update * feat(api): api update * feat(api): Add bulk delete subscriptions * release: 1.19.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 7ea55e3 commit f7c8ed5

File tree

17 files changed

+510
-43
lines changed

17 files changed

+510
-43
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.18.1"
2+
".": "1.19.0"
33
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 89
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
1+
configured_endpoints: 90
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-ce72fff9b44a47ab7e0425e496f09c61cde5b4258feb20cb5dbef6fa615a57e4.yml
3+
openapi_spec_hash: 3054ea299cf43dc89b68266818fecfe4
4+
config_hash: 2b42d138d85c524e65fa7e205d36cc4a

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.19.0 (2025-11-20)
4+
5+
Full Changelog: [v1.18.1...v1.19.0](https://github.com/knocklabs/knock-python/compare/v1.18.1...v1.19.0)
6+
7+
### Features
8+
9+
* **api:** Add bulk delete subscriptions ([19e98c2](https://github.com/knocklabs/knock-python/commit/19e98c23c849f558c931993cf4b4b51c8aa6cba9))
10+
* **api:** api update ([fd69af2](https://github.com/knocklabs/knock-python/commit/fd69af2d0bceb8268ffe5332d27f164ba8d9cc40))
11+
* **api:** api update ([73a3ba3](https://github.com/knocklabs/knock-python/commit/73a3ba3c1d5e370f31d781f13b211c18c0ba2b25))
12+
13+
14+
### Bug Fixes
15+
16+
* **compat:** update signatures of `model_dump` and `model_dump_json` for Pydantic v1 ([8800c2d](https://github.com/knocklabs/knock-python/commit/8800c2da8a3bd29950d784f87c60d9725a5657b6))
17+
318
## 1.18.1 (2025-11-10)
419

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

api.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ Methods:
164164

165165
- <code title="post /v1/objects/{collection}/bulk/delete">client.objects.bulk.<a href="./src/knockapi/resources/objects/bulk.py">delete</a>(collection, \*\*<a href="src/knockapi/types/objects/bulk_delete_params.py">params</a>) -> <a href="./src/knockapi/types/bulk_operation.py">BulkOperation</a></code>
166166
- <code title="post /v1/objects/{collection}/bulk/subscriptions/add">client.objects.bulk.<a href="./src/knockapi/resources/objects/bulk.py">add_subscriptions</a>(collection, \*\*<a href="src/knockapi/types/objects/bulk_add_subscriptions_params.py">params</a>) -> <a href="./src/knockapi/types/bulk_operation.py">BulkOperation</a></code>
167+
- <code title="post /v1/objects/{collection}/bulk/subscriptions/delete">client.objects.bulk.<a href="./src/knockapi/resources/objects/bulk.py">delete_subscriptions</a>(collection, \*\*<a href="src/knockapi/types/objects/bulk_delete_subscriptions_params.py">params</a>) -> <a href="./src/knockapi/types/bulk_operation.py">BulkOperation</a></code>
167168
- <code title="post /v1/objects/{collection}/bulk/set">client.objects.bulk.<a href="./src/knockapi/resources/objects/bulk.py">set</a>(collection, \*\*<a href="src/knockapi/types/objects/bulk_set_params.py">params</a>) -> <a href="./src/knockapi/types/bulk_operation.py">BulkOperation</a></code>
168169

169170
# Tenants
@@ -178,7 +179,7 @@ Methods:
178179

179180
- <code title="get /v1/tenants">client.tenants.<a href="./src/knockapi/resources/tenants/tenants.py">list</a>(\*\*<a href="src/knockapi/types/tenant_list_params.py">params</a>) -> <a href="./src/knockapi/types/tenant.py">SyncEntriesCursor[Tenant]</a></code>
180181
- <code title="delete /v1/tenants/{id}">client.tenants.<a href="./src/knockapi/resources/tenants/tenants.py">delete</a>(id) -> None</code>
181-
- <code title="get /v1/tenants/{id}">client.tenants.<a href="./src/knockapi/resources/tenants/tenants.py">get</a>(id) -> <a href="./src/knockapi/types/tenant.py">Tenant</a></code>
182+
- <code title="get /v1/tenants/{id}">client.tenants.<a href="./src/knockapi/resources/tenants/tenants.py">get</a>(id, \*\*<a href="src/knockapi/types/tenant_get_params.py">params</a>) -> <a href="./src/knockapi/types/tenant.py">Tenant</a></code>
182183
- <code title="put /v1/tenants/{id}">client.tenants.<a href="./src/knockapi/resources/tenants/tenants.py">set</a>(id, \*\*<a href="src/knockapi/types/tenant_set_params.py">params</a>) -> <a href="./src/knockapi/types/tenant.py">Tenant</a></code>
183184

184185
## Bulk

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

src/knockapi/_models.py

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -257,32 +257,41 @@ def model_dump(
257257
mode: Literal["json", "python"] | str = "python",
258258
include: IncEx | None = None,
259259
exclude: IncEx | None = None,
260+
context: Any | None = None,
260261
by_alias: bool | None = None,
261262
exclude_unset: bool = False,
262263
exclude_defaults: bool = False,
263264
exclude_none: bool = False,
265+
exclude_computed_fields: bool = False,
264266
round_trip: bool = False,
265267
warnings: bool | Literal["none", "warn", "error"] = True,
266-
context: dict[str, Any] | None = None,
267-
serialize_as_any: bool = False,
268268
fallback: Callable[[Any], Any] | None = None,
269+
serialize_as_any: bool = False,
269270
) -> dict[str, Any]:
270271
"""Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump
271272
272273
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
273274
274275
Args:
275276
mode: The mode in which `to_python` should run.
276-
If mode is 'json', the dictionary will only contain JSON serializable types.
277-
If mode is 'python', the dictionary may contain any Python objects.
278-
include: A list of fields to include in the output.
279-
exclude: A list of fields to exclude from the output.
277+
If mode is 'json', the output will only contain JSON serializable types.
278+
If mode is 'python', the output may contain non-JSON-serializable Python objects.
279+
include: A set of fields to include in the output.
280+
exclude: A set of fields to exclude from the output.
281+
context: Additional context to pass to the serializer.
280282
by_alias: Whether to use the field's alias in the dictionary key if defined.
281-
exclude_unset: Whether to exclude fields that are unset or None from the output.
282-
exclude_defaults: Whether to exclude fields that are set to their default value from the output.
283-
exclude_none: Whether to exclude fields that have a value of `None` from the output.
284-
round_trip: Whether to enable serialization and deserialization round-trip support.
285-
warnings: Whether to log warnings when invalid fields are encountered.
283+
exclude_unset: Whether to exclude fields that have not been explicitly set.
284+
exclude_defaults: Whether to exclude fields that are set to their default value.
285+
exclude_none: Whether to exclude fields that have a value of `None`.
286+
exclude_computed_fields: Whether to exclude computed fields.
287+
While this can be useful for round-tripping, it is usually recommended to use the dedicated
288+
`round_trip` parameter instead.
289+
round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T].
290+
warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors,
291+
"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError].
292+
fallback: A function to call when an unknown value is encountered. If not provided,
293+
a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised.
294+
serialize_as_any: Whether to serialize fields with duck-typing serialization behavior.
286295
287296
Returns:
288297
A dictionary representation of the model.
@@ -299,6 +308,8 @@ def model_dump(
299308
raise ValueError("serialize_as_any is only supported in Pydantic v2")
300309
if fallback is not None:
301310
raise ValueError("fallback is only supported in Pydantic v2")
311+
if exclude_computed_fields != False:
312+
raise ValueError("exclude_computed_fields is only supported in Pydantic v2")
302313
dumped = super().dict( # pyright: ignore[reportDeprecated]
303314
include=include,
304315
exclude=exclude,
@@ -315,15 +326,17 @@ def model_dump_json(
315326
self,
316327
*,
317328
indent: int | None = None,
329+
ensure_ascii: bool = False,
318330
include: IncEx | None = None,
319331
exclude: IncEx | None = None,
332+
context: Any | None = None,
320333
by_alias: bool | None = None,
321334
exclude_unset: bool = False,
322335
exclude_defaults: bool = False,
323336
exclude_none: bool = False,
337+
exclude_computed_fields: bool = False,
324338
round_trip: bool = False,
325339
warnings: bool | Literal["none", "warn", "error"] = True,
326-
context: dict[str, Any] | None = None,
327340
fallback: Callable[[Any], Any] | None = None,
328341
serialize_as_any: bool = False,
329342
) -> str:
@@ -355,6 +368,10 @@ def model_dump_json(
355368
raise ValueError("serialize_as_any is only supported in Pydantic v2")
356369
if fallback is not None:
357370
raise ValueError("fallback is only supported in Pydantic v2")
371+
if ensure_ascii != False:
372+
raise ValueError("ensure_ascii is only supported in Pydantic v2")
373+
if exclude_computed_fields != False:
374+
raise ValueError("exclude_computed_fields is only supported in Pydantic v2")
358375
return super().json( # type: ignore[reportDeprecated]
359376
indent=indent,
360377
include=include,

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

src/knockapi/resources/objects/bulk.py

Lines changed: 116 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717
async_to_streamed_response_wrapper,
1818
)
1919
from ..._base_client import make_request_options
20-
from ...types.objects import bulk_set_params, bulk_delete_params, bulk_add_subscriptions_params
20+
from ...types.objects import (
21+
bulk_set_params,
22+
bulk_delete_params,
23+
bulk_add_subscriptions_params,
24+
bulk_delete_subscriptions_params,
25+
)
2126
from ...types.bulk_operation import BulkOperation
2227

2328
__all__ = ["BulkResource", "AsyncBulkResource"]
@@ -109,7 +114,7 @@ def add_subscriptions(
109114
for the `recipient` field.
110115
111116
Args:
112-
subscriptions: A list of subscriptions.
117+
subscriptions: A nested list of subscriptions.
113118
114119
extra_headers: Send extra headers
115120
@@ -138,6 +143,54 @@ def add_subscriptions(
138143
cast_to=BulkOperation,
139144
)
140145

146+
def delete_subscriptions(
147+
self,
148+
collection: str,
149+
*,
150+
subscriptions: Iterable[bulk_delete_subscriptions_params.Subscription],
151+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
152+
# The extra values given here take precedence over values defined on the client or passed to this method.
153+
extra_headers: Headers | None = None,
154+
extra_query: Query | None = None,
155+
extra_body: Body | None = None,
156+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
157+
idempotency_key: str | None = None,
158+
) -> BulkOperation:
159+
"""Delete subscriptions for many objects in a single collection type.
160+
161+
If a
162+
subscription for an object in the collection doesn't exist, it will be skipped.
163+
164+
Args:
165+
subscriptions: A nested list of subscriptions.
166+
167+
extra_headers: Send extra headers
168+
169+
extra_query: Add additional query parameters to the request
170+
171+
extra_body: Add additional JSON properties to the request
172+
173+
timeout: Override the client-level default timeout for this request, in seconds
174+
175+
idempotency_key: Specify a custom idempotency key for this request
176+
"""
177+
if not collection:
178+
raise ValueError(f"Expected a non-empty value for `collection` but received {collection!r}")
179+
return self._post(
180+
f"/v1/objects/{collection}/bulk/subscriptions/delete",
181+
body=maybe_transform(
182+
{"subscriptions": subscriptions}, bulk_delete_subscriptions_params.BulkDeleteSubscriptionsParams
183+
),
184+
options=make_request_options(
185+
extra_headers=extra_headers,
186+
extra_query=extra_query,
187+
extra_body=extra_body,
188+
timeout=timeout,
189+
idempotency_key=idempotency_key,
190+
),
191+
cast_to=BulkOperation,
192+
)
193+
141194
def set(
142195
self,
143196
collection: str,
@@ -269,7 +322,7 @@ async def add_subscriptions(
269322
for the `recipient` field.
270323
271324
Args:
272-
subscriptions: A list of subscriptions.
325+
subscriptions: A nested list of subscriptions.
273326
274327
extra_headers: Send extra headers
275328
@@ -298,6 +351,54 @@ async def add_subscriptions(
298351
cast_to=BulkOperation,
299352
)
300353

354+
async def delete_subscriptions(
355+
self,
356+
collection: str,
357+
*,
358+
subscriptions: Iterable[bulk_delete_subscriptions_params.Subscription],
359+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
360+
# The extra values given here take precedence over values defined on the client or passed to this method.
361+
extra_headers: Headers | None = None,
362+
extra_query: Query | None = None,
363+
extra_body: Body | None = None,
364+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
365+
idempotency_key: str | None = None,
366+
) -> BulkOperation:
367+
"""Delete subscriptions for many objects in a single collection type.
368+
369+
If a
370+
subscription for an object in the collection doesn't exist, it will be skipped.
371+
372+
Args:
373+
subscriptions: A nested list of subscriptions.
374+
375+
extra_headers: Send extra headers
376+
377+
extra_query: Add additional query parameters to the request
378+
379+
extra_body: Add additional JSON properties to the request
380+
381+
timeout: Override the client-level default timeout for this request, in seconds
382+
383+
idempotency_key: Specify a custom idempotency key for this request
384+
"""
385+
if not collection:
386+
raise ValueError(f"Expected a non-empty value for `collection` but received {collection!r}")
387+
return await self._post(
388+
f"/v1/objects/{collection}/bulk/subscriptions/delete",
389+
body=await async_maybe_transform(
390+
{"subscriptions": subscriptions}, bulk_delete_subscriptions_params.BulkDeleteSubscriptionsParams
391+
),
392+
options=make_request_options(
393+
extra_headers=extra_headers,
394+
extra_query=extra_query,
395+
extra_body=extra_body,
396+
timeout=timeout,
397+
idempotency_key=idempotency_key,
398+
),
399+
cast_to=BulkOperation,
400+
)
401+
301402
async def set(
302403
self,
303404
collection: str,
@@ -353,6 +454,9 @@ def __init__(self, bulk: BulkResource) -> None:
353454
self.add_subscriptions = to_raw_response_wrapper(
354455
bulk.add_subscriptions,
355456
)
457+
self.delete_subscriptions = to_raw_response_wrapper(
458+
bulk.delete_subscriptions,
459+
)
356460
self.set = to_raw_response_wrapper(
357461
bulk.set,
358462
)
@@ -368,6 +472,9 @@ def __init__(self, bulk: AsyncBulkResource) -> None:
368472
self.add_subscriptions = async_to_raw_response_wrapper(
369473
bulk.add_subscriptions,
370474
)
475+
self.delete_subscriptions = async_to_raw_response_wrapper(
476+
bulk.delete_subscriptions,
477+
)
371478
self.set = async_to_raw_response_wrapper(
372479
bulk.set,
373480
)
@@ -383,6 +490,9 @@ def __init__(self, bulk: BulkResource) -> None:
383490
self.add_subscriptions = to_streamed_response_wrapper(
384491
bulk.add_subscriptions,
385492
)
493+
self.delete_subscriptions = to_streamed_response_wrapper(
494+
bulk.delete_subscriptions,
495+
)
386496
self.set = to_streamed_response_wrapper(
387497
bulk.set,
388498
)
@@ -398,6 +508,9 @@ def __init__(self, bulk: AsyncBulkResource) -> None:
398508
self.add_subscriptions = async_to_streamed_response_wrapper(
399509
bulk.add_subscriptions,
400510
)
511+
self.delete_subscriptions = async_to_streamed_response_wrapper(
512+
bulk.delete_subscriptions,
513+
)
401514
self.set = async_to_streamed_response_wrapper(
402515
bulk.set,
403516
)

0 commit comments

Comments
 (0)