diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f852183..d615a41 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "7.17.0" + ".": "7.17.1" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 9be8c11..5fa6994 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 134 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-e0c54fd2a28d7beec2c18a6c7abb833e0dd9b14e99c48cf1cfd126f664f1dc62.yml -openapi_spec_hash: 713a396d0875e2000de918032b499b2e -config_hash: 83c79a6ad0a0b5dcce3b85208026343b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier/courier-97bb4b698571b6dbe884e93397d14aff0ec7e7279de272a15fa0defb3b2515d5.yml +openapi_spec_hash: c33bf8733151f4f5693788b6e57a8344 +config_hash: 74aad10d1512ec69541ece3ca51cf7fa diff --git a/CHANGELOG.md b/CHANGELOG.md index fea178a..6db886a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 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) + +### Documentation + +* **openapi:** add full response examples to every endpoint ([d42bc6b](https://github.com/trycourier/courier-python/commit/d42bc6b7ecd6c8fe4dbeea6e9bd8e4eb567cca84)) +* **openapi:** reword Cancel Submission description ([6e35fe4](https://github.com/trycourier/courier-python/commit/6e35fe48d31f568ae59687afe145676e282298b8)) +* **openapi:** reword Get Submission Checks description ([4c0ff82](https://github.com/trycourier/courier-python/commit/4c0ff82e577dcd5059c159c99fbf8b26e8750d27)) +* **openapi:** reword Replace Submission Checks description ([b897ea0](https://github.com/trycourier/courier-python/commit/b897ea0d23ef4fed99d6cb15b932e116a01fcf6a)) + ## 7.17.0 (2026-06-24) Full Changelog: [v7.16.0...v7.17.0](https://github.com/trycourier/courier-python/compare/v7.16.0...v7.17.0) diff --git a/api.md b/api.md index 07acc28..7392eb5 100644 --- a/api.md +++ b/api.md @@ -481,42 +481,42 @@ Methods: - client.routing_strategies.list_notifications(id, \*\*params) -> AssociatedNotificationListResponse - client.routing_strategies.replace(id, \*\*params) -> RoutingStrategyGetResponse -# PreferenceSections +# WorkspacePreferences Types: ```python from courier.types import ( - PreferenceSectionCreateRequest, - PreferenceSectionGetResponse, - PreferenceSectionListResponse, - PreferenceSectionReplaceRequest, - PreferenceTopicCreateRequest, - PreferenceTopicGetResponse, - PreferenceTopicListResponse, - PreferenceTopicReplaceRequest, PublishPreferencesResponse, + WorkspacePreferenceCreateRequest, + WorkspacePreferenceGetResponse, + WorkspacePreferenceListResponse, + WorkspacePreferenceReplaceRequest, + WorkspacePreferenceTopicCreateRequest, + WorkspacePreferenceTopicGetResponse, + WorkspacePreferenceTopicListResponse, + WorkspacePreferenceTopicReplaceRequest, ) ``` Methods: -- client.preference_sections.create(\*\*params) -> PreferenceSectionGetResponse -- client.preference_sections.retrieve(section_id) -> PreferenceSectionGetResponse -- client.preference_sections.list() -> PreferenceSectionListResponse -- client.preference_sections.archive(section_id) -> None -- client.preference_sections.publish() -> PublishPreferencesResponse -- client.preference_sections.replace(section_id, \*\*params) -> PreferenceSectionGetResponse +- client.workspace_preferences.create(\*\*params) -> WorkspacePreferenceGetResponse +- client.workspace_preferences.retrieve(section_id) -> WorkspacePreferenceGetResponse +- client.workspace_preferences.list() -> WorkspacePreferenceListResponse +- client.workspace_preferences.archive(section_id) -> None +- client.workspace_preferences.publish() -> PublishPreferencesResponse +- client.workspace_preferences.replace(section_id, \*\*params) -> WorkspacePreferenceGetResponse ## Topics Methods: -- client.preference_sections.topics.create(section_id, \*\*params) -> PreferenceTopicGetResponse -- client.preference_sections.topics.retrieve(topic_id, \*, section_id) -> PreferenceTopicGetResponse -- client.preference_sections.topics.list(section_id) -> PreferenceTopicListResponse -- client.preference_sections.topics.archive(topic_id, \*, section_id) -> None -- client.preference_sections.topics.replace(topic_id, \*, section_id, \*\*params) -> PreferenceTopicGetResponse +- client.workspace_preferences.topics.create(section_id, \*\*params) -> WorkspacePreferenceTopicGetResponse +- client.workspace_preferences.topics.retrieve(topic_id, \*, section_id) -> WorkspacePreferenceTopicGetResponse +- client.workspace_preferences.topics.list(section_id) -> WorkspacePreferenceTopicListResponse +- client.workspace_preferences.topics.archive(topic_id, \*, section_id) -> None +- client.workspace_preferences.topics.replace(topic_id, \*, section_id, \*\*params) -> WorkspacePreferenceTopicGetResponse # Profiles diff --git a/pyproject.toml b/pyproject.toml index 340c309..6456aac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "trycourier" -version = "7.17.0" +version = "7.17.1" description = "The official Python library for the Courier API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/courier/_client.py b/src/courier/_client.py index b79512a..b9f0e70 100644 --- a/src/courier/_client.py +++ b/src/courier/_client.py @@ -56,7 +56,7 @@ translations, notifications, routing_strategies, - preference_sections, + workspace_preferences, ) from .resources.auth import AuthResource, AsyncAuthResource from .resources.bulk import BulkResource, AsyncBulkResource @@ -78,9 +78,9 @@ from .resources.providers.providers import ProvidersResource, AsyncProvidersResource from .resources.automations.automations import AutomationsResource, AsyncAutomationsResource from .resources.notifications.notifications import NotificationsResource, AsyncNotificationsResource - from .resources.preference_sections.preference_sections import ( - PreferenceSectionsResource, - AsyncPreferenceSectionsResource, + from .resources.workspace_preferences.workspace_preferences import ( + WorkspacePreferencesResource, + AsyncWorkspacePreferencesResource, ) __all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Courier", "AsyncCourier", "Client", "AsyncClient"] @@ -247,10 +247,10 @@ def routing_strategies(self) -> RoutingStrategiesResource: return RoutingStrategiesResource(self) @cached_property - def preference_sections(self) -> PreferenceSectionsResource: - from .resources.preference_sections import PreferenceSectionsResource + def workspace_preferences(self) -> WorkspacePreferencesResource: + from .resources.workspace_preferences import WorkspacePreferencesResource - return PreferenceSectionsResource(self) + return WorkspacePreferencesResource(self) @cached_property def profiles(self) -> ProfilesResource: @@ -550,10 +550,10 @@ def routing_strategies(self) -> AsyncRoutingStrategiesResource: return AsyncRoutingStrategiesResource(self) @cached_property - def preference_sections(self) -> AsyncPreferenceSectionsResource: - from .resources.preference_sections import AsyncPreferenceSectionsResource + def workspace_preferences(self) -> AsyncWorkspacePreferencesResource: + from .resources.workspace_preferences import AsyncWorkspacePreferencesResource - return AsyncPreferenceSectionsResource(self) + return AsyncWorkspacePreferencesResource(self) @cached_property def profiles(self) -> AsyncProfilesResource: @@ -795,10 +795,10 @@ def routing_strategies(self) -> routing_strategies.RoutingStrategiesResourceWith return RoutingStrategiesResourceWithRawResponse(self._client.routing_strategies) @cached_property - def preference_sections(self) -> preference_sections.PreferenceSectionsResourceWithRawResponse: - from .resources.preference_sections import PreferenceSectionsResourceWithRawResponse + def workspace_preferences(self) -> workspace_preferences.WorkspacePreferencesResourceWithRawResponse: + from .resources.workspace_preferences import WorkspacePreferencesResourceWithRawResponse - return PreferenceSectionsResourceWithRawResponse(self._client.preference_sections) + return WorkspacePreferencesResourceWithRawResponse(self._client.workspace_preferences) @cached_property def profiles(self) -> profiles.ProfilesResourceWithRawResponse: @@ -928,10 +928,10 @@ def routing_strategies(self) -> routing_strategies.AsyncRoutingStrategiesResourc return AsyncRoutingStrategiesResourceWithRawResponse(self._client.routing_strategies) @cached_property - def preference_sections(self) -> preference_sections.AsyncPreferenceSectionsResourceWithRawResponse: - from .resources.preference_sections import AsyncPreferenceSectionsResourceWithRawResponse + def workspace_preferences(self) -> workspace_preferences.AsyncWorkspacePreferencesResourceWithRawResponse: + from .resources.workspace_preferences import AsyncWorkspacePreferencesResourceWithRawResponse - return AsyncPreferenceSectionsResourceWithRawResponse(self._client.preference_sections) + return AsyncWorkspacePreferencesResourceWithRawResponse(self._client.workspace_preferences) @cached_property def profiles(self) -> profiles.AsyncProfilesResourceWithRawResponse: @@ -1061,10 +1061,10 @@ def routing_strategies(self) -> routing_strategies.RoutingStrategiesResourceWith return RoutingStrategiesResourceWithStreamingResponse(self._client.routing_strategies) @cached_property - def preference_sections(self) -> preference_sections.PreferenceSectionsResourceWithStreamingResponse: - from .resources.preference_sections import PreferenceSectionsResourceWithStreamingResponse + def workspace_preferences(self) -> workspace_preferences.WorkspacePreferencesResourceWithStreamingResponse: + from .resources.workspace_preferences import WorkspacePreferencesResourceWithStreamingResponse - return PreferenceSectionsResourceWithStreamingResponse(self._client.preference_sections) + return WorkspacePreferencesResourceWithStreamingResponse(self._client.workspace_preferences) @cached_property def profiles(self) -> profiles.ProfilesResourceWithStreamingResponse: @@ -1194,10 +1194,10 @@ def routing_strategies(self) -> routing_strategies.AsyncRoutingStrategiesResourc return AsyncRoutingStrategiesResourceWithStreamingResponse(self._client.routing_strategies) @cached_property - def preference_sections(self) -> preference_sections.AsyncPreferenceSectionsResourceWithStreamingResponse: - from .resources.preference_sections import AsyncPreferenceSectionsResourceWithStreamingResponse + def workspace_preferences(self) -> workspace_preferences.AsyncWorkspacePreferencesResourceWithStreamingResponse: + from .resources.workspace_preferences import AsyncWorkspacePreferencesResourceWithStreamingResponse - return AsyncPreferenceSectionsResourceWithStreamingResponse(self._client.preference_sections) + return AsyncWorkspacePreferencesResourceWithStreamingResponse(self._client.workspace_preferences) @cached_property def profiles(self) -> profiles.AsyncProfilesResourceWithStreamingResponse: diff --git a/src/courier/_version.py b/src/courier/_version.py index 313a105..b849cde 100644 --- a/src/courier/_version.py +++ b/src/courier/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "courier" -__version__ = "7.17.0" # x-release-please-version +__version__ = "7.17.1" # x-release-please-version diff --git a/src/courier/resources/__init__.py b/src/courier/resources/__init__.py index 20439e3..54282b8 100644 --- a/src/courier/resources/__init__.py +++ b/src/courier/resources/__init__.py @@ -160,13 +160,13 @@ RoutingStrategiesResourceWithStreamingResponse, AsyncRoutingStrategiesResourceWithStreamingResponse, ) -from .preference_sections import ( - PreferenceSectionsResource, - AsyncPreferenceSectionsResource, - PreferenceSectionsResourceWithRawResponse, - AsyncPreferenceSectionsResourceWithRawResponse, - PreferenceSectionsResourceWithStreamingResponse, - AsyncPreferenceSectionsResourceWithStreamingResponse, +from .workspace_preferences import ( + WorkspacePreferencesResource, + AsyncWorkspacePreferencesResource, + WorkspacePreferencesResourceWithRawResponse, + AsyncWorkspacePreferencesResourceWithRawResponse, + WorkspacePreferencesResourceWithStreamingResponse, + AsyncWorkspacePreferencesResourceWithStreamingResponse, ) __all__ = [ @@ -266,12 +266,12 @@ "AsyncRoutingStrategiesResourceWithRawResponse", "RoutingStrategiesResourceWithStreamingResponse", "AsyncRoutingStrategiesResourceWithStreamingResponse", - "PreferenceSectionsResource", - "AsyncPreferenceSectionsResource", - "PreferenceSectionsResourceWithRawResponse", - "AsyncPreferenceSectionsResourceWithRawResponse", - "PreferenceSectionsResourceWithStreamingResponse", - "AsyncPreferenceSectionsResourceWithStreamingResponse", + "WorkspacePreferencesResource", + "AsyncWorkspacePreferencesResource", + "WorkspacePreferencesResourceWithRawResponse", + "AsyncWorkspacePreferencesResourceWithRawResponse", + "WorkspacePreferencesResourceWithStreamingResponse", + "AsyncWorkspacePreferencesResourceWithStreamingResponse", "ProfilesResource", "AsyncProfilesResource", "ProfilesResourceWithRawResponse", diff --git a/src/courier/resources/notifications/checks.py b/src/courier/resources/notifications/checks.py index fd666d9..b619de4 100644 --- a/src/courier/resources/notifications/checks.py +++ b/src/courier/resources/notifications/checks.py @@ -59,7 +59,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CheckUpdateResponse: """ - Replace the checks for a notification template submission. + Replace the submission checks for a notification template. Args: extra_headers: Send extra headers @@ -96,7 +96,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CheckListResponse: """ - Retrieve the checks for a notification template submission. + Retrieve the submission checks for a notification template. Args: extra_headers: Send extra headers @@ -132,7 +132,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ - Cancel a notification template submission. + Cancel a submission for a notification template. Args: extra_headers: Send extra headers @@ -191,7 +191,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CheckUpdateResponse: """ - Replace the checks for a notification template submission. + Replace the submission checks for a notification template. Args: extra_headers: Send extra headers @@ -228,7 +228,7 @@ async def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CheckListResponse: """ - Retrieve the checks for a notification template submission. + Retrieve the submission checks for a notification template. Args: extra_headers: Send extra headers @@ -264,7 +264,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ - Cancel a notification template submission. + Cancel a submission for a notification template. Args: extra_headers: Send extra headers diff --git a/src/courier/resources/preference_sections/__init__.py b/src/courier/resources/preference_sections/__init__.py deleted file mode 100644 index 2ce5b7b..0000000 --- a/src/courier/resources/preference_sections/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .topics import ( - TopicsResource, - AsyncTopicsResource, - TopicsResourceWithRawResponse, - AsyncTopicsResourceWithRawResponse, - TopicsResourceWithStreamingResponse, - AsyncTopicsResourceWithStreamingResponse, -) -from .preference_sections import ( - PreferenceSectionsResource, - AsyncPreferenceSectionsResource, - PreferenceSectionsResourceWithRawResponse, - AsyncPreferenceSectionsResourceWithRawResponse, - PreferenceSectionsResourceWithStreamingResponse, - AsyncPreferenceSectionsResourceWithStreamingResponse, -) - -__all__ = [ - "TopicsResource", - "AsyncTopicsResource", - "TopicsResourceWithRawResponse", - "AsyncTopicsResourceWithRawResponse", - "TopicsResourceWithStreamingResponse", - "AsyncTopicsResourceWithStreamingResponse", - "PreferenceSectionsResource", - "AsyncPreferenceSectionsResource", - "PreferenceSectionsResourceWithRawResponse", - "AsyncPreferenceSectionsResourceWithRawResponse", - "PreferenceSectionsResourceWithStreamingResponse", - "AsyncPreferenceSectionsResourceWithStreamingResponse", -] diff --git a/src/courier/resources/workspace_preferences/__init__.py b/src/courier/resources/workspace_preferences/__init__.py new file mode 100644 index 0000000..21743d6 --- /dev/null +++ b/src/courier/resources/workspace_preferences/__init__.py @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .topics import ( + TopicsResource, + AsyncTopicsResource, + TopicsResourceWithRawResponse, + AsyncTopicsResourceWithRawResponse, + TopicsResourceWithStreamingResponse, + AsyncTopicsResourceWithStreamingResponse, +) +from .workspace_preferences import ( + WorkspacePreferencesResource, + AsyncWorkspacePreferencesResource, + WorkspacePreferencesResourceWithRawResponse, + AsyncWorkspacePreferencesResourceWithRawResponse, + WorkspacePreferencesResourceWithStreamingResponse, + AsyncWorkspacePreferencesResourceWithStreamingResponse, +) + +__all__ = [ + "TopicsResource", + "AsyncTopicsResource", + "TopicsResourceWithRawResponse", + "AsyncTopicsResourceWithRawResponse", + "TopicsResourceWithStreamingResponse", + "AsyncTopicsResourceWithStreamingResponse", + "WorkspacePreferencesResource", + "AsyncWorkspacePreferencesResource", + "WorkspacePreferencesResourceWithRawResponse", + "AsyncWorkspacePreferencesResourceWithRawResponse", + "WorkspacePreferencesResourceWithStreamingResponse", + "AsyncWorkspacePreferencesResourceWithStreamingResponse", +] diff --git a/src/courier/resources/preference_sections/topics.py b/src/courier/resources/workspace_preferences/topics.py similarity index 90% rename from src/courier/resources/preference_sections/topics.py rename to src/courier/resources/workspace_preferences/topics.py index 4ea2c17..6b06915 100644 --- a/src/courier/resources/preference_sections/topics.py +++ b/src/courier/resources/workspace_preferences/topics.py @@ -18,10 +18,10 @@ async_to_streamed_response_wrapper, ) from ..._base_client import make_request_options -from ...types.preference_sections import topic_create_params, topic_replace_params -from ...types.preference_topic_get_response import PreferenceTopicGetResponse +from ...types.workspace_preferences import topic_create_params, topic_replace_params from ...types.shared.channel_classification import ChannelClassification -from ...types.preference_topic_list_response import PreferenceTopicListResponse +from ...types.workspace_preference_topic_get_response import WorkspacePreferenceTopicGetResponse +from ...types.workspace_preference_topic_list_response import WorkspacePreferenceTopicListResponse __all__ = ["TopicsResource", "AsyncTopicsResource"] @@ -62,11 +62,12 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PreferenceTopicGetResponse: - """Create a subscription preference topic inside a section. + ) -> WorkspacePreferenceTopicGetResponse: + """Create a subscription preference topic inside a workspace preference. - Fails with 404 if the - section does not exist. The topic id is generated and returned. + Fails with + 404 if the workspace preference does not exist. The topic id is generated and + returned. Args: default_status: The default subscription status applied when a recipient has not set their own. @@ -108,7 +109,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PreferenceTopicGetResponse, + cast_to=WorkspacePreferenceTopicGetResponse, ) def retrieve( @@ -122,11 +123,12 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PreferenceTopicGetResponse: - """Retrieve a topic within a section. + ) -> WorkspacePreferenceTopicGetResponse: + """Retrieve a topic within a workspace preference. - Returns 404 if the section does not exist, - the topic does not exist, or the topic belongs to a different section. + Returns 404 if the workspace + preference does not exist, the topic does not exist, or the topic belongs to a + different workspace preference. Args: extra_headers: Send extra headers @@ -148,7 +150,7 @@ def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PreferenceTopicGetResponse, + cast_to=WorkspacePreferenceTopicGetResponse, ) def list( @@ -161,9 +163,9 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PreferenceTopicListResponse: + ) -> WorkspacePreferenceTopicListResponse: """ - List the topics in a preference section. + List the topics in a workspace preference. Args: extra_headers: Send extra headers @@ -181,7 +183,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PreferenceTopicListResponse, + cast_to=WorkspacePreferenceTopicListResponse, ) def archive( @@ -196,9 +198,10 @@ def archive( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: - """Archive a topic and remove it from its section. + """Archive a topic and remove it from its workspace preference. - Same 404 rules as GET. + Same 404 rules as + GET. Args: extra_headers: Send extra headers @@ -241,11 +244,11 @@ def replace( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PreferenceTopicGetResponse: - """Replace a topic within a section. + ) -> WorkspacePreferenceTopicGetResponse: + """Replace a topic within a workspace preference. - Full document replacement; missing optional - fields are cleared. Same 404 rules as GET. + Full document replacement; + missing optional fields are cleared. Same 404 rules as GET. Args: default_status: The default subscription status applied when a recipient has not set their own. @@ -290,7 +293,7 @@ def replace( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PreferenceTopicGetResponse, + cast_to=WorkspacePreferenceTopicGetResponse, ) @@ -330,11 +333,12 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PreferenceTopicGetResponse: - """Create a subscription preference topic inside a section. + ) -> WorkspacePreferenceTopicGetResponse: + """Create a subscription preference topic inside a workspace preference. - Fails with 404 if the - section does not exist. The topic id is generated and returned. + Fails with + 404 if the workspace preference does not exist. The topic id is generated and + returned. Args: default_status: The default subscription status applied when a recipient has not set their own. @@ -376,7 +380,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PreferenceTopicGetResponse, + cast_to=WorkspacePreferenceTopicGetResponse, ) async def retrieve( @@ -390,11 +394,12 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PreferenceTopicGetResponse: - """Retrieve a topic within a section. + ) -> WorkspacePreferenceTopicGetResponse: + """Retrieve a topic within a workspace preference. - Returns 404 if the section does not exist, - the topic does not exist, or the topic belongs to a different section. + Returns 404 if the workspace + preference does not exist, the topic does not exist, or the topic belongs to a + different workspace preference. Args: extra_headers: Send extra headers @@ -416,7 +421,7 @@ async def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PreferenceTopicGetResponse, + cast_to=WorkspacePreferenceTopicGetResponse, ) async def list( @@ -429,9 +434,9 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PreferenceTopicListResponse: + ) -> WorkspacePreferenceTopicListResponse: """ - List the topics in a preference section. + List the topics in a workspace preference. Args: extra_headers: Send extra headers @@ -449,7 +454,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PreferenceTopicListResponse, + cast_to=WorkspacePreferenceTopicListResponse, ) async def archive( @@ -464,9 +469,10 @@ async def archive( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: - """Archive a topic and remove it from its section. + """Archive a topic and remove it from its workspace preference. - Same 404 rules as GET. + Same 404 rules as + GET. Args: extra_headers: Send extra headers @@ -509,11 +515,11 @@ async def replace( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PreferenceTopicGetResponse: - """Replace a topic within a section. + ) -> WorkspacePreferenceTopicGetResponse: + """Replace a topic within a workspace preference. - Full document replacement; missing optional - fields are cleared. Same 404 rules as GET. + Full document replacement; + missing optional fields are cleared. Same 404 rules as GET. Args: default_status: The default subscription status applied when a recipient has not set their own. @@ -558,7 +564,7 @@ async def replace( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PreferenceTopicGetResponse, + cast_to=WorkspacePreferenceTopicGetResponse, ) diff --git a/src/courier/resources/preference_sections/preference_sections.py b/src/courier/resources/workspace_preferences/workspace_preferences.py similarity index 72% rename from src/courier/resources/preference_sections/preference_sections.py rename to src/courier/resources/workspace_preferences/workspace_preferences.py index 47267cf..98dc816 100644 --- a/src/courier/resources/preference_sections/preference_sections.py +++ b/src/courier/resources/workspace_preferences/workspace_preferences.py @@ -14,7 +14,7 @@ TopicsResourceWithStreamingResponse, AsyncTopicsResourceWithStreamingResponse, ) -from ...types import preference_section_create_params, preference_section_replace_params +from ...types import workspace_preference_create_params, workspace_preference_replace_params 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 @@ -28,35 +28,35 @@ from ..._base_client import make_request_options from ...types.publish_preferences_response import PublishPreferencesResponse from ...types.shared.channel_classification import ChannelClassification -from ...types.preference_section_get_response import PreferenceSectionGetResponse -from ...types.preference_section_list_response import PreferenceSectionListResponse +from ...types.workspace_preference_get_response import WorkspacePreferenceGetResponse +from ...types.workspace_preference_list_response import WorkspacePreferenceListResponse -__all__ = ["PreferenceSectionsResource", "AsyncPreferenceSectionsResource"] +__all__ = ["WorkspacePreferencesResource", "AsyncWorkspacePreferencesResource"] -class PreferenceSectionsResource(SyncAPIResource): +class WorkspacePreferencesResource(SyncAPIResource): @cached_property def topics(self) -> TopicsResource: return TopicsResource(self._client) @cached_property - def with_raw_response(self) -> PreferenceSectionsResourceWithRawResponse: + def with_raw_response(self) -> WorkspacePreferencesResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/trycourier/courier-python#accessing-raw-response-data-eg-headers """ - return PreferenceSectionsResourceWithRawResponse(self) + return WorkspacePreferencesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PreferenceSectionsResourceWithStreamingResponse: + def with_streaming_response(self) -> WorkspacePreferencesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/trycourier/courier-python#with_streaming_response """ - return PreferenceSectionsResourceWithStreamingResponse(self) + return WorkspacePreferencesResourceWithStreamingResponse(self) def create( self, @@ -70,19 +70,19 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PreferenceSectionGetResponse: - """Create a preference section in your workspace. + ) -> WorkspacePreferenceGetResponse: + """Create a workspace preference. - The section id is generated and - returned. Topics are created inside a section via POST + The workspace preference id is generated and + returned. Topics are created inside a workspace preference via POST /preferences/sections/{section_id}/topics. Args: - name: Human-readable name for the section. + name: Human-readable name for the workspace preference. - has_custom_routing: Whether the section defines custom routing for its topics. + has_custom_routing: Whether the workspace preference defines custom routing for its topics. - routing_options: Default channels for the section. Defaults to empty if omitted. + routing_options: Default channels for the workspace preference. Defaults to empty if omitted. extra_headers: Send extra headers @@ -100,12 +100,12 @@ def create( "has_custom_routing": has_custom_routing, "routing_options": routing_options, }, - preference_section_create_params.PreferenceSectionCreateParams, + workspace_preference_create_params.WorkspacePreferenceCreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PreferenceSectionGetResponse, + cast_to=WorkspacePreferenceGetResponse, ) def retrieve( @@ -118,9 +118,9 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PreferenceSectionGetResponse: + ) -> WorkspacePreferenceGetResponse: """ - Retrieve a preference section by id, including its topics. + Retrieve a workspace preference by id, including its topics. Args: extra_headers: Send extra headers @@ -138,7 +138,7 @@ def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PreferenceSectionGetResponse, + cast_to=WorkspacePreferenceGetResponse, ) def list( @@ -150,18 +150,18 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PreferenceSectionListResponse: - """List the workspace's preference sections. + ) -> WorkspacePreferenceListResponse: + """List the workspace's preferences. - Each section embeds its topics. Scoped - to the workspace of the API key. + Each workspace preference embeds its topics. + Scoped to the workspace of the API key. """ return self._get( "/preferences/sections", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PreferenceSectionListResponse, + cast_to=WorkspacePreferenceListResponse, ) def archive( @@ -175,10 +175,10 @@ def archive( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: - """Archive a preference section. + """Archive a workspace preference. - The section must be empty: delete its topics - first, otherwise the request fails with 409. + The workspace preference must be empty: delete + its topics first, otherwise the request fails with 409. Args: extra_headers: Send extra headers @@ -212,9 +212,9 @@ def publish( ) -> PublishPreferencesResponse: """Publish the workspace's preferences page. - Takes a snapshot of every section with - its topics under a new published version, making the current state visible on - the hosted preferences page (non-draft). + Takes a snapshot of every workspace + preference with its topics under a new published version, making the current + state visible on the hosted preferences page (non-draft). """ return self._post( "/preferences/publish", @@ -237,18 +237,18 @@ def replace( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PreferenceSectionGetResponse: - """Replace a preference section. + ) -> WorkspacePreferenceGetResponse: + """Replace a workspace preference. - Full document replacement; missing optional fields - are cleared. Topics attached to the section are unaffected. + Full document replacement; missing optional + fields are cleared. Topics attached to the workspace preference are unaffected. Args: - name: Human-readable name for the section. + name: Human-readable name for the workspace preference. - has_custom_routing: Whether the section defines custom routing for its topics. + has_custom_routing: Whether the workspace preference defines custom routing for its topics. - routing_options: Default channels for the section. Omit to clear. + routing_options: Default channels for the workspace preference. Omit to clear. extra_headers: Send extra headers @@ -268,38 +268,38 @@ def replace( "has_custom_routing": has_custom_routing, "routing_options": routing_options, }, - preference_section_replace_params.PreferenceSectionReplaceParams, + workspace_preference_replace_params.WorkspacePreferenceReplaceParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PreferenceSectionGetResponse, + cast_to=WorkspacePreferenceGetResponse, ) -class AsyncPreferenceSectionsResource(AsyncAPIResource): +class AsyncWorkspacePreferencesResource(AsyncAPIResource): @cached_property def topics(self) -> AsyncTopicsResource: return AsyncTopicsResource(self._client) @cached_property - def with_raw_response(self) -> AsyncPreferenceSectionsResourceWithRawResponse: + def with_raw_response(self) -> AsyncWorkspacePreferencesResourceWithRawResponse: """ This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/trycourier/courier-python#accessing-raw-response-data-eg-headers """ - return AsyncPreferenceSectionsResourceWithRawResponse(self) + return AsyncWorkspacePreferencesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPreferenceSectionsResourceWithStreamingResponse: + def with_streaming_response(self) -> AsyncWorkspacePreferencesResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/trycourier/courier-python#with_streaming_response """ - return AsyncPreferenceSectionsResourceWithStreamingResponse(self) + return AsyncWorkspacePreferencesResourceWithStreamingResponse(self) async def create( self, @@ -313,19 +313,19 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PreferenceSectionGetResponse: - """Create a preference section in your workspace. + ) -> WorkspacePreferenceGetResponse: + """Create a workspace preference. - The section id is generated and - returned. Topics are created inside a section via POST + The workspace preference id is generated and + returned. Topics are created inside a workspace preference via POST /preferences/sections/{section_id}/topics. Args: - name: Human-readable name for the section. + name: Human-readable name for the workspace preference. - has_custom_routing: Whether the section defines custom routing for its topics. + has_custom_routing: Whether the workspace preference defines custom routing for its topics. - routing_options: Default channels for the section. Defaults to empty if omitted. + routing_options: Default channels for the workspace preference. Defaults to empty if omitted. extra_headers: Send extra headers @@ -343,12 +343,12 @@ async def create( "has_custom_routing": has_custom_routing, "routing_options": routing_options, }, - preference_section_create_params.PreferenceSectionCreateParams, + workspace_preference_create_params.WorkspacePreferenceCreateParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PreferenceSectionGetResponse, + cast_to=WorkspacePreferenceGetResponse, ) async def retrieve( @@ -361,9 +361,9 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PreferenceSectionGetResponse: + ) -> WorkspacePreferenceGetResponse: """ - Retrieve a preference section by id, including its topics. + Retrieve a workspace preference by id, including its topics. Args: extra_headers: Send extra headers @@ -381,7 +381,7 @@ async def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PreferenceSectionGetResponse, + cast_to=WorkspacePreferenceGetResponse, ) async def list( @@ -393,18 +393,18 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PreferenceSectionListResponse: - """List the workspace's preference sections. + ) -> WorkspacePreferenceListResponse: + """List the workspace's preferences. - Each section embeds its topics. Scoped - to the workspace of the API key. + Each workspace preference embeds its topics. + Scoped to the workspace of the API key. """ return await self._get( "/preferences/sections", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PreferenceSectionListResponse, + cast_to=WorkspacePreferenceListResponse, ) async def archive( @@ -418,10 +418,10 @@ async def archive( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: - """Archive a preference section. + """Archive a workspace preference. - The section must be empty: delete its topics - first, otherwise the request fails with 409. + The workspace preference must be empty: delete + its topics first, otherwise the request fails with 409. Args: extra_headers: Send extra headers @@ -455,9 +455,9 @@ async def publish( ) -> PublishPreferencesResponse: """Publish the workspace's preferences page. - Takes a snapshot of every section with - its topics under a new published version, making the current state visible on - the hosted preferences page (non-draft). + Takes a snapshot of every workspace + preference with its topics under a new published version, making the current + state visible on the hosted preferences page (non-draft). """ return await self._post( "/preferences/publish", @@ -480,18 +480,18 @@ async def replace( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> PreferenceSectionGetResponse: - """Replace a preference section. + ) -> WorkspacePreferenceGetResponse: + """Replace a workspace preference. - Full document replacement; missing optional fields - are cleared. Topics attached to the section are unaffected. + Full document replacement; missing optional + fields are cleared. Topics attached to the workspace preference are unaffected. Args: - name: Human-readable name for the section. + name: Human-readable name for the workspace preference. - has_custom_routing: Whether the section defines custom routing for its topics. + has_custom_routing: Whether the workspace preference defines custom routing for its topics. - routing_options: Default channels for the section. Omit to clear. + routing_options: Default channels for the workspace preference. Omit to clear. extra_headers: Send extra headers @@ -511,122 +511,122 @@ async def replace( "has_custom_routing": has_custom_routing, "routing_options": routing_options, }, - preference_section_replace_params.PreferenceSectionReplaceParams, + workspace_preference_replace_params.WorkspacePreferenceReplaceParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PreferenceSectionGetResponse, + cast_to=WorkspacePreferenceGetResponse, ) -class PreferenceSectionsResourceWithRawResponse: - def __init__(self, preference_sections: PreferenceSectionsResource) -> None: - self._preference_sections = preference_sections +class WorkspacePreferencesResourceWithRawResponse: + def __init__(self, workspace_preferences: WorkspacePreferencesResource) -> None: + self._workspace_preferences = workspace_preferences self.create = to_raw_response_wrapper( - preference_sections.create, + workspace_preferences.create, ) self.retrieve = to_raw_response_wrapper( - preference_sections.retrieve, + workspace_preferences.retrieve, ) self.list = to_raw_response_wrapper( - preference_sections.list, + workspace_preferences.list, ) self.archive = to_raw_response_wrapper( - preference_sections.archive, + workspace_preferences.archive, ) self.publish = to_raw_response_wrapper( - preference_sections.publish, + workspace_preferences.publish, ) self.replace = to_raw_response_wrapper( - preference_sections.replace, + workspace_preferences.replace, ) @cached_property def topics(self) -> TopicsResourceWithRawResponse: - return TopicsResourceWithRawResponse(self._preference_sections.topics) + return TopicsResourceWithRawResponse(self._workspace_preferences.topics) -class AsyncPreferenceSectionsResourceWithRawResponse: - def __init__(self, preference_sections: AsyncPreferenceSectionsResource) -> None: - self._preference_sections = preference_sections +class AsyncWorkspacePreferencesResourceWithRawResponse: + def __init__(self, workspace_preferences: AsyncWorkspacePreferencesResource) -> None: + self._workspace_preferences = workspace_preferences self.create = async_to_raw_response_wrapper( - preference_sections.create, + workspace_preferences.create, ) self.retrieve = async_to_raw_response_wrapper( - preference_sections.retrieve, + workspace_preferences.retrieve, ) self.list = async_to_raw_response_wrapper( - preference_sections.list, + workspace_preferences.list, ) self.archive = async_to_raw_response_wrapper( - preference_sections.archive, + workspace_preferences.archive, ) self.publish = async_to_raw_response_wrapper( - preference_sections.publish, + workspace_preferences.publish, ) self.replace = async_to_raw_response_wrapper( - preference_sections.replace, + workspace_preferences.replace, ) @cached_property def topics(self) -> AsyncTopicsResourceWithRawResponse: - return AsyncTopicsResourceWithRawResponse(self._preference_sections.topics) + return AsyncTopicsResourceWithRawResponse(self._workspace_preferences.topics) -class PreferenceSectionsResourceWithStreamingResponse: - def __init__(self, preference_sections: PreferenceSectionsResource) -> None: - self._preference_sections = preference_sections +class WorkspacePreferencesResourceWithStreamingResponse: + def __init__(self, workspace_preferences: WorkspacePreferencesResource) -> None: + self._workspace_preferences = workspace_preferences self.create = to_streamed_response_wrapper( - preference_sections.create, + workspace_preferences.create, ) self.retrieve = to_streamed_response_wrapper( - preference_sections.retrieve, + workspace_preferences.retrieve, ) self.list = to_streamed_response_wrapper( - preference_sections.list, + workspace_preferences.list, ) self.archive = to_streamed_response_wrapper( - preference_sections.archive, + workspace_preferences.archive, ) self.publish = to_streamed_response_wrapper( - preference_sections.publish, + workspace_preferences.publish, ) self.replace = to_streamed_response_wrapper( - preference_sections.replace, + workspace_preferences.replace, ) @cached_property def topics(self) -> TopicsResourceWithStreamingResponse: - return TopicsResourceWithStreamingResponse(self._preference_sections.topics) + return TopicsResourceWithStreamingResponse(self._workspace_preferences.topics) -class AsyncPreferenceSectionsResourceWithStreamingResponse: - def __init__(self, preference_sections: AsyncPreferenceSectionsResource) -> None: - self._preference_sections = preference_sections +class AsyncWorkspacePreferencesResourceWithStreamingResponse: + def __init__(self, workspace_preferences: AsyncWorkspacePreferencesResource) -> None: + self._workspace_preferences = workspace_preferences self.create = async_to_streamed_response_wrapper( - preference_sections.create, + workspace_preferences.create, ) self.retrieve = async_to_streamed_response_wrapper( - preference_sections.retrieve, + workspace_preferences.retrieve, ) self.list = async_to_streamed_response_wrapper( - preference_sections.list, + workspace_preferences.list, ) self.archive = async_to_streamed_response_wrapper( - preference_sections.archive, + workspace_preferences.archive, ) self.publish = async_to_streamed_response_wrapper( - preference_sections.publish, + workspace_preferences.publish, ) self.replace = async_to_streamed_response_wrapper( - preference_sections.replace, + workspace_preferences.replace, ) @cached_property def topics(self) -> AsyncTopicsResourceWithStreamingResponse: - return AsyncTopicsResourceWithStreamingResponse(self._preference_sections.topics) + return AsyncTopicsResourceWithStreamingResponse(self._workspace_preferences.topics) diff --git a/src/courier/types/__init__.py b/src/courier/types/__init__.py index bd8105f..ce39a5b 100644 --- a/src/courier/types/__init__.py +++ b/src/courier/types/__init__.py @@ -246,7 +246,6 @@ from .journey_throttle_dynamic_node import JourneyThrottleDynamicNode as JourneyThrottleDynamicNode from .notification_template_payload import NotificationTemplatePayload as NotificationTemplatePayload from .notification_template_summary import NotificationTemplateSummary as NotificationTemplateSummary -from .preference_topic_get_response import PreferenceTopicGetResponse as PreferenceTopicGetResponse from .routing_strategy_get_response import RoutingStrategyGetResponse as RoutingStrategyGetResponse from .translation_retrieve_response import TranslationRetrieveResponse as TranslationRetrieveResponse from .audience_list_members_response import AudienceListMembersResponse as AudienceListMembersResponse @@ -257,30 +256,29 @@ from .journey_versions_list_response import JourneyVersionsListResponse as JourneyVersionsListResponse from .notification_put_locale_params import NotificationPutLocaleParams as NotificationPutLocaleParams from .notification_template_response import NotificationTemplateResponse as NotificationTemplateResponse -from .preference_topic_list_response import PreferenceTopicListResponse as PreferenceTopicListResponse from .routing_strategy_create_params import RoutingStrategyCreateParams as RoutingStrategyCreateParams from .routing_strategy_list_response import RoutingStrategyListResponse as RoutingStrategyListResponse from .inbound_bulk_message_user_param import InboundBulkMessageUserParam as InboundBulkMessageUserParam from .journey_api_invoke_trigger_node import JourneyAPIInvokeTriggerNode as JourneyAPIInvokeTriggerNode from .notification_put_content_params import NotificationPutContentParams as NotificationPutContentParams from .notification_put_element_params import NotificationPutElementParams as NotificationPutElementParams -from .preference_section_get_response import PreferenceSectionGetResponse as PreferenceSectionGetResponse from .routing_strategy_replace_params import RoutingStrategyReplaceParams as RoutingStrategyReplaceParams from .base_template_tenant_association import BaseTemplateTenantAssociation as BaseTemplateTenantAssociation -from .preference_section_create_params import PreferenceSectionCreateParams as PreferenceSectionCreateParams -from .preference_section_list_response import PreferenceSectionListResponse as PreferenceSectionListResponse from .automation_template_list_response import AutomationTemplateListResponse as AutomationTemplateListResponse from .journey_delay_duration_node_param import JourneyDelayDurationNodeParam as JourneyDelayDurationNodeParam from .journey_fetch_post_put_node_param import JourneyFetchPostPutNodeParam as JourneyFetchPostPutNodeParam from .notification_content_get_response import NotificationContentGetResponse as NotificationContentGetResponse from .notification_list_versions_params import NotificationListVersionsParams as NotificationListVersionsParams -from .preference_section_replace_params import PreferenceSectionReplaceParams as PreferenceSectionReplaceParams from .put_subscriptions_recipient_param import PutSubscriptionsRecipientParam as PutSubscriptionsRecipientParam +from .workspace_preference_get_response import WorkspacePreferenceGetResponse as WorkspacePreferenceGetResponse from .journey_segment_trigger_node_param import JourneySegmentTriggerNodeParam as JourneySegmentTriggerNodeParam from .journey_throttle_static_node_param import JourneyThrottleStaticNodeParam as JourneyThrottleStaticNodeParam +from .workspace_preference_create_params import WorkspacePreferenceCreateParams as WorkspacePreferenceCreateParams +from .workspace_preference_list_response import WorkspacePreferenceListResponse as WorkspacePreferenceListResponse from .journey_fetch_get_delete_node_param import JourneyFetchGetDeleteNodeParam as JourneyFetchGetDeleteNodeParam from .journey_throttle_dynamic_node_param import JourneyThrottleDynamicNodeParam as JourneyThrottleDynamicNodeParam from .notification_template_payload_param import NotificationTemplatePayloadParam as NotificationTemplatePayloadParam +from .workspace_preference_replace_params import WorkspacePreferenceReplaceParams as WorkspacePreferenceReplaceParams from .journey_condition_nested_group_param import JourneyConditionNestedGroupParam as JourneyConditionNestedGroupParam from .notification_retrieve_content_params import NotificationRetrieveContentParams as NotificationRetrieveContentParams from .associated_notification_list_response import ( @@ -297,6 +295,12 @@ from .notification_retrieve_content_response import ( NotificationRetrieveContentResponse as NotificationRetrieveContentResponse, ) +from .workspace_preference_topic_get_response import ( + WorkspacePreferenceTopicGetResponse as WorkspacePreferenceTopicGetResponse, +) +from .workspace_preference_topic_list_response import ( + WorkspacePreferenceTopicListResponse as WorkspacePreferenceTopicListResponse, +) from .routing_strategy_list_notifications_params import ( RoutingStrategyListNotificationsParams as RoutingStrategyListNotificationsParams, ) diff --git a/src/courier/types/preference_section_get_response.py b/src/courier/types/preference_section_get_response.py deleted file mode 100644 index 1e853c2..0000000 --- a/src/courier/types/preference_section_get_response.py +++ /dev/null @@ -1,40 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from .._models import BaseModel -from .preference_topic_get_response import PreferenceTopicGetResponse -from .shared.channel_classification import ChannelClassification - -__all__ = ["PreferenceSectionGetResponse"] - - -class PreferenceSectionGetResponse(BaseModel): - """A preference section in your workspace, including its topics.""" - - id: str - """The preference section id.""" - - created: str - """ISO-8601 timestamp of when the section was created.""" - - has_custom_routing: bool - """Whether the section defines custom routing for its topics.""" - - name: str - """Human-readable name.""" - - routing_options: List[ChannelClassification] - """Default channels for the section. May be empty.""" - - topics: List[PreferenceTopicGetResponse] - """The topics contained in this section.""" - - creator: Optional[str] = None - """Id of the creator.""" - - updated: Optional[str] = None - """ISO-8601 timestamp of the last update.""" - - updater: Optional[str] = None - """Id of the last updater.""" diff --git a/src/courier/types/preference_section_list_response.py b/src/courier/types/preference_section_list_response.py deleted file mode 100644 index c825514..0000000 --- a/src/courier/types/preference_section_list_response.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .._models import BaseModel -from .preference_section_get_response import PreferenceSectionGetResponse - -__all__ = ["PreferenceSectionListResponse"] - - -class PreferenceSectionListResponse(BaseModel): - """The workspace's preference sections, each with its topics.""" - - results: List[PreferenceSectionGetResponse] diff --git a/src/courier/types/preference_topic_list_response.py b/src/courier/types/preference_topic_list_response.py deleted file mode 100644 index 47c22c4..0000000 --- a/src/courier/types/preference_topic_list_response.py +++ /dev/null @@ -1,14 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .._models import BaseModel -from .preference_topic_get_response import PreferenceTopicGetResponse - -__all__ = ["PreferenceTopicListResponse"] - - -class PreferenceTopicListResponse(BaseModel): - """Topics contained in a preference section.""" - - results: List[PreferenceTopicGetResponse] diff --git a/src/courier/types/preference_section_create_params.py b/src/courier/types/workspace_preference_create_params.py similarity index 54% rename from src/courier/types/preference_section_create_params.py rename to src/courier/types/workspace_preference_create_params.py index a9d0e77..b4057cf 100644 --- a/src/courier/types/preference_section_create_params.py +++ b/src/courier/types/workspace_preference_create_params.py @@ -7,15 +7,15 @@ from .shared.channel_classification import ChannelClassification -__all__ = ["PreferenceSectionCreateParams"] +__all__ = ["WorkspacePreferenceCreateParams"] -class PreferenceSectionCreateParams(TypedDict, total=False): +class WorkspacePreferenceCreateParams(TypedDict, total=False): name: Required[str] - """Human-readable name for the section.""" + """Human-readable name for the workspace preference.""" has_custom_routing: Optional[bool] - """Whether the section defines custom routing for its topics.""" + """Whether the workspace preference defines custom routing for its topics.""" routing_options: Optional[List[ChannelClassification]] - """Default channels for the section. Defaults to empty if omitted.""" + """Default channels for the workspace preference. Defaults to empty if omitted.""" diff --git a/src/courier/types/workspace_preference_get_response.py b/src/courier/types/workspace_preference_get_response.py new file mode 100644 index 0000000..d702830 --- /dev/null +++ b/src/courier/types/workspace_preference_get_response.py @@ -0,0 +1,40 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional + +from .._models import BaseModel +from .shared.channel_classification import ChannelClassification +from .workspace_preference_topic_get_response import WorkspacePreferenceTopicGetResponse + +__all__ = ["WorkspacePreferenceGetResponse"] + + +class WorkspacePreferenceGetResponse(BaseModel): + """A workspace preference in your workspace, including its topics.""" + + id: str + """The workspace preference id.""" + + created: str + """ISO-8601 timestamp of when the workspace preference was created.""" + + has_custom_routing: bool + """Whether the workspace preference defines custom routing for its topics.""" + + name: str + """Human-readable name.""" + + routing_options: List[ChannelClassification] + """Default channels for the workspace preference. May be empty.""" + + topics: List[WorkspacePreferenceTopicGetResponse] + """The topics contained in this workspace preference.""" + + creator: Optional[str] = None + """Id of the creator.""" + + updated: Optional[str] = None + """ISO-8601 timestamp of the last update.""" + + updater: Optional[str] = None + """Id of the last updater.""" diff --git a/src/courier/types/workspace_preference_list_response.py b/src/courier/types/workspace_preference_list_response.py new file mode 100644 index 0000000..4dfe47f --- /dev/null +++ b/src/courier/types/workspace_preference_list_response.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .._models import BaseModel +from .workspace_preference_get_response import WorkspacePreferenceGetResponse + +__all__ = ["WorkspacePreferenceListResponse"] + + +class WorkspacePreferenceListResponse(BaseModel): + """The workspace's preferences, each with its topics.""" + + results: List[WorkspacePreferenceGetResponse] diff --git a/src/courier/types/preference_section_replace_params.py b/src/courier/types/workspace_preference_replace_params.py similarity index 55% rename from src/courier/types/preference_section_replace_params.py rename to src/courier/types/workspace_preference_replace_params.py index 87c2e1a..9376c2a 100644 --- a/src/courier/types/preference_section_replace_params.py +++ b/src/courier/types/workspace_preference_replace_params.py @@ -7,15 +7,15 @@ from .shared.channel_classification import ChannelClassification -__all__ = ["PreferenceSectionReplaceParams"] +__all__ = ["WorkspacePreferenceReplaceParams"] -class PreferenceSectionReplaceParams(TypedDict, total=False): +class WorkspacePreferenceReplaceParams(TypedDict, total=False): name: Required[str] - """Human-readable name for the section.""" + """Human-readable name for the workspace preference.""" has_custom_routing: Optional[bool] - """Whether the section defines custom routing for its topics.""" + """Whether the workspace preference defines custom routing for its topics.""" routing_options: Optional[List[ChannelClassification]] - """Default channels for the section. Omit to clear.""" + """Default channels for the workspace preference. Omit to clear.""" diff --git a/src/courier/types/preference_topic_get_response.py b/src/courier/types/workspace_preference_topic_get_response.py similarity index 92% rename from src/courier/types/preference_topic_get_response.py rename to src/courier/types/workspace_preference_topic_get_response.py index 1ad846a..d76c638 100644 --- a/src/courier/types/preference_topic_get_response.py +++ b/src/courier/types/workspace_preference_topic_get_response.py @@ -6,10 +6,10 @@ from .._models import BaseModel from .shared.channel_classification import ChannelClassification -__all__ = ["PreferenceTopicGetResponse"] +__all__ = ["WorkspacePreferenceTopicGetResponse"] -class PreferenceTopicGetResponse(BaseModel): +class WorkspacePreferenceTopicGetResponse(BaseModel): """A subscription preference topic in your workspace.""" id: str diff --git a/src/courier/types/workspace_preference_topic_list_response.py b/src/courier/types/workspace_preference_topic_list_response.py new file mode 100644 index 0000000..afdb082 --- /dev/null +++ b/src/courier/types/workspace_preference_topic_list_response.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .._models import BaseModel +from .workspace_preference_topic_get_response import WorkspacePreferenceTopicGetResponse + +__all__ = ["WorkspacePreferenceTopicListResponse"] + + +class WorkspacePreferenceTopicListResponse(BaseModel): + """Topics contained in a workspace preference.""" + + results: List[WorkspacePreferenceTopicGetResponse] diff --git a/src/courier/types/preference_sections/__init__.py b/src/courier/types/workspace_preferences/__init__.py similarity index 100% rename from src/courier/types/preference_sections/__init__.py rename to src/courier/types/workspace_preferences/__init__.py diff --git a/src/courier/types/preference_sections/topic_create_params.py b/src/courier/types/workspace_preferences/topic_create_params.py similarity index 100% rename from src/courier/types/preference_sections/topic_create_params.py rename to src/courier/types/workspace_preferences/topic_create_params.py diff --git a/src/courier/types/preference_sections/topic_replace_params.py b/src/courier/types/workspace_preferences/topic_replace_params.py similarity index 100% rename from src/courier/types/preference_sections/topic_replace_params.py rename to src/courier/types/workspace_preferences/topic_replace_params.py diff --git a/tests/api_resources/test_preference_sections.py b/tests/api_resources/test_workspace_preferences.py similarity index 62% rename from tests/api_resources/test_preference_sections.py rename to tests/api_resources/test_workspace_preferences.py index fc02cc3..b22c930 100644 --- a/tests/api_resources/test_preference_sections.py +++ b/tests/api_resources/test_workspace_preferences.py @@ -11,91 +11,91 @@ from tests.utils import assert_matches_type from courier.types import ( PublishPreferencesResponse, - PreferenceSectionGetResponse, - PreferenceSectionListResponse, + WorkspacePreferenceGetResponse, + WorkspacePreferenceListResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestPreferenceSections: +class TestWorkspacePreferences: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_create(self, client: Courier) -> None: - preference_section = client.preference_sections.create( + workspace_preference = client.workspace_preferences.create( name="Account Notifications", ) - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_create_with_all_params(self, client: Courier) -> None: - preference_section = client.preference_sections.create( + workspace_preference = client.workspace_preferences.create( name="Account Notifications", has_custom_routing=True, routing_options=["direct_message"], ) - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_create(self, client: Courier) -> None: - response = client.preference_sections.with_raw_response.create( + response = client.workspace_preferences.with_raw_response.create( name="Account Notifications", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = response.parse() - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + workspace_preference = response.parse() + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_create(self, client: Courier) -> None: - with client.preference_sections.with_streaming_response.create( + with client.workspace_preferences.with_streaming_response.create( name="Account Notifications", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = response.parse() - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + workspace_preference = response.parse() + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_retrieve(self, client: Courier) -> None: - preference_section = client.preference_sections.retrieve( + workspace_preference = client.workspace_preferences.retrieve( "section_id", ) - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_retrieve(self, client: Courier) -> None: - response = client.preference_sections.with_raw_response.retrieve( + response = client.workspace_preferences.with_raw_response.retrieve( "section_id", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = response.parse() - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + workspace_preference = response.parse() + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_retrieve(self, client: Courier) -> None: - with client.preference_sections.with_streaming_response.retrieve( + with client.workspace_preferences.with_streaming_response.retrieve( "section_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = response.parse() - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + workspace_preference = response.parse() + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) assert cast(Any, response.is_closed) is True @@ -103,69 +103,69 @@ def test_streaming_response_retrieve(self, client: Courier) -> None: @parametrize def test_path_params_retrieve(self, client: Courier) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `section_id` but received ''"): - client.preference_sections.with_raw_response.retrieve( + client.workspace_preferences.with_raw_response.retrieve( "", ) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list(self, client: Courier) -> None: - preference_section = client.preference_sections.list() - assert_matches_type(PreferenceSectionListResponse, preference_section, path=["response"]) + workspace_preference = client.workspace_preferences.list() + assert_matches_type(WorkspacePreferenceListResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_list(self, client: Courier) -> None: - response = client.preference_sections.with_raw_response.list() + response = client.workspace_preferences.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = response.parse() - assert_matches_type(PreferenceSectionListResponse, preference_section, path=["response"]) + workspace_preference = response.parse() + assert_matches_type(WorkspacePreferenceListResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_list(self, client: Courier) -> None: - with client.preference_sections.with_streaming_response.list() as response: + with client.workspace_preferences.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = response.parse() - assert_matches_type(PreferenceSectionListResponse, preference_section, path=["response"]) + workspace_preference = response.parse() + assert_matches_type(WorkspacePreferenceListResponse, workspace_preference, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_archive(self, client: Courier) -> None: - preference_section = client.preference_sections.archive( + workspace_preference = client.workspace_preferences.archive( "section_id", ) - assert preference_section is None + assert workspace_preference is None @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_archive(self, client: Courier) -> None: - response = client.preference_sections.with_raw_response.archive( + response = client.workspace_preferences.with_raw_response.archive( "section_id", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = response.parse() - assert preference_section is None + workspace_preference = response.parse() + assert workspace_preference is None @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_archive(self, client: Courier) -> None: - with client.preference_sections.with_streaming_response.archive( + with client.workspace_preferences.with_streaming_response.archive( "section_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = response.parse() - assert preference_section is None + workspace_preference = response.parse() + assert workspace_preference is None assert cast(Any, response.is_closed) is True @@ -173,83 +173,83 @@ def test_streaming_response_archive(self, client: Courier) -> None: @parametrize def test_path_params_archive(self, client: Courier) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `section_id` but received ''"): - client.preference_sections.with_raw_response.archive( + client.workspace_preferences.with_raw_response.archive( "", ) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_publish(self, client: Courier) -> None: - preference_section = client.preference_sections.publish() - assert_matches_type(PublishPreferencesResponse, preference_section, path=["response"]) + workspace_preference = client.workspace_preferences.publish() + assert_matches_type(PublishPreferencesResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_publish(self, client: Courier) -> None: - response = client.preference_sections.with_raw_response.publish() + response = client.workspace_preferences.with_raw_response.publish() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = response.parse() - assert_matches_type(PublishPreferencesResponse, preference_section, path=["response"]) + workspace_preference = response.parse() + assert_matches_type(PublishPreferencesResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_publish(self, client: Courier) -> None: - with client.preference_sections.with_streaming_response.publish() as response: + with client.workspace_preferences.with_streaming_response.publish() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = response.parse() - assert_matches_type(PublishPreferencesResponse, preference_section, path=["response"]) + workspace_preference = response.parse() + assert_matches_type(PublishPreferencesResponse, workspace_preference, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_replace(self, client: Courier) -> None: - preference_section = client.preference_sections.replace( + workspace_preference = client.workspace_preferences.replace( section_id="section_id", name="name", ) - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_replace_with_all_params(self, client: Courier) -> None: - preference_section = client.preference_sections.replace( + workspace_preference = client.workspace_preferences.replace( section_id="section_id", name="name", has_custom_routing=True, routing_options=["direct_message"], ) - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_replace(self, client: Courier) -> None: - response = client.preference_sections.with_raw_response.replace( + response = client.workspace_preferences.with_raw_response.replace( section_id="section_id", name="name", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = response.parse() - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + workspace_preference = response.parse() + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_replace(self, client: Courier) -> None: - with client.preference_sections.with_streaming_response.replace( + with client.workspace_preferences.with_streaming_response.replace( section_id="section_id", name="name", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = response.parse() - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + workspace_preference = response.parse() + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) assert cast(Any, response.is_closed) is True @@ -257,13 +257,13 @@ def test_streaming_response_replace(self, client: Courier) -> None: @parametrize def test_path_params_replace(self, client: Courier) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `section_id` but received ''"): - client.preference_sections.with_raw_response.replace( + client.workspace_preferences.with_raw_response.replace( section_id="", name="name", ) -class TestAsyncPreferenceSections: +class TestAsyncWorkspacePreferences: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) @@ -271,78 +271,78 @@ class TestAsyncPreferenceSections: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_create(self, async_client: AsyncCourier) -> None: - preference_section = await async_client.preference_sections.create( + workspace_preference = await async_client.workspace_preferences.create( name="Account Notifications", ) - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCourier) -> None: - preference_section = await async_client.preference_sections.create( + workspace_preference = await async_client.workspace_preferences.create( name="Account Notifications", has_custom_routing=True, routing_options=["direct_message"], ) - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_create(self, async_client: AsyncCourier) -> None: - response = await async_client.preference_sections.with_raw_response.create( + response = await async_client.workspace_preferences.with_raw_response.create( name="Account Notifications", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = await response.parse() - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + workspace_preference = await response.parse() + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_create(self, async_client: AsyncCourier) -> None: - async with async_client.preference_sections.with_streaming_response.create( + async with async_client.workspace_preferences.with_streaming_response.create( name="Account Notifications", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = await response.parse() - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + workspace_preference = await response.parse() + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_retrieve(self, async_client: AsyncCourier) -> None: - preference_section = await async_client.preference_sections.retrieve( + workspace_preference = await async_client.workspace_preferences.retrieve( "section_id", ) - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_retrieve(self, async_client: AsyncCourier) -> None: - response = await async_client.preference_sections.with_raw_response.retrieve( + response = await async_client.workspace_preferences.with_raw_response.retrieve( "section_id", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = await response.parse() - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + workspace_preference = await response.parse() + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncCourier) -> None: - async with async_client.preference_sections.with_streaming_response.retrieve( + async with async_client.workspace_preferences.with_streaming_response.retrieve( "section_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = await response.parse() - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + workspace_preference = await response.parse() + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) assert cast(Any, response.is_closed) is True @@ -350,69 +350,69 @@ async def test_streaming_response_retrieve(self, async_client: AsyncCourier) -> @parametrize async def test_path_params_retrieve(self, async_client: AsyncCourier) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `section_id` but received ''"): - await async_client.preference_sections.with_raw_response.retrieve( + await async_client.workspace_preferences.with_raw_response.retrieve( "", ) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list(self, async_client: AsyncCourier) -> None: - preference_section = await async_client.preference_sections.list() - assert_matches_type(PreferenceSectionListResponse, preference_section, path=["response"]) + workspace_preference = await async_client.workspace_preferences.list() + assert_matches_type(WorkspacePreferenceListResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_list(self, async_client: AsyncCourier) -> None: - response = await async_client.preference_sections.with_raw_response.list() + response = await async_client.workspace_preferences.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = await response.parse() - assert_matches_type(PreferenceSectionListResponse, preference_section, path=["response"]) + workspace_preference = await response.parse() + assert_matches_type(WorkspacePreferenceListResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_list(self, async_client: AsyncCourier) -> None: - async with async_client.preference_sections.with_streaming_response.list() as response: + async with async_client.workspace_preferences.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = await response.parse() - assert_matches_type(PreferenceSectionListResponse, preference_section, path=["response"]) + workspace_preference = await response.parse() + assert_matches_type(WorkspacePreferenceListResponse, workspace_preference, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_archive(self, async_client: AsyncCourier) -> None: - preference_section = await async_client.preference_sections.archive( + workspace_preference = await async_client.workspace_preferences.archive( "section_id", ) - assert preference_section is None + assert workspace_preference is None @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_archive(self, async_client: AsyncCourier) -> None: - response = await async_client.preference_sections.with_raw_response.archive( + response = await async_client.workspace_preferences.with_raw_response.archive( "section_id", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = await response.parse() - assert preference_section is None + workspace_preference = await response.parse() + assert workspace_preference is None @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_archive(self, async_client: AsyncCourier) -> None: - async with async_client.preference_sections.with_streaming_response.archive( + async with async_client.workspace_preferences.with_streaming_response.archive( "section_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = await response.parse() - assert preference_section is None + workspace_preference = await response.parse() + assert workspace_preference is None assert cast(Any, response.is_closed) is True @@ -420,83 +420,83 @@ async def test_streaming_response_archive(self, async_client: AsyncCourier) -> N @parametrize async def test_path_params_archive(self, async_client: AsyncCourier) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `section_id` but received ''"): - await async_client.preference_sections.with_raw_response.archive( + await async_client.workspace_preferences.with_raw_response.archive( "", ) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_publish(self, async_client: AsyncCourier) -> None: - preference_section = await async_client.preference_sections.publish() - assert_matches_type(PublishPreferencesResponse, preference_section, path=["response"]) + workspace_preference = await async_client.workspace_preferences.publish() + assert_matches_type(PublishPreferencesResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_publish(self, async_client: AsyncCourier) -> None: - response = await async_client.preference_sections.with_raw_response.publish() + response = await async_client.workspace_preferences.with_raw_response.publish() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = await response.parse() - assert_matches_type(PublishPreferencesResponse, preference_section, path=["response"]) + workspace_preference = await response.parse() + assert_matches_type(PublishPreferencesResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_publish(self, async_client: AsyncCourier) -> None: - async with async_client.preference_sections.with_streaming_response.publish() as response: + async with async_client.workspace_preferences.with_streaming_response.publish() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = await response.parse() - assert_matches_type(PublishPreferencesResponse, preference_section, path=["response"]) + workspace_preference = await response.parse() + assert_matches_type(PublishPreferencesResponse, workspace_preference, path=["response"]) assert cast(Any, response.is_closed) is True @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_replace(self, async_client: AsyncCourier) -> None: - preference_section = await async_client.preference_sections.replace( + workspace_preference = await async_client.workspace_preferences.replace( section_id="section_id", name="name", ) - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_replace_with_all_params(self, async_client: AsyncCourier) -> None: - preference_section = await async_client.preference_sections.replace( + workspace_preference = await async_client.workspace_preferences.replace( section_id="section_id", name="name", has_custom_routing=True, routing_options=["direct_message"], ) - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_replace(self, async_client: AsyncCourier) -> None: - response = await async_client.preference_sections.with_raw_response.replace( + response = await async_client.workspace_preferences.with_raw_response.replace( section_id="section_id", name="name", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = await response.parse() - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + workspace_preference = await response.parse() + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_replace(self, async_client: AsyncCourier) -> None: - async with async_client.preference_sections.with_streaming_response.replace( + async with async_client.workspace_preferences.with_streaming_response.replace( section_id="section_id", name="name", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - preference_section = await response.parse() - assert_matches_type(PreferenceSectionGetResponse, preference_section, path=["response"]) + workspace_preference = await response.parse() + assert_matches_type(WorkspacePreferenceGetResponse, workspace_preference, path=["response"]) assert cast(Any, response.is_closed) is True @@ -504,7 +504,7 @@ async def test_streaming_response_replace(self, async_client: AsyncCourier) -> N @parametrize async def test_path_params_replace(self, async_client: AsyncCourier) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `section_id` but received ''"): - await async_client.preference_sections.with_raw_response.replace( + await async_client.workspace_preferences.with_raw_response.replace( section_id="", name="name", ) diff --git a/tests/api_resources/preference_sections/__init__.py b/tests/api_resources/workspace_preferences/__init__.py similarity index 100% rename from tests/api_resources/preference_sections/__init__.py rename to tests/api_resources/workspace_preferences/__init__.py diff --git a/tests/api_resources/preference_sections/test_topics.py b/tests/api_resources/workspace_preferences/test_topics.py similarity index 74% rename from tests/api_resources/preference_sections/test_topics.py rename to tests/api_resources/workspace_preferences/test_topics.py index 1317fd4..5a94444 100644 --- a/tests/api_resources/preference_sections/test_topics.py +++ b/tests/api_resources/workspace_preferences/test_topics.py @@ -9,7 +9,7 @@ from courier import Courier, AsyncCourier from tests.utils import assert_matches_type -from courier.types import PreferenceTopicGetResponse, PreferenceTopicListResponse +from courier.types import WorkspacePreferenceTopicGetResponse, WorkspacePreferenceTopicListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,17 +20,17 @@ class TestTopics: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_create(self, client: Courier) -> None: - topic = client.preference_sections.topics.create( + topic = client.workspace_preferences.topics.create( section_id="section_id", default_status="OPTED_OUT", name="Marketing", ) - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_create_with_all_params(self, client: Courier) -> None: - topic = client.preference_sections.topics.create( + topic = client.workspace_preferences.topics.create( section_id="section_id", default_status="OPTED_OUT", name="Marketing", @@ -39,12 +39,12 @@ def test_method_create_with_all_params(self, client: Courier) -> None: routing_options=["direct_message"], topic_data={"foo": "bar"}, ) - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_create(self, client: Courier) -> None: - response = client.preference_sections.topics.with_raw_response.create( + response = client.workspace_preferences.topics.with_raw_response.create( section_id="section_id", default_status="OPTED_OUT", name="Marketing", @@ -53,12 +53,12 @@ def test_raw_response_create(self, client: Courier) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" topic = response.parse() - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_create(self, client: Courier) -> None: - with client.preference_sections.topics.with_streaming_response.create( + with client.workspace_preferences.topics.with_streaming_response.create( section_id="section_id", default_status="OPTED_OUT", name="Marketing", @@ -67,7 +67,7 @@ def test_streaming_response_create(self, client: Courier) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" topic = response.parse() - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) assert cast(Any, response.is_closed) is True @@ -75,7 +75,7 @@ def test_streaming_response_create(self, client: Courier) -> None: @parametrize def test_path_params_create(self, client: Courier) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `section_id` but received ''"): - client.preference_sections.topics.with_raw_response.create( + client.workspace_preferences.topics.with_raw_response.create( section_id="", default_status="OPTED_OUT", name="Marketing", @@ -84,16 +84,16 @@ def test_path_params_create(self, client: Courier) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_retrieve(self, client: Courier) -> None: - topic = client.preference_sections.topics.retrieve( + topic = client.workspace_preferences.topics.retrieve( topic_id="topic_id", section_id="section_id", ) - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_retrieve(self, client: Courier) -> None: - response = client.preference_sections.topics.with_raw_response.retrieve( + response = client.workspace_preferences.topics.with_raw_response.retrieve( topic_id="topic_id", section_id="section_id", ) @@ -101,12 +101,12 @@ def test_raw_response_retrieve(self, client: Courier) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" topic = response.parse() - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_retrieve(self, client: Courier) -> None: - with client.preference_sections.topics.with_streaming_response.retrieve( + with client.workspace_preferences.topics.with_streaming_response.retrieve( topic_id="topic_id", section_id="section_id", ) as response: @@ -114,7 +114,7 @@ def test_streaming_response_retrieve(self, client: Courier) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" topic = response.parse() - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) assert cast(Any, response.is_closed) is True @@ -122,13 +122,13 @@ def test_streaming_response_retrieve(self, client: Courier) -> None: @parametrize def test_path_params_retrieve(self, client: Courier) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `section_id` but received ''"): - client.preference_sections.topics.with_raw_response.retrieve( + client.workspace_preferences.topics.with_raw_response.retrieve( topic_id="topic_id", section_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `topic_id` but received ''"): - client.preference_sections.topics.with_raw_response.retrieve( + client.workspace_preferences.topics.with_raw_response.retrieve( topic_id="", section_id="section_id", ) @@ -136,34 +136,34 @@ def test_path_params_retrieve(self, client: Courier) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list(self, client: Courier) -> None: - topic = client.preference_sections.topics.list( + topic = client.workspace_preferences.topics.list( "section_id", ) - assert_matches_type(PreferenceTopicListResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicListResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_list(self, client: Courier) -> None: - response = client.preference_sections.topics.with_raw_response.list( + response = client.workspace_preferences.topics.with_raw_response.list( "section_id", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" topic = response.parse() - assert_matches_type(PreferenceTopicListResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicListResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_list(self, client: Courier) -> None: - with client.preference_sections.topics.with_streaming_response.list( + with client.workspace_preferences.topics.with_streaming_response.list( "section_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" topic = response.parse() - assert_matches_type(PreferenceTopicListResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicListResponse, topic, path=["response"]) assert cast(Any, response.is_closed) is True @@ -171,14 +171,14 @@ def test_streaming_response_list(self, client: Courier) -> None: @parametrize def test_path_params_list(self, client: Courier) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `section_id` but received ''"): - client.preference_sections.topics.with_raw_response.list( + client.workspace_preferences.topics.with_raw_response.list( "", ) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_archive(self, client: Courier) -> None: - topic = client.preference_sections.topics.archive( + topic = client.workspace_preferences.topics.archive( topic_id="topic_id", section_id="section_id", ) @@ -187,7 +187,7 @@ def test_method_archive(self, client: Courier) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_archive(self, client: Courier) -> None: - response = client.preference_sections.topics.with_raw_response.archive( + response = client.workspace_preferences.topics.with_raw_response.archive( topic_id="topic_id", section_id="section_id", ) @@ -200,7 +200,7 @@ def test_raw_response_archive(self, client: Courier) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_archive(self, client: Courier) -> None: - with client.preference_sections.topics.with_streaming_response.archive( + with client.workspace_preferences.topics.with_streaming_response.archive( topic_id="topic_id", section_id="section_id", ) as response: @@ -216,13 +216,13 @@ def test_streaming_response_archive(self, client: Courier) -> None: @parametrize def test_path_params_archive(self, client: Courier) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `section_id` but received ''"): - client.preference_sections.topics.with_raw_response.archive( + client.workspace_preferences.topics.with_raw_response.archive( topic_id="topic_id", section_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `topic_id` but received ''"): - client.preference_sections.topics.with_raw_response.archive( + client.workspace_preferences.topics.with_raw_response.archive( topic_id="", section_id="section_id", ) @@ -230,18 +230,18 @@ def test_path_params_archive(self, client: Courier) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_replace(self, client: Courier) -> None: - topic = client.preference_sections.topics.replace( + topic = client.workspace_preferences.topics.replace( topic_id="topic_id", section_id="section_id", default_status="OPTED_OUT", name="name", ) - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_replace_with_all_params(self, client: Courier) -> None: - topic = client.preference_sections.topics.replace( + topic = client.workspace_preferences.topics.replace( topic_id="topic_id", section_id="section_id", default_status="OPTED_OUT", @@ -251,12 +251,12 @@ def test_method_replace_with_all_params(self, client: Courier) -> None: routing_options=["direct_message"], topic_data={"foo": "bar"}, ) - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_replace(self, client: Courier) -> None: - response = client.preference_sections.topics.with_raw_response.replace( + response = client.workspace_preferences.topics.with_raw_response.replace( topic_id="topic_id", section_id="section_id", default_status="OPTED_OUT", @@ -266,12 +266,12 @@ def test_raw_response_replace(self, client: Courier) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" topic = response.parse() - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_replace(self, client: Courier) -> None: - with client.preference_sections.topics.with_streaming_response.replace( + with client.workspace_preferences.topics.with_streaming_response.replace( topic_id="topic_id", section_id="section_id", default_status="OPTED_OUT", @@ -281,7 +281,7 @@ def test_streaming_response_replace(self, client: Courier) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" topic = response.parse() - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) assert cast(Any, response.is_closed) is True @@ -289,7 +289,7 @@ def test_streaming_response_replace(self, client: Courier) -> None: @parametrize def test_path_params_replace(self, client: Courier) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `section_id` but received ''"): - client.preference_sections.topics.with_raw_response.replace( + client.workspace_preferences.topics.with_raw_response.replace( topic_id="topic_id", section_id="", default_status="OPTED_OUT", @@ -297,7 +297,7 @@ def test_path_params_replace(self, client: Courier) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `topic_id` but received ''"): - client.preference_sections.topics.with_raw_response.replace( + client.workspace_preferences.topics.with_raw_response.replace( topic_id="", section_id="section_id", default_status="OPTED_OUT", @@ -313,17 +313,17 @@ class TestAsyncTopics: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_create(self, async_client: AsyncCourier) -> None: - topic = await async_client.preference_sections.topics.create( + topic = await async_client.workspace_preferences.topics.create( section_id="section_id", default_status="OPTED_OUT", name="Marketing", ) - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_create_with_all_params(self, async_client: AsyncCourier) -> None: - topic = await async_client.preference_sections.topics.create( + topic = await async_client.workspace_preferences.topics.create( section_id="section_id", default_status="OPTED_OUT", name="Marketing", @@ -332,12 +332,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncCourier) - routing_options=["direct_message"], topic_data={"foo": "bar"}, ) - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_create(self, async_client: AsyncCourier) -> None: - response = await async_client.preference_sections.topics.with_raw_response.create( + response = await async_client.workspace_preferences.topics.with_raw_response.create( section_id="section_id", default_status="OPTED_OUT", name="Marketing", @@ -346,12 +346,12 @@ async def test_raw_response_create(self, async_client: AsyncCourier) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" topic = await response.parse() - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_create(self, async_client: AsyncCourier) -> None: - async with async_client.preference_sections.topics.with_streaming_response.create( + async with async_client.workspace_preferences.topics.with_streaming_response.create( section_id="section_id", default_status="OPTED_OUT", name="Marketing", @@ -360,7 +360,7 @@ async def test_streaming_response_create(self, async_client: AsyncCourier) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" topic = await response.parse() - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) assert cast(Any, response.is_closed) is True @@ -368,7 +368,7 @@ async def test_streaming_response_create(self, async_client: AsyncCourier) -> No @parametrize async def test_path_params_create(self, async_client: AsyncCourier) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `section_id` but received ''"): - await async_client.preference_sections.topics.with_raw_response.create( + await async_client.workspace_preferences.topics.with_raw_response.create( section_id="", default_status="OPTED_OUT", name="Marketing", @@ -377,16 +377,16 @@ async def test_path_params_create(self, async_client: AsyncCourier) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_retrieve(self, async_client: AsyncCourier) -> None: - topic = await async_client.preference_sections.topics.retrieve( + topic = await async_client.workspace_preferences.topics.retrieve( topic_id="topic_id", section_id="section_id", ) - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_retrieve(self, async_client: AsyncCourier) -> None: - response = await async_client.preference_sections.topics.with_raw_response.retrieve( + response = await async_client.workspace_preferences.topics.with_raw_response.retrieve( topic_id="topic_id", section_id="section_id", ) @@ -394,12 +394,12 @@ async def test_raw_response_retrieve(self, async_client: AsyncCourier) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" topic = await response.parse() - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncCourier) -> None: - async with async_client.preference_sections.topics.with_streaming_response.retrieve( + async with async_client.workspace_preferences.topics.with_streaming_response.retrieve( topic_id="topic_id", section_id="section_id", ) as response: @@ -407,7 +407,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncCourier) -> assert response.http_request.headers.get("X-Stainless-Lang") == "python" topic = await response.parse() - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) assert cast(Any, response.is_closed) is True @@ -415,13 +415,13 @@ async def test_streaming_response_retrieve(self, async_client: AsyncCourier) -> @parametrize async def test_path_params_retrieve(self, async_client: AsyncCourier) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `section_id` but received ''"): - await async_client.preference_sections.topics.with_raw_response.retrieve( + await async_client.workspace_preferences.topics.with_raw_response.retrieve( topic_id="topic_id", section_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `topic_id` but received ''"): - await async_client.preference_sections.topics.with_raw_response.retrieve( + await async_client.workspace_preferences.topics.with_raw_response.retrieve( topic_id="", section_id="section_id", ) @@ -429,34 +429,34 @@ async def test_path_params_retrieve(self, async_client: AsyncCourier) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list(self, async_client: AsyncCourier) -> None: - topic = await async_client.preference_sections.topics.list( + topic = await async_client.workspace_preferences.topics.list( "section_id", ) - assert_matches_type(PreferenceTopicListResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicListResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_list(self, async_client: AsyncCourier) -> None: - response = await async_client.preference_sections.topics.with_raw_response.list( + response = await async_client.workspace_preferences.topics.with_raw_response.list( "section_id", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" topic = await response.parse() - assert_matches_type(PreferenceTopicListResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicListResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_list(self, async_client: AsyncCourier) -> None: - async with async_client.preference_sections.topics.with_streaming_response.list( + async with async_client.workspace_preferences.topics.with_streaming_response.list( "section_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" topic = await response.parse() - assert_matches_type(PreferenceTopicListResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicListResponse, topic, path=["response"]) assert cast(Any, response.is_closed) is True @@ -464,14 +464,14 @@ async def test_streaming_response_list(self, async_client: AsyncCourier) -> None @parametrize async def test_path_params_list(self, async_client: AsyncCourier) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `section_id` but received ''"): - await async_client.preference_sections.topics.with_raw_response.list( + await async_client.workspace_preferences.topics.with_raw_response.list( "", ) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_archive(self, async_client: AsyncCourier) -> None: - topic = await async_client.preference_sections.topics.archive( + topic = await async_client.workspace_preferences.topics.archive( topic_id="topic_id", section_id="section_id", ) @@ -480,7 +480,7 @@ async def test_method_archive(self, async_client: AsyncCourier) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_archive(self, async_client: AsyncCourier) -> None: - response = await async_client.preference_sections.topics.with_raw_response.archive( + response = await async_client.workspace_preferences.topics.with_raw_response.archive( topic_id="topic_id", section_id="section_id", ) @@ -493,7 +493,7 @@ async def test_raw_response_archive(self, async_client: AsyncCourier) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_archive(self, async_client: AsyncCourier) -> None: - async with async_client.preference_sections.topics.with_streaming_response.archive( + async with async_client.workspace_preferences.topics.with_streaming_response.archive( topic_id="topic_id", section_id="section_id", ) as response: @@ -509,13 +509,13 @@ async def test_streaming_response_archive(self, async_client: AsyncCourier) -> N @parametrize async def test_path_params_archive(self, async_client: AsyncCourier) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `section_id` but received ''"): - await async_client.preference_sections.topics.with_raw_response.archive( + await async_client.workspace_preferences.topics.with_raw_response.archive( topic_id="topic_id", section_id="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `topic_id` but received ''"): - await async_client.preference_sections.topics.with_raw_response.archive( + await async_client.workspace_preferences.topics.with_raw_response.archive( topic_id="", section_id="section_id", ) @@ -523,18 +523,18 @@ async def test_path_params_archive(self, async_client: AsyncCourier) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_replace(self, async_client: AsyncCourier) -> None: - topic = await async_client.preference_sections.topics.replace( + topic = await async_client.workspace_preferences.topics.replace( topic_id="topic_id", section_id="section_id", default_status="OPTED_OUT", name="name", ) - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_replace_with_all_params(self, async_client: AsyncCourier) -> None: - topic = await async_client.preference_sections.topics.replace( + topic = await async_client.workspace_preferences.topics.replace( topic_id="topic_id", section_id="section_id", default_status="OPTED_OUT", @@ -544,12 +544,12 @@ async def test_method_replace_with_all_params(self, async_client: AsyncCourier) routing_options=["direct_message"], topic_data={"foo": "bar"}, ) - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_replace(self, async_client: AsyncCourier) -> None: - response = await async_client.preference_sections.topics.with_raw_response.replace( + response = await async_client.workspace_preferences.topics.with_raw_response.replace( topic_id="topic_id", section_id="section_id", default_status="OPTED_OUT", @@ -559,12 +559,12 @@ async def test_raw_response_replace(self, async_client: AsyncCourier) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" topic = await response.parse() - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_replace(self, async_client: AsyncCourier) -> None: - async with async_client.preference_sections.topics.with_streaming_response.replace( + async with async_client.workspace_preferences.topics.with_streaming_response.replace( topic_id="topic_id", section_id="section_id", default_status="OPTED_OUT", @@ -574,7 +574,7 @@ async def test_streaming_response_replace(self, async_client: AsyncCourier) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" topic = await response.parse() - assert_matches_type(PreferenceTopicGetResponse, topic, path=["response"]) + assert_matches_type(WorkspacePreferenceTopicGetResponse, topic, path=["response"]) assert cast(Any, response.is_closed) is True @@ -582,7 +582,7 @@ async def test_streaming_response_replace(self, async_client: AsyncCourier) -> N @parametrize async def test_path_params_replace(self, async_client: AsyncCourier) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `section_id` but received ''"): - await async_client.preference_sections.topics.with_raw_response.replace( + await async_client.workspace_preferences.topics.with_raw_response.replace( topic_id="topic_id", section_id="", default_status="OPTED_OUT", @@ -590,7 +590,7 @@ async def test_path_params_replace(self, async_client: AsyncCourier) -> None: ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `topic_id` but received ''"): - await async_client.preference_sections.topics.with_raw_response.replace( + await async_client.workspace_preferences.topics.with_raw_response.replace( topic_id="", section_id="section_id", default_status="OPTED_OUT",