diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6a197be..4ce109a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.17.0" + ".": "1.18.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 2450e12..637d217 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 89 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-092c2b568690b68f1683b668b1d14db02854ef1a6e70d9f96efcd5f6e3e95ed7.yml -openapi_spec_hash: 0ddb0d27c5cb719cddddbf204394d9fa -config_hash: 658c551418df454aa40794f8ac679c18 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-1584eaacf779edacf947595928550c8914bd5f39e68c9ef7d8af8dd65e36187a.yml +openapi_spec_hash: 1e56a42e6985e71dfe1a58ff352b57cd +config_hash: 1470ae08f436e4d00dd096cb585b41fd diff --git a/CHANGELOG.md b/CHANGELOG.md index c6b2a1a..5338a76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 1.18.0 (2025-11-07) + +Full Changelog: [v1.17.0...v1.18.0](https://github.com/knocklabs/knock-python/compare/v1.17.0...v1.18.0) + +### Features + +* **api:** api update ([be33019](https://github.com/knocklabs/knock-python/commit/be33019381cfb5ee35be3960c8ea28a7078b234a)) +* **api:** support specifying a branch ([cbed5ed](https://github.com/knocklabs/knock-python/commit/cbed5ed3d3a8995d6167008addadec5e138e63e5)) +* correct channel data schemas ([fadc24d](https://github.com/knocklabs/knock-python/commit/fadc24d9363b9cf33377e696cd6863dff8e38e55)) + + +### Chores + +* **internal:** grammar fix (it's -> its) ([49b5e48](https://github.com/knocklabs/knock-python/commit/49b5e48c10abe112361fd92f4c7a74fc7543706a)) + ## 1.17.0 (2025-10-30) Full Changelog: [v1.16.0...v1.17.0](https://github.com/knocklabs/knock-python/compare/v1.16.0...v1.17.0) diff --git a/api.md b/api.md index a51230c..547f993 100644 --- a/api.md +++ b/api.md @@ -28,6 +28,7 @@ Types: from knockapi.types.recipients import ( InlinePreferenceSetRequest, PreferenceSet, + PreferenceSetChannelSetting, PreferenceSetChannelTypeSetting, PreferenceSetChannelTypes, PreferenceSetRequest, @@ -40,11 +41,16 @@ Types: ```python from knockapi.types.recipients import ( + AwsSnsPushChannelDataDevicesOnly, + AwsSnsPushChannelDataTargetArnsOnly, ChannelData, ChannelDataRequest, DiscordChannelData, InlineChannelDataRequest, MsTeamsChannelData, + OneSignalChannelDataPlayerIDsOnly, + PushChannelDataDevicesOnly, + PushChannelDataTokensOnly, SlackChannelData, ) ``` diff --git a/pyproject.toml b/pyproject.toml index 370c7e2..c9e3208 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "knockapi" -version = "1.17.0" +version = "1.18.0" description = "The official Python library for the knock API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/knockapi/_client.py b/src/knockapi/_client.py index 80c6ccc..8f49844 100644 --- a/src/knockapi/_client.py +++ b/src/knockapi/_client.py @@ -58,11 +58,13 @@ class Knock(SyncAPIClient): # client options api_key: str + branch: str | None def __init__( self, *, api_key: str | None = None, + branch: str | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, @@ -84,7 +86,9 @@ def __init__( ) -> None: """Construct a new synchronous Knock client instance. - This automatically infers the `api_key` argument from the `KNOCK_API_KEY` environment variable if it is not provided. + This automatically infers the following arguments from their corresponding environment variables if they are not provided: + - `api_key` from `KNOCK_API_KEY` + - `branch` from `KNOCK_BRANCH` """ if api_key is None: api_key = os.environ.get("KNOCK_API_KEY") @@ -94,6 +98,10 @@ def __init__( ) self.api_key = api_key + if branch is None: + branch = os.environ.get("KNOCK_BRANCH") + self.branch = branch + if base_url is None: base_url = os.environ.get("KNOCK_BASE_URL") if base_url is None: @@ -143,6 +151,7 @@ def default_headers(self) -> dict[str, str | Omit]: return { **super().default_headers, "X-Stainless-Async": "false", + "X-Knock-Branch": self.branch if self.branch is not None else Omit(), **self._custom_headers, } @@ -150,6 +159,7 @@ def copy( self, *, api_key: str | None = None, + branch: str | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.Client | None = None, @@ -184,6 +194,7 @@ def copy( http_client = http_client or self._client return self.__class__( api_key=api_key or self.api_key, + branch=branch or self.branch, base_url=base_url or self.base_url, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, @@ -248,11 +259,13 @@ class AsyncKnock(AsyncAPIClient): # client options api_key: str + branch: str | None def __init__( self, *, api_key: str | None = None, + branch: str | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, @@ -274,7 +287,9 @@ def __init__( ) -> None: """Construct a new async AsyncKnock client instance. - This automatically infers the `api_key` argument from the `KNOCK_API_KEY` environment variable if it is not provided. + This automatically infers the following arguments from their corresponding environment variables if they are not provided: + - `api_key` from `KNOCK_API_KEY` + - `branch` from `KNOCK_BRANCH` """ if api_key is None: api_key = os.environ.get("KNOCK_API_KEY") @@ -284,6 +299,10 @@ def __init__( ) self.api_key = api_key + if branch is None: + branch = os.environ.get("KNOCK_BRANCH") + self.branch = branch + if base_url is None: base_url = os.environ.get("KNOCK_BASE_URL") if base_url is None: @@ -333,6 +352,7 @@ def default_headers(self) -> dict[str, str | Omit]: return { **super().default_headers, "X-Stainless-Async": f"async:{get_async_library()}", + "X-Knock-Branch": self.branch if self.branch is not None else Omit(), **self._custom_headers, } @@ -340,6 +360,7 @@ def copy( self, *, api_key: str | None = None, + branch: str | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.AsyncClient | None = None, @@ -374,6 +395,7 @@ def copy( http_client = http_client or self._client return self.__class__( api_key=api_key or self.api_key, + branch=branch or self.branch, base_url=base_url or self.base_url, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, diff --git a/src/knockapi/_utils/_utils.py b/src/knockapi/_utils/_utils.py index 50d5926..eec7f4a 100644 --- a/src/knockapi/_utils/_utils.py +++ b/src/knockapi/_utils/_utils.py @@ -133,7 +133,7 @@ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]: # Type safe methods for narrowing types with TypeVars. # The default narrowing for isinstance(obj, dict) is dict[unknown, unknown], # however this cause Pyright to rightfully report errors. As we know we don't -# care about the contained types we can safely use `object` in it's place. +# care about the contained types we can safely use `object` in its place. # # There are two separate functions defined, `is_*` and `is_*_t` for different use cases. # `is_*` is for when you're dealing with an unknown input diff --git a/src/knockapi/_version.py b/src/knockapi/_version.py index 831e201..dbf248b 100644 --- a/src/knockapi/_version.py +++ b/src/knockapi/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "knockapi" -__version__ = "1.17.0" # x-release-please-version +__version__ = "1.18.0" # x-release-please-version diff --git a/src/knockapi/resources/objects/objects.py b/src/knockapi/resources/objects/objects.py index c73176c..598326a 100644 --- a/src/knockapi/resources/objects/objects.py +++ b/src/knockapi/resources/objects/objects.py @@ -710,6 +710,7 @@ def set( *, channel_data: InlineChannelDataRequestParam | Omit = omit, locale: Optional[str] | Omit = omit, + name: Optional[str] | Omit = omit, preferences: InlinePreferenceSetRequestParam | Omit = omit, timezone: Optional[str] | Omit = omit, # 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( locale: The locale of the object. Used for [message localization](/concepts/translations). + name: An optional name for the object. + preferences: Inline set preferences for a recipient, where the key is the preference set id. Preferences that are set inline will be merged into any existing preferences rather than replacing them. @@ -760,6 +763,7 @@ def set( { "channel_data": channel_data, "locale": locale, + "name": name, "preferences": preferences, "timezone": timezone, }, @@ -1617,6 +1621,7 @@ async def set( *, channel_data: InlineChannelDataRequestParam | Omit = omit, locale: Optional[str] | Omit = omit, + name: Optional[str] | Omit = omit, preferences: InlinePreferenceSetRequestParam | Omit = omit, timezone: Optional[str] | Omit = omit, # 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( locale: The locale of the object. Used for [message localization](/concepts/translations). + name: An optional name for the object. + preferences: Inline set preferences for a recipient, where the key is the preference set id. Preferences that are set inline will be merged into any existing preferences rather than replacing them. @@ -1667,6 +1674,7 @@ async def set( { "channel_data": channel_data, "locale": locale, + "name": name, "preferences": preferences, "timezone": timezone, }, diff --git a/src/knockapi/resources/tenants/tenants.py b/src/knockapi/resources/tenants/tenants.py index a8cac0c..2692a9b 100644 --- a/src/knockapi/resources/tenants/tenants.py +++ b/src/knockapi/resources/tenants/tenants.py @@ -196,6 +196,7 @@ def set( id: str, *, channel_data: Optional[InlineChannelDataRequestParam] | Omit = omit, + name: Optional[str] | Omit = omit, settings: tenant_set_params.Settings | 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. @@ -213,6 +214,8 @@ def set( Args: channel_data: A request to set channel data for a type of channel inline. + name: An optional name for the tenant. + settings: The settings for the tenant. Includes branding and preference set. extra_headers: Send extra headers @@ -232,6 +235,7 @@ def set( body=maybe_transform( { "channel_data": channel_data, + "name": name, "settings": settings, }, tenant_set_params.TenantSetParams, @@ -410,6 +414,7 @@ async def set( id: str, *, channel_data: Optional[InlineChannelDataRequestParam] | Omit = omit, + name: Optional[str] | Omit = omit, settings: tenant_set_params.Settings | 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. @@ -427,6 +432,8 @@ async def set( Args: channel_data: A request to set channel data for a type of channel inline. + name: An optional name for the tenant. + settings: The settings for the tenant. Includes branding and preference set. extra_headers: Send extra headers @@ -446,6 +453,7 @@ async def set( body=await async_maybe_transform( { "channel_data": channel_data, + "name": name, "settings": settings, }, tenant_set_params.TenantSetParams, diff --git a/src/knockapi/resources/users/feeds.py b/src/knockapi/resources/users/feeds.py index 6795c7d..2014f7f 100644 --- a/src/knockapi/resources/users/feeds.py +++ b/src/knockapi/resources/users/feeds.py @@ -90,6 +90,7 @@ def list_items( archived: Literal["exclude", "include", "only"] | Omit = omit, before: str | Omit = omit, has_tenant: bool | Omit = omit, + locale: str | Omit = omit, page_size: int | Omit = omit, source: str | Omit = omit, status: Literal["unread", "read", "unseen", "seen", "all"] | Omit = omit, @@ -128,6 +129,11 @@ def list_items( has_tenant: Whether the feed items have a tenant. + locale: The locale to render the feed items in. Must be in the IETF 5646 format (e.g. + `en-US`). When not provided, will default to the locale that the feed items were + rendered in. Only available for enterprise plan customers using custom + translations. + page_size: The number of items per page (defaults to 50). source: The workflow key associated with the message in the feed. @@ -166,6 +172,7 @@ def list_items( "archived": archived, "before": before, "has_tenant": has_tenant, + "locale": locale, "page_size": page_size, "source": source, "status": status, @@ -245,6 +252,7 @@ def list_items( archived: Literal["exclude", "include", "only"] | Omit = omit, before: str | Omit = omit, has_tenant: bool | Omit = omit, + locale: str | Omit = omit, page_size: int | Omit = omit, source: str | Omit = omit, status: Literal["unread", "read", "unseen", "seen", "all"] | Omit = omit, @@ -283,6 +291,11 @@ def list_items( has_tenant: Whether the feed items have a tenant. + locale: The locale to render the feed items in. Must be in the IETF 5646 format (e.g. + `en-US`). When not provided, will default to the locale that the feed items were + rendered in. Only available for enterprise plan customers using custom + translations. + page_size: The number of items per page (defaults to 50). source: The workflow key associated with the message in the feed. @@ -321,6 +334,7 @@ def list_items( "archived": archived, "before": before, "has_tenant": has_tenant, + "locale": locale, "page_size": page_size, "source": source, "status": status, diff --git a/src/knockapi/types/inline_object_request_param.py b/src/knockapi/types/inline_object_request_param.py index c2cec19..59e4d59 100644 --- a/src/knockapi/types/inline_object_request_param.py +++ b/src/knockapi/types/inline_object_request_param.py @@ -26,6 +26,9 @@ class InlineObjectRequestParamTyped(TypedDict, total=False): created_at: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] """Timestamp when the resource was created.""" + name: Optional[str] + """An optional name for the object.""" + preferences: Optional[InlinePreferenceSetRequestParam] """Inline set preferences for a recipient, where the key is the preference set id. diff --git a/src/knockapi/types/object_set_channel_data_params.py b/src/knockapi/types/object_set_channel_data_params.py index e5fb665..c9902db 100644 --- a/src/knockapi/types/object_set_channel_data_params.py +++ b/src/knockapi/types/object_set_channel_data_params.py @@ -2,25 +2,19 @@ from __future__ import annotations -from typing import Union, Iterable, Optional +from typing import Union from typing_extensions import Required, TypeAlias, TypedDict -from .._types import SequenceNotStr from .recipients.slack_channel_data_param import SlackChannelDataParam from .recipients.discord_channel_data_param import DiscordChannelDataParam from .recipients.ms_teams_channel_data_param import MsTeamsChannelDataParam +from .recipients.push_channel_data_tokens_only_param import PushChannelDataTokensOnlyParam +from .recipients.push_channel_data_devices_only_param import PushChannelDataDevicesOnlyParam +from .recipients.aws_sns_push_channel_data_devices_only_param import AwsSnsPushChannelDataDevicesOnlyParam +from .recipients.one_signal_channel_data_player_ids_only_param import OneSignalChannelDataPlayerIDsOnlyParam +from .recipients.aws_sns_push_channel_data_target_arns_only_param import AwsSnsPushChannelDataTargetArnsOnlyParam -__all__ = [ - "ObjectSetChannelDataParams", - "Data", - "DataPushChannelDataTokensOnly", - "DataPushChannelDataDevicesOnly", - "DataPushChannelDataDevicesOnlyDevice", - "DataAwssnsPushChannelDataTargetArNsOnly", - "DataAwssnsPushChannelDataDevicesOnly", - "DataAwssnsPushChannelDataDevicesOnlyDevice", - "DataOneSignalChannelDataPlayerIDsOnly", -] +__all__ = ["ObjectSetChannelDataParams", "Data"] class ObjectSetChannelDataParams(TypedDict, total=False): @@ -28,91 +22,12 @@ class ObjectSetChannelDataParams(TypedDict, total=False): """Channel data for a given channel type.""" -class DataPushChannelDataTokensOnly(TypedDict, total=False): - tokens: Required[SequenceNotStr[str]] - """A list of push channel tokens.""" - - -class DataPushChannelDataDevicesOnlyDevice(TypedDict, total=False): - token: Required[str] - """The device token to send the push notification to.""" - - locale: Optional[str] - """The locale of the object. - - Used for [message localization](/concepts/translations). - """ - - timezone: Optional[str] - """The timezone of the object. - - Must be a - valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). - Used - for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients). - """ - - -class DataPushChannelDataDevicesOnly(TypedDict, total=False): - devices: Required[Iterable[DataPushChannelDataDevicesOnlyDevice]] - """A list of devices. - - Each device contains a token, and optionally a locale and timezone. - """ - - -class DataAwssnsPushChannelDataTargetArNsOnly(TypedDict, total=False): - target_arns: Required[SequenceNotStr[str]] - """A list of platform endpoint ARNs. - - See - [Setting up an Amazon SNS platform endpoint for mobile notifications](https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html). - """ - - -class DataAwssnsPushChannelDataDevicesOnlyDevice(TypedDict, total=False): - target_arn: Required[str] - """ - The ARN of a platform endpoint associated with a platform application and a - device token. See - [Setting up an Amazon SNS platform endpoint for mobile notifications](https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html). - """ - - locale: Optional[str] - """The locale of the object. - - Used for [message localization](/concepts/translations). - """ - - timezone: Optional[str] - """The timezone of the object. - - Must be a - valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). - Used - for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients). - """ - - -class DataAwssnsPushChannelDataDevicesOnly(TypedDict, total=False): - devices: Required[Iterable[DataAwssnsPushChannelDataDevicesOnlyDevice]] - """A list of devices. - - Each device contains a target_arn, and optionally a locale and timezone. - """ - - -class DataOneSignalChannelDataPlayerIDsOnly(TypedDict, total=False): - player_ids: Required[SequenceNotStr[str]] - """A list of OneSignal player IDs.""" - - Data: TypeAlias = Union[ - DataPushChannelDataTokensOnly, - DataPushChannelDataDevicesOnly, - DataAwssnsPushChannelDataTargetArNsOnly, - DataAwssnsPushChannelDataDevicesOnly, - DataOneSignalChannelDataPlayerIDsOnly, + PushChannelDataTokensOnlyParam, + PushChannelDataDevicesOnlyParam, + AwsSnsPushChannelDataTargetArnsOnlyParam, + AwsSnsPushChannelDataDevicesOnlyParam, + OneSignalChannelDataPlayerIDsOnlyParam, SlackChannelDataParam, MsTeamsChannelDataParam, DiscordChannelDataParam, diff --git a/src/knockapi/types/object_set_params.py b/src/knockapi/types/object_set_params.py index 1776fcf..d443fa7 100644 --- a/src/knockapi/types/object_set_params.py +++ b/src/knockapi/types/object_set_params.py @@ -21,6 +21,9 @@ class ObjectSetParams(TypedDict, total=False): Used for [message localization](/concepts/translations). """ + name: Optional[str] + """An optional name for the object.""" + preferences: InlinePreferenceSetRequestParam """Inline set preferences for a recipient, where the key is the preference set id. diff --git a/src/knockapi/types/object_set_preferences_params.py b/src/knockapi/types/object_set_preferences_params.py index 99093b6..ce0037b 100644 --- a/src/knockapi/types/object_set_preferences_params.py +++ b/src/knockapi/types/object_set_preferences_params.py @@ -3,24 +3,22 @@ from __future__ import annotations from typing import Dict, Union, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing_extensions import Literal, Annotated, TypeAlias, TypedDict from .._utils import PropertyInfo from .shared_params.condition import Condition from .recipients.preference_set_channel_types_param import PreferenceSetChannelTypesParam +from .recipients.preference_set_channel_setting_param import PreferenceSetChannelSettingParam __all__ = [ "ObjectSetPreferencesParams", "Categories", "CategoriesPreferenceSetWorkflowCategorySettingObject", "CategoriesPreferenceSetWorkflowCategorySettingObjectChannels", - "CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting", "Channels", - "ChannelsPreferenceSetChannelSetting", "Workflows", "WorkflowsPreferenceSetWorkflowCategorySettingObject", "WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels", - "WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting", ] @@ -57,14 +55,7 @@ class ObjectSetPreferencesParams(TypedDict, total=False): """ -class CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting(TypedDict, total=False): - conditions: Required[Iterable[Condition]] - """A list of conditions to apply to a specific channel.""" - - -CategoriesPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[ - bool, CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting -] +CategoriesPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[bool, PreferenceSetChannelSettingParam] class CategoriesPreferenceSetWorkflowCategorySettingObject(TypedDict, total=False): @@ -80,23 +71,9 @@ class CategoriesPreferenceSetWorkflowCategorySettingObject(TypedDict, total=Fals Categories: TypeAlias = Union[bool, CategoriesPreferenceSetWorkflowCategorySettingObject] +Channels: TypeAlias = Union[bool, PreferenceSetChannelSettingParam] -class ChannelsPreferenceSetChannelSetting(TypedDict, total=False): - conditions: Required[Iterable[Condition]] - """A list of conditions to apply to a specific channel.""" - - -Channels: TypeAlias = Union[bool, ChannelsPreferenceSetChannelSetting] - - -class WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting(TypedDict, total=False): - conditions: Required[Iterable[Condition]] - """A list of conditions to apply to a specific channel.""" - - -WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[ - bool, WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting -] +WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[bool, PreferenceSetChannelSettingParam] class WorkflowsPreferenceSetWorkflowCategorySettingObject(TypedDict, total=False): diff --git a/src/knockapi/types/objects/bulk_set_params.py b/src/knockapi/types/objects/bulk_set_params.py index 4a9cb89..cebd5f8 100644 --- a/src/knockapi/types/objects/bulk_set_params.py +++ b/src/knockapi/types/objects/bulk_set_params.py @@ -28,6 +28,9 @@ class ObjectTyped(TypedDict, total=False): created_at: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] """Timestamp when the resource was created.""" + name: Optional[str] + """An optional name for the object.""" + preferences: Optional[InlinePreferenceSetRequestParam] """Inline set preferences for a recipient, where the key is the preference set id. diff --git a/src/knockapi/types/recipients/__init__.py b/src/knockapi/types/recipients/__init__.py index 8a882bc..646f94b 100644 --- a/src/knockapi/types/recipients/__init__.py +++ b/src/knockapi/types/recipients/__init__.py @@ -13,10 +13,26 @@ from .ms_teams_channel_data_param import MsTeamsChannelDataParam as MsTeamsChannelDataParam from .preference_set_channel_types import PreferenceSetChannelTypes as PreferenceSetChannelTypes from .preference_set_request_param import PreferenceSetRequestParam as PreferenceSetRequestParam +from .preference_set_channel_setting import PreferenceSetChannelSetting as PreferenceSetChannelSetting from .inline_channel_data_request_param import InlineChannelDataRequestParam as InlineChannelDataRequestParam from .preference_set_channel_types_param import PreferenceSetChannelTypesParam as PreferenceSetChannelTypesParam from .inline_preference_set_request_param import InlinePreferenceSetRequestParam as InlinePreferenceSetRequestParam from .preference_set_channel_type_setting import PreferenceSetChannelTypeSetting as PreferenceSetChannelTypeSetting +from .push_channel_data_tokens_only_param import PushChannelDataTokensOnlyParam as PushChannelDataTokensOnlyParam +from .preference_set_channel_setting_param import PreferenceSetChannelSettingParam as PreferenceSetChannelSettingParam +from .push_channel_data_devices_only_param import PushChannelDataDevicesOnlyParam as PushChannelDataDevicesOnlyParam +from .one_signal_channel_data_player_ids_only import ( + OneSignalChannelDataPlayerIDsOnly as OneSignalChannelDataPlayerIDsOnly, +) from .preference_set_channel_type_setting_param import ( PreferenceSetChannelTypeSettingParam as PreferenceSetChannelTypeSettingParam, ) +from .aws_sns_push_channel_data_devices_only_param import ( + AwsSnsPushChannelDataDevicesOnlyParam as AwsSnsPushChannelDataDevicesOnlyParam, +) +from .one_signal_channel_data_player_ids_only_param import ( + OneSignalChannelDataPlayerIDsOnlyParam as OneSignalChannelDataPlayerIDsOnlyParam, +) +from .aws_sns_push_channel_data_target_arns_only_param import ( + AwsSnsPushChannelDataTargetArnsOnlyParam as AwsSnsPushChannelDataTargetArnsOnlyParam, +) diff --git a/src/knockapi/types/recipients/aws_sns_push_channel_data_devices_only_param.py b/src/knockapi/types/recipients/aws_sns_push_channel_data_devices_only_param.py new file mode 100644 index 0000000..cdeb803 --- /dev/null +++ b/src/knockapi/types/recipients/aws_sns_push_channel_data_devices_only_param.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["AwsSnsPushChannelDataDevicesOnlyParam", "Device"] + + +class Device(TypedDict, total=False): + target_arn: Required[str] + """ + The ARN of a platform endpoint associated with a platform application and a + device token. See + [Setting up an Amazon SNS platform endpoint for mobile notifications](https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html). + """ + + locale: Optional[str] + """The locale of the object. + + Used for [message localization](/concepts/translations). + """ + + timezone: Optional[str] + """The timezone of the object. + + Must be a + valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). + Used + for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients). + """ + + +class AwsSnsPushChannelDataDevicesOnlyParam(TypedDict, total=False): + devices: Required[Iterable[Device]] + """A list of devices. + + Each device contains a target_arn, and optionally a locale and timezone. + """ diff --git a/src/knockapi/types/recipients/aws_sns_push_channel_data_target_arns_only_param.py b/src/knockapi/types/recipients/aws_sns_push_channel_data_target_arns_only_param.py new file mode 100644 index 0000000..53f9172 --- /dev/null +++ b/src/knockapi/types/recipients/aws_sns_push_channel_data_target_arns_only_param.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["AwsSnsPushChannelDataTargetArnsOnlyParam"] + + +class AwsSnsPushChannelDataTargetArnsOnlyParam(TypedDict, total=False): + target_arns: Required[SequenceNotStr[str]] + """A list of platform endpoint ARNs. + + See + [Setting up an Amazon SNS platform endpoint for mobile notifications](https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html). + """ diff --git a/src/knockapi/types/recipients/channel_data.py b/src/knockapi/types/recipients/channel_data.py index de7c33d..b9b9a37 100644 --- a/src/knockapi/types/recipients/channel_data.py +++ b/src/knockapi/types/recipients/channel_data.py @@ -9,6 +9,7 @@ from .slack_channel_data import SlackChannelData from .discord_channel_data import DiscordChannelData from .ms_teams_channel_data import MsTeamsChannelData +from .one_signal_channel_data_player_ids_only import OneSignalChannelDataPlayerIDsOnly __all__ = [ "ChannelData", @@ -17,7 +18,6 @@ "DataPushChannelDataFullDevice", "DataAwssnsPushChannelDataFull", "DataAwssnsPushChannelDataFullDevice", - "DataOneSignalChannelDataPlayerIDsOnly", ] @@ -91,15 +91,10 @@ class DataAwssnsPushChannelDataFull(BaseModel): """ -class DataOneSignalChannelDataPlayerIDsOnly(BaseModel): - player_ids: List[str] - """A list of OneSignal player IDs.""" - - Data: TypeAlias = Union[ DataPushChannelDataFull, DataAwssnsPushChannelDataFull, - DataOneSignalChannelDataPlayerIDsOnly, + OneSignalChannelDataPlayerIDsOnly, SlackChannelData, MsTeamsChannelData, DiscordChannelData, diff --git a/src/knockapi/types/recipients/inline_channel_data_request_param.py b/src/knockapi/types/recipients/inline_channel_data_request_param.py index 86d4755..1f1e7ee 100644 --- a/src/knockapi/types/recipients/inline_channel_data_request_param.py +++ b/src/knockapi/types/recipients/inline_channel_data_request_param.py @@ -2,112 +2,26 @@ from __future__ import annotations -from typing import Dict, Union, Iterable, Optional -from typing_extensions import Required, TypeAlias, TypedDict +from typing import Dict, Union +from typing_extensions import TypeAlias -from ..._types import SequenceNotStr from .slack_channel_data_param import SlackChannelDataParam from .discord_channel_data_param import DiscordChannelDataParam from .ms_teams_channel_data_param import MsTeamsChannelDataParam +from .push_channel_data_tokens_only_param import PushChannelDataTokensOnlyParam +from .push_channel_data_devices_only_param import PushChannelDataDevicesOnlyParam +from .aws_sns_push_channel_data_devices_only_param import AwsSnsPushChannelDataDevicesOnlyParam +from .one_signal_channel_data_player_ids_only_param import OneSignalChannelDataPlayerIDsOnlyParam +from .aws_sns_push_channel_data_target_arns_only_param import AwsSnsPushChannelDataTargetArnsOnlyParam -__all__ = [ - "InlineChannelDataRequestParam", - "InlineChannelDataRequestParamItem", - "InlineChannelDataRequestParamItemPushChannelDataTokensOnly", - "InlineChannelDataRequestParamItemPushChannelDataDevicesOnly", - "InlineChannelDataRequestParamItemPushChannelDataDevicesOnlyDevice", - "InlineChannelDataRequestParamItemAwssnsPushChannelDataTargetArNsOnly", - "InlineChannelDataRequestParamItemAwssnsPushChannelDataDevicesOnly", - "InlineChannelDataRequestParamItemAwssnsPushChannelDataDevicesOnlyDevice", - "InlineChannelDataRequestParamItemOneSignalChannelDataPlayerIDsOnly", -] - - -class InlineChannelDataRequestParamItemPushChannelDataTokensOnly(TypedDict, total=False): - tokens: Required[SequenceNotStr[str]] - """A list of push channel tokens.""" - - -class InlineChannelDataRequestParamItemPushChannelDataDevicesOnlyDevice(TypedDict, total=False): - token: Required[str] - """The device token to send the push notification to.""" - - locale: Optional[str] - """The locale of the object. - - Used for [message localization](/concepts/translations). - """ - - timezone: Optional[str] - """The timezone of the object. - - Must be a - valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). - Used - for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients). - """ - - -class InlineChannelDataRequestParamItemPushChannelDataDevicesOnly(TypedDict, total=False): - devices: Required[Iterable[InlineChannelDataRequestParamItemPushChannelDataDevicesOnlyDevice]] - """A list of devices. - - Each device contains a token, and optionally a locale and timezone. - """ - - -class InlineChannelDataRequestParamItemAwssnsPushChannelDataTargetArNsOnly(TypedDict, total=False): - target_arns: Required[SequenceNotStr[str]] - """A list of platform endpoint ARNs. - - See - [Setting up an Amazon SNS platform endpoint for mobile notifications](https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html). - """ - - -class InlineChannelDataRequestParamItemAwssnsPushChannelDataDevicesOnlyDevice(TypedDict, total=False): - target_arn: Required[str] - """ - The ARN of a platform endpoint associated with a platform application and a - device token. See - [Setting up an Amazon SNS platform endpoint for mobile notifications](https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html). - """ - - locale: Optional[str] - """The locale of the object. - - Used for [message localization](/concepts/translations). - """ - - timezone: Optional[str] - """The timezone of the object. - - Must be a - valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). - Used - for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients). - """ - - -class InlineChannelDataRequestParamItemAwssnsPushChannelDataDevicesOnly(TypedDict, total=False): - devices: Required[Iterable[InlineChannelDataRequestParamItemAwssnsPushChannelDataDevicesOnlyDevice]] - """A list of devices. - - Each device contains a target_arn, and optionally a locale and timezone. - """ - - -class InlineChannelDataRequestParamItemOneSignalChannelDataPlayerIDsOnly(TypedDict, total=False): - player_ids: Required[SequenceNotStr[str]] - """A list of OneSignal player IDs.""" - +__all__ = ["InlineChannelDataRequestParam", "InlineChannelDataRequestParamItem"] InlineChannelDataRequestParamItem: TypeAlias = Union[ - InlineChannelDataRequestParamItemPushChannelDataTokensOnly, - InlineChannelDataRequestParamItemPushChannelDataDevicesOnly, - InlineChannelDataRequestParamItemAwssnsPushChannelDataTargetArNsOnly, - InlineChannelDataRequestParamItemAwssnsPushChannelDataDevicesOnly, - InlineChannelDataRequestParamItemOneSignalChannelDataPlayerIDsOnly, + PushChannelDataTokensOnlyParam, + PushChannelDataDevicesOnlyParam, + AwsSnsPushChannelDataTargetArnsOnlyParam, + AwsSnsPushChannelDataDevicesOnlyParam, + OneSignalChannelDataPlayerIDsOnlyParam, SlackChannelDataParam, MsTeamsChannelDataParam, DiscordChannelDataParam, diff --git a/src/knockapi/types/recipients/one_signal_channel_data_player_ids_only.py b/src/knockapi/types/recipients/one_signal_channel_data_player_ids_only.py new file mode 100644 index 0000000..e683ff4 --- /dev/null +++ b/src/knockapi/types/recipients/one_signal_channel_data_player_ids_only.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel + +__all__ = ["OneSignalChannelDataPlayerIDsOnly"] + + +class OneSignalChannelDataPlayerIDsOnly(BaseModel): + player_ids: List[str] + """A list of OneSignal player IDs.""" diff --git a/src/knockapi/types/recipients/one_signal_channel_data_player_ids_only_param.py b/src/knockapi/types/recipients/one_signal_channel_data_player_ids_only_param.py new file mode 100644 index 0000000..bcc1bfd --- /dev/null +++ b/src/knockapi/types/recipients/one_signal_channel_data_player_ids_only_param.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["OneSignalChannelDataPlayerIDsOnlyParam"] + + +class OneSignalChannelDataPlayerIDsOnlyParam(TypedDict, total=False): + player_ids: Required[SequenceNotStr[str]] + """A list of OneSignal player IDs.""" diff --git a/src/knockapi/types/recipients/preference_set.py b/src/knockapi/types/recipients/preference_set.py index 7878b7a..b690579 100644 --- a/src/knockapi/types/recipients/preference_set.py +++ b/src/knockapi/types/recipients/preference_set.py @@ -6,30 +6,20 @@ from ..._models import BaseModel from ..shared.condition import Condition from .preference_set_channel_types import PreferenceSetChannelTypes +from .preference_set_channel_setting import PreferenceSetChannelSetting __all__ = [ "PreferenceSet", "Categories", "CategoriesPreferenceSetWorkflowCategorySettingObject", "CategoriesPreferenceSetWorkflowCategorySettingObjectChannels", - "CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting", "Channels", - "ChannelsPreferenceSetChannelSetting", "Workflows", "WorkflowsPreferenceSetWorkflowCategorySettingObject", "WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels", - "WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting", ] - -class CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting(BaseModel): - conditions: List[Condition] - """A list of conditions to apply to a specific channel.""" - - -CategoriesPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[ - bool, CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting -] +CategoriesPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[bool, PreferenceSetChannelSetting] class CategoriesPreferenceSetWorkflowCategorySettingObject(BaseModel): @@ -45,23 +35,9 @@ class CategoriesPreferenceSetWorkflowCategorySettingObject(BaseModel): Categories: TypeAlias = Union[bool, CategoriesPreferenceSetWorkflowCategorySettingObject] +Channels: TypeAlias = Union[bool, PreferenceSetChannelSetting] -class ChannelsPreferenceSetChannelSetting(BaseModel): - conditions: List[Condition] - """A list of conditions to apply to a specific channel.""" - - -Channels: TypeAlias = Union[bool, ChannelsPreferenceSetChannelSetting] - - -class WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting(BaseModel): - conditions: List[Condition] - """A list of conditions to apply to a specific channel.""" - - -WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[ - bool, WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting -] +WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[bool, PreferenceSetChannelSetting] class WorkflowsPreferenceSetWorkflowCategorySettingObject(BaseModel): diff --git a/src/knockapi/types/recipients/preference_set_channel_setting.py b/src/knockapi/types/recipients/preference_set_channel_setting.py new file mode 100644 index 0000000..33388b7 --- /dev/null +++ b/src/knockapi/types/recipients/preference_set_channel_setting.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from ..._models import BaseModel +from ..shared.condition import Condition + +__all__ = ["PreferenceSetChannelSetting"] + + +class PreferenceSetChannelSetting(BaseModel): + conditions: List[Condition] + """A list of conditions to apply to a specific channel.""" diff --git a/src/knockapi/types/recipients/preference_set_channel_setting_param.py b/src/knockapi/types/recipients/preference_set_channel_setting_param.py new file mode 100644 index 0000000..660d701 --- /dev/null +++ b/src/knockapi/types/recipients/preference_set_channel_setting_param.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Required, TypedDict + +from ..shared_params.condition import Condition + +__all__ = ["PreferenceSetChannelSettingParam"] + + +class PreferenceSetChannelSettingParam(TypedDict, total=False): + conditions: Required[Iterable[Condition]] + """A list of conditions to apply to a specific channel.""" diff --git a/src/knockapi/types/recipients/preference_set_request_param.py b/src/knockapi/types/recipients/preference_set_request_param.py index 2a38e08..268d264 100644 --- a/src/knockapi/types/recipients/preference_set_request_param.py +++ b/src/knockapi/types/recipients/preference_set_request_param.py @@ -3,35 +3,25 @@ from __future__ import annotations from typing import Dict, Union, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing_extensions import Literal, Annotated, TypeAlias, TypedDict from ..._utils import PropertyInfo from ..shared_params.condition import Condition from .preference_set_channel_types_param import PreferenceSetChannelTypesParam +from .preference_set_channel_setting_param import PreferenceSetChannelSettingParam __all__ = [ "PreferenceSetRequestParam", "Categories", "CategoriesPreferenceSetWorkflowCategorySettingObject", "CategoriesPreferenceSetWorkflowCategorySettingObjectChannels", - "CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting", "Channels", - "ChannelsPreferenceSetChannelSetting", "Workflows", "WorkflowsPreferenceSetWorkflowCategorySettingObject", "WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels", - "WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting", ] - -class CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting(TypedDict, total=False): - conditions: Required[Iterable[Condition]] - """A list of conditions to apply to a specific channel.""" - - -CategoriesPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[ - bool, CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting -] +CategoriesPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[bool, PreferenceSetChannelSettingParam] class CategoriesPreferenceSetWorkflowCategorySettingObject(TypedDict, total=False): @@ -47,23 +37,9 @@ class CategoriesPreferenceSetWorkflowCategorySettingObject(TypedDict, total=Fals Categories: TypeAlias = Union[bool, CategoriesPreferenceSetWorkflowCategorySettingObject] +Channels: TypeAlias = Union[bool, PreferenceSetChannelSettingParam] -class ChannelsPreferenceSetChannelSetting(TypedDict, total=False): - conditions: Required[Iterable[Condition]] - """A list of conditions to apply to a specific channel.""" - - -Channels: TypeAlias = Union[bool, ChannelsPreferenceSetChannelSetting] - - -class WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting(TypedDict, total=False): - conditions: Required[Iterable[Condition]] - """A list of conditions to apply to a specific channel.""" - - -WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[ - bool, WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting -] +WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[bool, PreferenceSetChannelSettingParam] class WorkflowsPreferenceSetWorkflowCategorySettingObject(TypedDict, total=False): diff --git a/src/knockapi/types/recipients/push_channel_data_devices_only_param.py b/src/knockapi/types/recipients/push_channel_data_devices_only_param.py new file mode 100644 index 0000000..f183ff6 --- /dev/null +++ b/src/knockapi/types/recipients/push_channel_data_devices_only_param.py @@ -0,0 +1,36 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["PushChannelDataDevicesOnlyParam", "Device"] + + +class Device(TypedDict, total=False): + token: Required[str] + """The device token to send the push notification to.""" + + locale: Optional[str] + """The locale of the object. + + Used for [message localization](/concepts/translations). + """ + + timezone: Optional[str] + """The timezone of the object. + + Must be a + valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). + Used + for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients). + """ + + +class PushChannelDataDevicesOnlyParam(TypedDict, total=False): + devices: Required[Iterable[Device]] + """A list of devices. + + Each device contains a token, and optionally a locale and timezone. + """ diff --git a/src/knockapi/types/recipients/push_channel_data_tokens_only_param.py b/src/knockapi/types/recipients/push_channel_data_tokens_only_param.py new file mode 100644 index 0000000..77960f1 --- /dev/null +++ b/src/knockapi/types/recipients/push_channel_data_tokens_only_param.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +from ..._types import SequenceNotStr + +__all__ = ["PushChannelDataTokensOnlyParam"] + + +class PushChannelDataTokensOnlyParam(TypedDict, total=False): + tokens: Required[SequenceNotStr[str]] + """A list of push channel tokens.""" diff --git a/src/knockapi/types/tenant_request_param.py b/src/knockapi/types/tenant_request_param.py index dff6681..a9c7fb2 100644 --- a/src/knockapi/types/tenant_request_param.py +++ b/src/knockapi/types/tenant_request_param.py @@ -47,6 +47,9 @@ class TenantRequestParamTyped(TypedDict, total=False): channel_data: Optional[InlineChannelDataRequestParam] """A request to set channel data for a type of channel inline.""" + name: Optional[str] + """An optional name for the tenant.""" + preferences: Optional[InlinePreferenceSetRequestParam] """Inline set preferences for a recipient, where the key is the preference set id. diff --git a/src/knockapi/types/tenant_set_params.py b/src/knockapi/types/tenant_set_params.py index 91d4414..e2a9b11 100644 --- a/src/knockapi/types/tenant_set_params.py +++ b/src/knockapi/types/tenant_set_params.py @@ -15,6 +15,9 @@ class TenantSetParams(TypedDict, total=False): channel_data: Optional[InlineChannelDataRequestParam] """A request to set channel data for a type of channel inline.""" + name: Optional[str] + """An optional name for the tenant.""" + settings: Settings """The settings for the tenant. Includes branding and preference set.""" diff --git a/src/knockapi/types/user_set_channel_data_params.py b/src/knockapi/types/user_set_channel_data_params.py index a9c1f03..c5ff002 100644 --- a/src/knockapi/types/user_set_channel_data_params.py +++ b/src/knockapi/types/user_set_channel_data_params.py @@ -2,25 +2,19 @@ from __future__ import annotations -from typing import Union, Iterable, Optional +from typing import Union from typing_extensions import Required, TypeAlias, TypedDict -from .._types import SequenceNotStr from .recipients.slack_channel_data_param import SlackChannelDataParam from .recipients.discord_channel_data_param import DiscordChannelDataParam from .recipients.ms_teams_channel_data_param import MsTeamsChannelDataParam +from .recipients.push_channel_data_tokens_only_param import PushChannelDataTokensOnlyParam +from .recipients.push_channel_data_devices_only_param import PushChannelDataDevicesOnlyParam +from .recipients.aws_sns_push_channel_data_devices_only_param import AwsSnsPushChannelDataDevicesOnlyParam +from .recipients.one_signal_channel_data_player_ids_only_param import OneSignalChannelDataPlayerIDsOnlyParam +from .recipients.aws_sns_push_channel_data_target_arns_only_param import AwsSnsPushChannelDataTargetArnsOnlyParam -__all__ = [ - "UserSetChannelDataParams", - "Data", - "DataPushChannelDataTokensOnly", - "DataPushChannelDataDevicesOnly", - "DataPushChannelDataDevicesOnlyDevice", - "DataAwssnsPushChannelDataTargetArNsOnly", - "DataAwssnsPushChannelDataDevicesOnly", - "DataAwssnsPushChannelDataDevicesOnlyDevice", - "DataOneSignalChannelDataPlayerIDsOnly", -] +__all__ = ["UserSetChannelDataParams", "Data"] class UserSetChannelDataParams(TypedDict, total=False): @@ -28,91 +22,12 @@ class UserSetChannelDataParams(TypedDict, total=False): """Channel data for a given channel type.""" -class DataPushChannelDataTokensOnly(TypedDict, total=False): - tokens: Required[SequenceNotStr[str]] - """A list of push channel tokens.""" - - -class DataPushChannelDataDevicesOnlyDevice(TypedDict, total=False): - token: Required[str] - """The device token to send the push notification to.""" - - locale: Optional[str] - """The locale of the object. - - Used for [message localization](/concepts/translations). - """ - - timezone: Optional[str] - """The timezone of the object. - - Must be a - valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). - Used - for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients). - """ - - -class DataPushChannelDataDevicesOnly(TypedDict, total=False): - devices: Required[Iterable[DataPushChannelDataDevicesOnlyDevice]] - """A list of devices. - - Each device contains a token, and optionally a locale and timezone. - """ - - -class DataAwssnsPushChannelDataTargetArNsOnly(TypedDict, total=False): - target_arns: Required[SequenceNotStr[str]] - """A list of platform endpoint ARNs. - - See - [Setting up an Amazon SNS platform endpoint for mobile notifications](https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html). - """ - - -class DataAwssnsPushChannelDataDevicesOnlyDevice(TypedDict, total=False): - target_arn: Required[str] - """ - The ARN of a platform endpoint associated with a platform application and a - device token. See - [Setting up an Amazon SNS platform endpoint for mobile notifications](https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html). - """ - - locale: Optional[str] - """The locale of the object. - - Used for [message localization](/concepts/translations). - """ - - timezone: Optional[str] - """The timezone of the object. - - Must be a - valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). - Used - for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients). - """ - - -class DataAwssnsPushChannelDataDevicesOnly(TypedDict, total=False): - devices: Required[Iterable[DataAwssnsPushChannelDataDevicesOnlyDevice]] - """A list of devices. - - Each device contains a target_arn, and optionally a locale and timezone. - """ - - -class DataOneSignalChannelDataPlayerIDsOnly(TypedDict, total=False): - player_ids: Required[SequenceNotStr[str]] - """A list of OneSignal player IDs.""" - - Data: TypeAlias = Union[ - DataPushChannelDataTokensOnly, - DataPushChannelDataDevicesOnly, - DataAwssnsPushChannelDataTargetArNsOnly, - DataAwssnsPushChannelDataDevicesOnly, - DataOneSignalChannelDataPlayerIDsOnly, + PushChannelDataTokensOnlyParam, + PushChannelDataDevicesOnlyParam, + AwsSnsPushChannelDataTargetArnsOnlyParam, + AwsSnsPushChannelDataDevicesOnlyParam, + OneSignalChannelDataPlayerIDsOnlyParam, SlackChannelDataParam, MsTeamsChannelDataParam, DiscordChannelDataParam, diff --git a/src/knockapi/types/user_set_preferences_params.py b/src/knockapi/types/user_set_preferences_params.py index 69c1318..511b8a1 100644 --- a/src/knockapi/types/user_set_preferences_params.py +++ b/src/knockapi/types/user_set_preferences_params.py @@ -3,24 +3,22 @@ from __future__ import annotations from typing import Dict, Union, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing_extensions import Literal, Annotated, TypeAlias, TypedDict from .._utils import PropertyInfo from .shared_params.condition import Condition from .recipients.preference_set_channel_types_param import PreferenceSetChannelTypesParam +from .recipients.preference_set_channel_setting_param import PreferenceSetChannelSettingParam __all__ = [ "UserSetPreferencesParams", "Categories", "CategoriesPreferenceSetWorkflowCategorySettingObject", "CategoriesPreferenceSetWorkflowCategorySettingObjectChannels", - "CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting", "Channels", - "ChannelsPreferenceSetChannelSetting", "Workflows", "WorkflowsPreferenceSetWorkflowCategorySettingObject", "WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels", - "WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting", ] @@ -57,14 +55,7 @@ class UserSetPreferencesParams(TypedDict, total=False): """ -class CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting(TypedDict, total=False): - conditions: Required[Iterable[Condition]] - """A list of conditions to apply to a specific channel.""" - - -CategoriesPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[ - bool, CategoriesPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting -] +CategoriesPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[bool, PreferenceSetChannelSettingParam] class CategoriesPreferenceSetWorkflowCategorySettingObject(TypedDict, total=False): @@ -80,23 +71,9 @@ class CategoriesPreferenceSetWorkflowCategorySettingObject(TypedDict, total=Fals Categories: TypeAlias = Union[bool, CategoriesPreferenceSetWorkflowCategorySettingObject] +Channels: TypeAlias = Union[bool, PreferenceSetChannelSettingParam] -class ChannelsPreferenceSetChannelSetting(TypedDict, total=False): - conditions: Required[Iterable[Condition]] - """A list of conditions to apply to a specific channel.""" - - -Channels: TypeAlias = Union[bool, ChannelsPreferenceSetChannelSetting] - - -class WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting(TypedDict, total=False): - conditions: Required[Iterable[Condition]] - """A list of conditions to apply to a specific channel.""" - - -WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[ - bool, WorkflowsPreferenceSetWorkflowCategorySettingObjectChannelsPreferenceSetChannelSetting -] +WorkflowsPreferenceSetWorkflowCategorySettingObjectChannels: TypeAlias = Union[bool, PreferenceSetChannelSettingParam] class WorkflowsPreferenceSetWorkflowCategorySettingObject(TypedDict, total=False): diff --git a/src/knockapi/types/users/feed_list_items_params.py b/src/knockapi/types/users/feed_list_items_params.py index cc5a3b7..a6c61d7 100644 --- a/src/knockapi/types/users/feed_list_items_params.py +++ b/src/knockapi/types/users/feed_list_items_params.py @@ -22,6 +22,14 @@ class FeedListItemsParams(TypedDict, total=False): has_tenant: bool """Whether the feed items have a tenant.""" + locale: str + """The locale to render the feed items in. + + Must be in the IETF 5646 format (e.g. `en-US`). When not provided, will default + to the locale that the feed items were rendered in. Only available for + enterprise plan customers using custom translations. + """ + page_size: int """The number of items per page (defaults to 50).""" diff --git a/tests/api_resources/tenants/test_bulk.py b/tests/api_resources/tenants/test_bulk.py index ea5febf..03650c1 100644 --- a/tests/api_resources/tenants/test_bulk.py +++ b/tests/api_resources/tenants/test_bulk.py @@ -55,7 +55,7 @@ def test_streaming_response_delete(self, client: Knock) -> None: @parametrize def test_method_set(self, client: Knock) -> None: bulk = client.tenants.bulk.set( - tenants=["string"], + tenants=[{"id": "tenant_1"}], ) assert_matches_type(BulkOperation, bulk, path=["response"]) @@ -63,7 +63,7 @@ def test_method_set(self, client: Knock) -> None: @parametrize def test_raw_response_set(self, client: Knock) -> None: response = client.tenants.bulk.with_raw_response.set( - tenants=["string"], + tenants=[{"id": "tenant_1"}], ) assert response.is_closed is True @@ -75,7 +75,7 @@ def test_raw_response_set(self, client: Knock) -> None: @parametrize def test_streaming_response_set(self, client: Knock) -> None: with client.tenants.bulk.with_streaming_response.set( - tenants=["string"], + tenants=[{"id": "tenant_1"}], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -129,7 +129,7 @@ async def test_streaming_response_delete(self, async_client: AsyncKnock) -> None @parametrize async def test_method_set(self, async_client: AsyncKnock) -> None: bulk = await async_client.tenants.bulk.set( - tenants=["string"], + tenants=[{"id": "tenant_1"}], ) assert_matches_type(BulkOperation, bulk, path=["response"]) @@ -137,7 +137,7 @@ async def test_method_set(self, async_client: AsyncKnock) -> None: @parametrize async def test_raw_response_set(self, async_client: AsyncKnock) -> None: response = await async_client.tenants.bulk.with_raw_response.set( - tenants=["string"], + tenants=[{"id": "tenant_1"}], ) assert response.is_closed is True @@ -149,7 +149,7 @@ async def test_raw_response_set(self, async_client: AsyncKnock) -> None: @parametrize async def test_streaming_response_set(self, async_client: AsyncKnock) -> None: async with async_client.tenants.bulk.with_streaming_response.set( - tenants=["string"], + tenants=[{"id": "tenant_1"}], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_objects.py b/tests/api_resources/test_objects.py index 1a1de7d..79cc891 100644 --- a/tests/api_resources/test_objects.py +++ b/tests/api_resources/test_objects.py @@ -729,6 +729,7 @@ def test_method_set_with_all_params(self, client: Knock) -> None: id="id", channel_data={"97c5837d-c65c-4d54-aa39-080eeb81c69d": {"tokens": ["push_token_123"]}}, locale="en-US", + name="My product", preferences={ "default": { "_persistence_strategy": "merge", @@ -1878,6 +1879,7 @@ async def test_method_set_with_all_params(self, async_client: AsyncKnock) -> Non id="id", channel_data={"97c5837d-c65c-4d54-aa39-080eeb81c69d": {"tokens": ["push_token_123"]}}, locale="en-US", + name="My product", preferences={ "default": { "_persistence_strategy": "merge", diff --git a/tests/api_resources/test_tenants.py b/tests/api_resources/test_tenants.py index b2eb772..46fc5c4 100644 --- a/tests/api_resources/test_tenants.py +++ b/tests/api_resources/test_tenants.py @@ -156,6 +156,7 @@ def test_method_set_with_all_params(self, client: Knock) -> None: tenant = client.tenants.set( id="id", channel_data={"97c5837d-c65c-4d54-aa39-080eeb81c69d": {"tokens": ["push_token_xxx"]}}, + name="Jurassic Park", settings={ "branding": { "icon_url": "https://example.com/trex_silhouette_icon.png", @@ -434,6 +435,7 @@ async def test_method_set_with_all_params(self, async_client: AsyncKnock) -> Non tenant = await async_client.tenants.set( id="id", channel_data={"97c5837d-c65c-4d54-aa39-080eeb81c69d": {"tokens": ["push_token_xxx"]}}, + name="Jurassic Park", settings={ "branding": { "icon_url": "https://example.com/trex_silhouette_icon.png", diff --git a/tests/api_resources/users/test_feeds.py b/tests/api_resources/users/test_feeds.py index ac15268..7f1988d 100644 --- a/tests/api_resources/users/test_feeds.py +++ b/tests/api_resources/users/test_feeds.py @@ -89,6 +89,7 @@ def test_method_list_items_with_all_params(self, client: Knock) -> None: archived="exclude", before="before", has_tenant=True, + locale="locale", page_size=0, source="source", status="unread", @@ -218,6 +219,7 @@ async def test_method_list_items_with_all_params(self, async_client: AsyncKnock) archived="exclude", before="before", has_tenant=True, + locale="locale", page_size=0, source="source", status="unread",