Skip to content
Open
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.17.1"
".": "7.18.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: 134
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-97bb4b698571b6dbe884e93397d14aff0ec7e7279de272a15fa0defb3b2515d5.yml
openapi_spec_hash: c33bf8733151f4f5693788b6e57a8344
config_hash: 74aad10d1512ec69541ece3ca51cf7fa
configured_endpoints: 135
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-e593915c67b3e0e375b6f9cf57d9931f86bc3ee4fd6759ba0e8098d5421fa04e.yml
openapi_spec_hash: 66cc0ce5dda5bda9f416ea3e53c3f5a0
config_hash: 66d7703eac15d2affc326ac25b55bcd6
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 7.18.0 (2026-06-30)

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

### Features

* **openapi:** Journeys cancel-by-token endpoint + send-node experiments (C-18986) ([2506b29](https://github.com/trycourier/courier-python/commit/2506b29674ce56a9d4cfff46b39c849f28ab2875))


### Bug Fixes

* **types:** avoid type-checker errors on params with additional properties ([2898ba5](https://github.com/trycourier/courier-python/commit/2898ba510e0aeb8de9da57e4f50e6951af14f223))

## 7.17.1 (2026-06-25)

Full Changelog: [v7.17.0...v7.17.1](https://github.com/trycourier/courier-python/compare/v7.17.0...v7.17.1)
Expand Down
5 changes: 5 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ Types:

```python
from courier.types import (
CancelJourneyRequest,
CancelJourneyResponse,
CreateJourneyRequest,
Journey,
JourneyAINode,
Expand All @@ -208,6 +210,8 @@ from courier.types import (
JourneyDelayDurationNode,
JourneyDelayUntilNode,
JourneyExitNode,
JourneyExperiment,
JourneyExperimentVariant,
JourneyFetchGetDeleteNode,
JourneyFetchPostPutNode,
JourneyMergeStrategy,
Expand Down Expand Up @@ -239,6 +243,7 @@ Methods:
- <code title="get /journeys/{templateId}">client.journeys.<a href="./src/courier/resources/journeys/journeys.py">retrieve</a>(template_id, \*\*<a href="src/courier/types/journey_retrieve_params.py">params</a>) -> <a href="./src/courier/types/journey_response.py">JourneyResponse</a></code>
- <code title="get /journeys">client.journeys.<a href="./src/courier/resources/journeys/journeys.py">list</a>(\*\*<a href="src/courier/types/journey_list_params.py">params</a>) -> <a href="./src/courier/types/journeys_list_response.py">JourneysListResponse</a></code>
- <code title="delete /journeys/{templateId}">client.journeys.<a href="./src/courier/resources/journeys/journeys.py">archive</a>(template_id) -> None</code>
- <code title="post /journeys/cancel">client.journeys.<a href="./src/courier/resources/journeys/journeys.py">cancel</a>(\*\*<a href="src/courier/types/journey_cancel_params.py">params</a>) -> <a href="./src/courier/types/cancel_journey_response.py">CancelJourneyResponse</a></code>
- <code title="post /journeys/{templateId}/invoke">client.journeys.<a href="./src/courier/resources/journeys/journeys.py">invoke</a>(template_id, \*\*<a href="src/courier/types/journey_invoke_params.py">params</a>) -> <a href="./src/courier/types/journeys_invoke_response.py">JourneysInvokeResponse</a></code>
- <code title="get /journeys/{templateId}/versions">client.journeys.<a href="./src/courier/resources/journeys/journeys.py">list_versions</a>(template_id) -> <a href="./src/courier/types/journey_versions_list_response.py">JourneyVersionsListResponse</a></code>
- <code title="post /journeys/{templateId}/publish">client.journeys.<a href="./src/courier/resources/journeys/journeys.py">publish</a>(template_id, \*\*<a href="src/courier/types/journey_publish_params.py">params</a>) -> <a href="./src/courier/types/journey_response.py">JourneyResponse</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.17.1"
version = "7.18.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.17.1" # x-release-please-version
__version__ = "7.18.0" # x-release-please-version
218 changes: 215 additions & 3 deletions src/courier/resources/journeys/journeys.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@

from __future__ import annotations

from typing import Dict, Iterable
from typing_extensions import Literal
from typing import Any, Dict, Iterable, cast
from typing_extensions import Literal, overload

import httpx

from ...types import (
JourneyState,
journey_list_params,
journey_cancel_params,
journey_create_params,
journey_invoke_params,
journey_publish_params,
journey_replace_params,
journey_retrieve_params,
)
from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given
from ..._utils import path_template, maybe_transform, async_maybe_transform
from ..._utils import path_template, required_args, maybe_transform, async_maybe_transform
from ..._compat import cached_property
from .templates import (
TemplatesResource,
Expand All @@ -39,6 +40,7 @@
from ...types.journey_response import JourneyResponse
from ...types.journey_node_param import JourneyNodeParam
from ...types.journeys_list_response import JourneysListResponse
from ...types.cancel_journey_response import CancelJourneyResponse
from ...types.journeys_invoke_response import JourneysInvokeResponse
from ...types.journey_versions_list_response import JourneyVersionsListResponse

Expand Down Expand Up @@ -247,6 +249,105 @@ def archive(
cast_to=NoneType,
)

@overload
def cancel(
self,
*,
cancelation_token: str,
# 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,
) -> CancelJourneyResponse:
"""Cancel journey runs.

The request body must contain EXACTLY ONE of
`cancelation_token` (cancels every run associated with the token) or `run_id`
(cancels a single tenant-scoped run). Supplying both or neither is a `400`. A
`run_id` that does not exist for the caller's tenant returns `404`. Cancelation
is idempotent and non-clobbering: a run that has already finished
(`PROCESSED`/`ERROR`) or was already `CANCELED` is left untouched and its
current status is echoed back.

Args:
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
"""
...

@overload
def cancel(
self,
*,
run_id: str,
# 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,
) -> CancelJourneyResponse:
"""Cancel journey runs.

The request body must contain EXACTLY ONE of
`cancelation_token` (cancels every run associated with the token) or `run_id`
(cancels a single tenant-scoped run). Supplying both or neither is a `400`. A
`run_id` that does not exist for the caller's tenant returns `404`. Cancelation
is idempotent and non-clobbering: a run that has already finished
(`PROCESSED`/`ERROR`) or was already `CANCELED` is left untouched and its
current status is echoed back.

Args:
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
"""
...

@required_args(["cancelation_token"], ["run_id"])
def cancel(
self,
*,
cancelation_token: str | Omit = omit,
run_id: 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,
) -> CancelJourneyResponse:
return cast(
CancelJourneyResponse,
self._post(
"/journeys/cancel",
body=maybe_transform(
{
"cancelation_token": cancelation_token,
"run_id": run_id,
},
journey_cancel_params.JourneyCancelParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=cast(
Any, CancelJourneyResponse
), # Union types cannot be passed in as arguments in the type system
),
)

def invoke(
self,
template_id: str,
Expand Down Expand Up @@ -635,6 +736,105 @@ async def archive(
cast_to=NoneType,
)

@overload
async def cancel(
self,
*,
cancelation_token: str,
# 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,
) -> CancelJourneyResponse:
"""Cancel journey runs.

The request body must contain EXACTLY ONE of
`cancelation_token` (cancels every run associated with the token) or `run_id`
(cancels a single tenant-scoped run). Supplying both or neither is a `400`. A
`run_id` that does not exist for the caller's tenant returns `404`. Cancelation
is idempotent and non-clobbering: a run that has already finished
(`PROCESSED`/`ERROR`) or was already `CANCELED` is left untouched and its
current status is echoed back.

Args:
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
"""
...

@overload
async def cancel(
self,
*,
run_id: str,
# 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,
) -> CancelJourneyResponse:
"""Cancel journey runs.

The request body must contain EXACTLY ONE of
`cancelation_token` (cancels every run associated with the token) or `run_id`
(cancels a single tenant-scoped run). Supplying both or neither is a `400`. A
`run_id` that does not exist for the caller's tenant returns `404`. Cancelation
is idempotent and non-clobbering: a run that has already finished
(`PROCESSED`/`ERROR`) or was already `CANCELED` is left untouched and its
current status is echoed back.

Args:
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
"""
...

@required_args(["cancelation_token"], ["run_id"])
async def cancel(
self,
*,
cancelation_token: str | Omit = omit,
run_id: 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,
) -> CancelJourneyResponse:
return cast(
CancelJourneyResponse,
await self._post(
"/journeys/cancel",
body=await async_maybe_transform(
{
"cancelation_token": cancelation_token,
"run_id": run_id,
},
journey_cancel_params.JourneyCancelParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=cast(
Any, CancelJourneyResponse
), # Union types cannot be passed in as arguments in the type system
),
)

async def invoke(
self,
template_id: str,
Expand Down Expand Up @@ -837,6 +1037,9 @@ def __init__(self, journeys: JourneysResource) -> None:
self.archive = to_raw_response_wrapper(
journeys.archive,
)
self.cancel = to_raw_response_wrapper(
journeys.cancel,
)
self.invoke = to_raw_response_wrapper(
journeys.invoke,
)
Expand Down Expand Up @@ -871,6 +1074,9 @@ def __init__(self, journeys: AsyncJourneysResource) -> None:
self.archive = async_to_raw_response_wrapper(
journeys.archive,
)
self.cancel = async_to_raw_response_wrapper(
journeys.cancel,
)
self.invoke = async_to_raw_response_wrapper(
journeys.invoke,
)
Expand Down Expand Up @@ -905,6 +1111,9 @@ def __init__(self, journeys: JourneysResource) -> None:
self.archive = to_streamed_response_wrapper(
journeys.archive,
)
self.cancel = to_streamed_response_wrapper(
journeys.cancel,
)
self.invoke = to_streamed_response_wrapper(
journeys.invoke,
)
Expand Down Expand Up @@ -939,6 +1148,9 @@ def __init__(self, journeys: AsyncJourneysResource) -> None:
self.archive = async_to_streamed_response_wrapper(
journeys.archive,
)
self.cancel = async_to_streamed_response_wrapper(
journeys.cancel,
)
self.invoke = async_to_streamed_response_wrapper(
journeys.invoke,
)
Expand Down
Loading