Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "7.14.0"
".": "7.15.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 119
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-a64bb97c3455b0689de7f6a297ba1dc1e747561ce310ddb18b9c4a5f4d3d510a.yml
openapi_spec_hash: 6a3b89f3ea7600e784902f61680f8f1a
config_hash: 822a92efc80e63cdb2d496dbd6176620
configured_endpoints: 120
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-cf10f3428ad9b9f636939a9305e80dd49118fea2c3f86cf61bf2b95367469e0f.yml
openapi_spec_hash: a61356bb015cec773770d2b61cabaa58
config_hash: 86b472590f1c27b5a74499744b30c2ee
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 7.15.0 (2026-06-17)

Full Changelog: [v7.14.0...v7.15.0](https://github.com/trycourier/courier-python/compare/v7.14.0...v7.15.0)

### Features

* **openapi:** add add-to-digest JourneyNode variant ([7abe0d3](https://github.com/trycourier/courier-python/commit/7abe0d346d51a31301753dc54ac0025285a14dc8))
* **openapi:** add DELETE /users/{id}/preferences/{topicId} ([1f14fd0](https://github.com/trycourier/courier-python/commit/1f14fd06794d54d5cc6d959867561a72d660462a))

## 7.14.0 (2026-06-12)

Full Changelog: [v7.13.0...v7.14.0](https://github.com/trycourier/courier-python/compare/v7.13.0...v7.14.0)
Expand Down
1 change: 1 addition & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ from courier.types.users import (
Methods:

- <code title="get /users/{user_id}/preferences">client.users.preferences.<a href="./src/courier/resources/users/preferences.py">retrieve</a>(user_id, \*\*<a href="src/courier/types/users/preference_retrieve_params.py">params</a>) -> <a href="./src/courier/types/users/preference_retrieve_response.py">PreferenceRetrieveResponse</a></code>
- <code title="delete /users/{user_id}/preferences/{topic_id}">client.users.preferences.<a href="./src/courier/resources/users/preferences.py">delete_topic</a>(topic_id, \*, user_id, \*\*<a href="src/courier/types/users/preference_delete_topic_params.py">params</a>) -> None</code>
- <code title="get /users/{user_id}/preferences/{topic_id}">client.users.preferences.<a href="./src/courier/resources/users/preferences.py">retrieve_topic</a>(topic_id, \*, user_id, \*\*<a href="src/courier/types/users/preference_retrieve_topic_params.py">params</a>) -> <a href="./src/courier/types/users/preference_retrieve_topic_response.py">PreferenceRetrieveTopicResponse</a></code>
- <code title="put /users/{user_id}/preferences/{topic_id}">client.users.preferences.<a href="./src/courier/resources/users/preferences.py">update_or_create_topic</a>(topic_id, \*, user_id, \*\*<a href="src/courier/types/users/preference_update_or_create_topic_params.py">params</a>) -> <a href="./src/courier/types/users/preference_update_or_create_topic_response.py">PreferenceUpdateOrCreateTopicResponse</a></code>

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "trycourier"
version = "7.14.0"
version = "7.15.0"
description = "The official Python library for the Courier API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/courier/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "courier"
__version__ = "7.14.0" # x-release-please-version
__version__ = "7.15.0" # x-release-please-version
111 changes: 110 additions & 1 deletion src/courier/resources/users/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import httpx

from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given
from ..._utils import path_template, maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
Expand All @@ -18,6 +18,7 @@
)
from ...types.users import (
preference_retrieve_params,
preference_delete_topic_params,
preference_retrieve_topic_params,
preference_update_or_create_topic_params,
)
Expand Down Expand Up @@ -89,6 +90,54 @@ def retrieve(
cast_to=PreferenceRetrieveResponse,
)

def delete_topic(
self,
topic_id: str,
*,
user_id: str,
tenant_id: Optional[str] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> None:
"""
Remove a user's preferences for a specific subscription topic, resetting the
topic to its effective default. This operation is idempotent: deleting a
preference that does not exist succeeds with no error.

Args:
tenant_id: Delete the preferences of a user for this specific tenant context.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not user_id:
raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}")
if not topic_id:
raise ValueError(f"Expected a non-empty value for `topic_id` but received {topic_id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return self._delete(
path_template("/users/{user_id}/preferences/{topic_id}", user_id=user_id, topic_id=topic_id),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform(
{"tenant_id": tenant_id}, preference_delete_topic_params.PreferenceDeleteTopicParams
),
),
cast_to=NoneType,
)

def retrieve_topic(
self,
topic_id: str,
Expand Down Expand Up @@ -247,6 +296,54 @@ async def retrieve(
cast_to=PreferenceRetrieveResponse,
)

async def delete_topic(
self,
topic_id: str,
*,
user_id: str,
tenant_id: Optional[str] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> None:
"""
Remove a user's preferences for a specific subscription topic, resetting the
topic to its effective default. This operation is idempotent: deleting a
preference that does not exist succeeds with no error.

Args:
tenant_id: Delete the preferences of a user for this specific tenant context.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not user_id:
raise ValueError(f"Expected a non-empty value for `user_id` but received {user_id!r}")
if not topic_id:
raise ValueError(f"Expected a non-empty value for `topic_id` but received {topic_id!r}")
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
return await self._delete(
path_template("/users/{user_id}/preferences/{topic_id}", user_id=user_id, topic_id=topic_id),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=await async_maybe_transform(
{"tenant_id": tenant_id}, preference_delete_topic_params.PreferenceDeleteTopicParams
),
),
cast_to=NoneType,
)

async def retrieve_topic(
self,
topic_id: str,
Expand Down Expand Up @@ -350,6 +447,9 @@ def __init__(self, preferences: PreferencesResource) -> None:
self.retrieve = to_raw_response_wrapper(
preferences.retrieve,
)
self.delete_topic = to_raw_response_wrapper(
preferences.delete_topic,
)
self.retrieve_topic = to_raw_response_wrapper(
preferences.retrieve_topic,
)
Expand All @@ -365,6 +465,9 @@ def __init__(self, preferences: AsyncPreferencesResource) -> None:
self.retrieve = async_to_raw_response_wrapper(
preferences.retrieve,
)
self.delete_topic = async_to_raw_response_wrapper(
preferences.delete_topic,
)
self.retrieve_topic = async_to_raw_response_wrapper(
preferences.retrieve_topic,
)
Expand All @@ -380,6 +483,9 @@ def __init__(self, preferences: PreferencesResource) -> None:
self.retrieve = to_streamed_response_wrapper(
preferences.retrieve,
)
self.delete_topic = to_streamed_response_wrapper(
preferences.delete_topic,
)
self.retrieve_topic = to_streamed_response_wrapper(
preferences.retrieve_topic,
)
Expand All @@ -395,6 +501,9 @@ def __init__(self, preferences: AsyncPreferencesResource) -> None:
self.retrieve = async_to_streamed_response_wrapper(
preferences.retrieve,
)
self.delete_topic = async_to_streamed_response_wrapper(
preferences.delete_topic,
)
self.retrieve_topic = async_to_streamed_response_wrapper(
preferences.retrieve_topic,
)
Expand Down
23 changes: 23 additions & 0 deletions src/courier/types/journey_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"JourneyNode",
"JourneyBatchNode",
"JourneyBatchNodeRetain",
"JourneyAddToDigestNode",
"JourneyBranchNode",
"JourneyBranchNodeDefault",
"JourneyBranchNodePath",
Expand Down Expand Up @@ -94,6 +95,27 @@ class JourneyBatchNode(BaseModel):
"""Releases the batch once this many events have been collected."""


class JourneyAddToDigestNode(BaseModel):
"""Add the current event to a digest keyed by the given subscription topic.

The digest accumulates events and releases them on the schedule configured for the topic.
"""

subscription_topic_id: str
"""The subscription topic that owns the digest the event is added to."""

type: Literal["add-to-digest"]

id: Optional[str] = None

conditions: Optional[JourneyConditionsField] = None
"""Condition spec for a journey node.

Accepts a single condition atom, an AND/OR group, or an AND/OR nested group.
Omit the `conditions` property entirely to express "no conditions".
"""


class JourneyBranchNodeDefault(BaseModel):
nodes: List["JourneyNode"]

Expand Down Expand Up @@ -140,6 +162,7 @@ class JourneyBranchNode(BaseModel):
JourneyThrottleStaticNode,
JourneyThrottleDynamicNode,
JourneyBatchNode,
JourneyAddToDigestNode,
JourneyExitNode,
JourneyBranchNode,
]
23 changes: 23 additions & 0 deletions src/courier/types/journey_node_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"JourneyNodeParam",
"JourneyBatchNode",
"JourneyBatchNodeRetain",
"JourneyAddToDigestNode",
"JourneyBranchNode",
"JourneyBranchNodeDefault",
"JourneyBranchNodePath",
Expand Down Expand Up @@ -93,6 +94,27 @@ class JourneyBatchNode(TypedDict, total=False):
"""Releases the batch once this many events have been collected."""


class JourneyAddToDigestNode(TypedDict, total=False):
"""Add the current event to a digest keyed by the given subscription topic.

The digest accumulates events and releases them on the schedule configured for the topic.
"""

subscription_topic_id: Required[str]
"""The subscription topic that owns the digest the event is added to."""

type: Required[Literal["add-to-digest"]]

id: str

conditions: JourneyConditionsFieldParam
"""Condition spec for a journey node.

Accepts a single condition atom, an AND/OR group, or an AND/OR nested group.
Omit the `conditions` property entirely to express "no conditions".
"""


class JourneyBranchNodeDefault(TypedDict, total=False):
nodes: Required[Iterable["JourneyNodeParam"]]

Expand Down Expand Up @@ -139,6 +161,7 @@ class JourneyBranchNode(TypedDict, total=False):
JourneyThrottleStaticNodeParam,
JourneyThrottleDynamicNodeParam,
JourneyBatchNode,
JourneyAddToDigestNode,
JourneyExitNodeParam,
JourneyBranchNode,
]
1 change: 1 addition & 0 deletions src/courier/types/users/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from .preference_retrieve_params import PreferenceRetrieveParams as PreferenceRetrieveParams
from .tenant_add_multiple_params import TenantAddMultipleParams as TenantAddMultipleParams
from .preference_retrieve_response import PreferenceRetrieveResponse as PreferenceRetrieveResponse
from .preference_delete_topic_params import PreferenceDeleteTopicParams as PreferenceDeleteTopicParams
from .preference_retrieve_topic_params import PreferenceRetrieveTopicParams as PreferenceRetrieveTopicParams
from .preference_retrieve_topic_response import PreferenceRetrieveTopicResponse as PreferenceRetrieveTopicResponse
from .preference_update_or_create_topic_params import (
Expand Down
15 changes: 15 additions & 0 deletions src/courier/types/users/preference_delete_topic_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import Optional
from typing_extensions import Required, TypedDict

__all__ = ["PreferenceDeleteTopicParams"]


class PreferenceDeleteTopicParams(TypedDict, total=False):
user_id: Required[str]

tenant_id: Optional[str]
"""Delete the preferences of a user for this specific tenant context."""
Loading