# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations from typing_extensions import Literal import httpx from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import path_template, maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( to_raw_response_wrapper, to_streamed_response_wrapper, async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) from ....pagination import SyncDefaultFlatPagination, AsyncDefaultFlatPagination from ...._base_client import AsyncPaginator, make_request_options from .calling_routing import ( CallingRoutingResource, AsyncCallingRoutingResource, CallingRoutingResourceWithRawResponse, AsyncCallingRoutingResourceWithRawResponse, CallingRoutingResourceWithStreamingResponse, AsyncCallingRoutingResourceWithStreamingResponse, ) from .profile.profile import ( ProfileResource, AsyncProfileResource, ProfileResourceWithRawResponse, AsyncProfileResourceWithRawResponse, ProfileResourceWithStreamingResponse, AsyncProfileResourceWithStreamingResponse, ) from .calling_settings import ( CallingSettingsResource, AsyncCallingSettingsResource, CallingSettingsResourceWithRawResponse, AsyncCallingSettingsResourceWithRawResponse, CallingSettingsResourceWithStreamingResponse, AsyncCallingSettingsResourceWithStreamingResponse, ) from ....types.whatsapp import ( phone_number_get_params, phone_number_list_params, phone_number_verify_params, phone_number_resend_verification_params, phone_number_retrieve_conversation_window_params, ) from .conversational_components import ( ConversationalComponentsResource, AsyncConversationalComponentsResource, ConversationalComponentsResourceWithRawResponse, AsyncConversationalComponentsResourceWithRawResponse, ConversationalComponentsResourceWithStreamingResponse, AsyncConversationalComponentsResourceWithStreamingResponse, ) from ....types.whatsapp.whatsapp_phone_response import WhatsappPhoneResponse from ....types.whatsapp.phone_number_get_response import PhoneNumberGetResponse from ....types.whatsapp.phone_number_retrieve_phone_number_response import PhoneNumberRetrievePhoneNumberResponse from ....types.whatsapp.phone_number_retrieve_conversation_window_response import ( PhoneNumberRetrieveConversationWindowResponse, ) __all__ = ["PhoneNumbersResource", "AsyncPhoneNumbersResource"] class PhoneNumbersResource(SyncAPIResource): """Manage Whatsapp phone numbers""" @cached_property def calling_settings(self) -> CallingSettingsResource: """Manage Whatsapp phone numbers""" return CallingSettingsResource(self._client) @cached_property def profile(self) -> ProfileResource: """Manage Whatsapp phone numbers""" return ProfileResource(self._client) @cached_property def conversational_components(self) -> ConversationalComponentsResource: """Manage Whatsapp phone numbers""" return ConversationalComponentsResource(self._client) @cached_property def calling_routing(self) -> CallingRoutingResource: """Manage Whatsapp phone numbers""" return CallingRoutingResource(self._client) @cached_property def with_raw_response(self) -> PhoneNumbersResourceWithRawResponse: """ 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/team-telnyx/telnyx-python#accessing-raw-response-data-eg-headers """ return PhoneNumbersResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> PhoneNumbersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/team-telnyx/telnyx-python#with_streaming_response """ return PhoneNumbersResourceWithStreamingResponse(self) def list( self, *, page_number: int | Omit = omit, page_size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncDefaultFlatPagination[WhatsappPhoneResponse]: """ Returns WhatsApp phone numbers linked to the authenticated Telnyx account. Args: extra_headers: Send extra headers extra_query: Add additional query parameters to the request extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( "/v2/whatsapp/phone_numbers", page=SyncDefaultFlatPagination[WhatsappPhoneResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform( { "page_number": page_number, "page_size": page_size, }, phone_number_list_params.PhoneNumberListParams, ), ), model=WhatsappPhoneResponse, ) def delete( self, phone_number: str, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Removes the specified phone number from Telnyx WhatsApp management. Args: extra_headers: Send extra headers extra_query: Add additional query parameters to the request extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds """ if not phone_number: raise ValueError(f"Expected a non-empty value for `phone_number` but received {phone_number!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( path_template("/v2/whatsapp/phone_numbers/{phone_number}", phone_number=phone_number), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=NoneType, ) def get( self, *, page_number: int | Omit = omit, page_size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PhoneNumberGetResponse: """ Retrieve a list of the phone numbers registered for WhatsApp on your account. Args: extra_headers: Send extra headers extra_query: Add additional query parameters to the request extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds """ return self._get( "/whatsapp/phone_numbers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform( { "page_number": page_number, "page_size": page_size, }, phone_number_get_params.PhoneNumberGetParams, ), ), cast_to=PhoneNumberGetResponse, ) def resend_verification( self, phone_number: str, *, verification_method: Literal["sms", "voice"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Requests a new verification code for the specified WhatsApp phone number. Args: extra_headers: Send extra headers extra_query: Add additional query parameters to the request extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds """ if not phone_number: raise ValueError(f"Expected a non-empty value for `phone_number` but received {phone_number!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( path_template("/v2/whatsapp/phone_numbers/{phone_number}/resend_verification", phone_number=phone_number), body=maybe_transform( {"verification_method": verification_method}, phone_number_resend_verification_params.PhoneNumberResendVerificationParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=NoneType, ) def retrieve_conversation_window( self, phone_number: str, *, destination_number: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PhoneNumberRetrieveConversationWindowResponse: """ Returns whether the 24-hour conversation window is currently open for a given source/destination pair. If window_active is false, only template messages may be sent. Args: destination_number: Destination phone number in E.164 format extra_headers: Send extra headers extra_query: Add additional query parameters to the request extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds """ if not phone_number: raise ValueError(f"Expected a non-empty value for `phone_number` but received {phone_number!r}") return self._get( path_template("/v2/whatsapp/phone_numbers/{phone_number}/conversation_window", phone_number=phone_number), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform( {"destination_number": destination_number}, phone_number_retrieve_conversation_window_params.PhoneNumberRetrieveConversationWindowParams, ), ), cast_to=PhoneNumberRetrieveConversationWindowResponse, ) def retrieve_phone_number( self, phone_number: str, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PhoneNumberRetrievePhoneNumberResponse: """ Returns one WhatsApp phone number linked to the authenticated Telnyx account. For a coexistence number in the `syncing` state, the response includes `sync_progress`. Args: extra_headers: Send extra headers extra_query: Add additional query parameters to the request extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds """ if not phone_number: raise ValueError(f"Expected a non-empty value for `phone_number` but received {phone_number!r}") return self._get( path_template("/whatsapp/phone_numbers/{phone_number}", phone_number=phone_number), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=PhoneNumberRetrievePhoneNumberResponse, ) def verify( self, phone_number: str, *, code: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Submits the verification code received for the specified WhatsApp phone number. Args: extra_headers: Send extra headers extra_query: Add additional query parameters to the request extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds """ if not phone_number: raise ValueError(f"Expected a non-empty value for `phone_number` but received {phone_number!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( path_template("/v2/whatsapp/phone_numbers/{phone_number}/verify", phone_number=phone_number), body=maybe_transform({"code": code}, phone_number_verify_params.PhoneNumberVerifyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=NoneType, ) class AsyncPhoneNumbersResource(AsyncAPIResource): """Manage Whatsapp phone numbers""" @cached_property def calling_settings(self) -> AsyncCallingSettingsResource: """Manage Whatsapp phone numbers""" return AsyncCallingSettingsResource(self._client) @cached_property def profile(self) -> AsyncProfileResource: """Manage Whatsapp phone numbers""" return AsyncProfileResource(self._client) @cached_property def conversational_components(self) -> AsyncConversationalComponentsResource: """Manage Whatsapp phone numbers""" return AsyncConversationalComponentsResource(self._client) @cached_property def calling_routing(self) -> AsyncCallingRoutingResource: """Manage Whatsapp phone numbers""" return AsyncCallingRoutingResource(self._client) @cached_property def with_raw_response(self) -> AsyncPhoneNumbersResourceWithRawResponse: """ 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/team-telnyx/telnyx-python#accessing-raw-response-data-eg-headers """ return AsyncPhoneNumbersResourceWithRawResponse(self) @cached_property def with_streaming_response(self) -> AsyncPhoneNumbersResourceWithStreamingResponse: """ An alternative to `.with_raw_response` that doesn't eagerly read the response body. For more information, see https://www.github.com/team-telnyx/telnyx-python#with_streaming_response """ return AsyncPhoneNumbersResourceWithStreamingResponse(self) def list( self, *, page_number: int | Omit = omit, page_size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WhatsappPhoneResponse, AsyncDefaultFlatPagination[WhatsappPhoneResponse]]: """ Returns WhatsApp phone numbers linked to the authenticated Telnyx account. Args: extra_headers: Send extra headers extra_query: Add additional query parameters to the request extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds """ return self._get_api_list( "/v2/whatsapp/phone_numbers", page=AsyncDefaultFlatPagination[WhatsappPhoneResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform( { "page_number": page_number, "page_size": page_size, }, phone_number_list_params.PhoneNumberListParams, ), ), model=WhatsappPhoneResponse, ) async def delete( self, phone_number: str, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Removes the specified phone number from Telnyx WhatsApp management. Args: extra_headers: Send extra headers extra_query: Add additional query parameters to the request extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds """ if not phone_number: raise ValueError(f"Expected a non-empty value for `phone_number` but received {phone_number!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( path_template("/v2/whatsapp/phone_numbers/{phone_number}", phone_number=phone_number), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=NoneType, ) async def get( self, *, page_number: int | Omit = omit, page_size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PhoneNumberGetResponse: """ Retrieve a list of the phone numbers registered for WhatsApp on your account. Args: extra_headers: Send extra headers extra_query: Add additional query parameters to the request extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds """ return await self._get( "/whatsapp/phone_numbers", options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform( { "page_number": page_number, "page_size": page_size, }, phone_number_get_params.PhoneNumberGetParams, ), ), cast_to=PhoneNumberGetResponse, ) async def resend_verification( self, phone_number: str, *, verification_method: Literal["sms", "voice"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Requests a new verification code for the specified WhatsApp phone number. Args: extra_headers: Send extra headers extra_query: Add additional query parameters to the request extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds """ if not phone_number: raise ValueError(f"Expected a non-empty value for `phone_number` but received {phone_number!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( path_template("/v2/whatsapp/phone_numbers/{phone_number}/resend_verification", phone_number=phone_number), body=await async_maybe_transform( {"verification_method": verification_method}, phone_number_resend_verification_params.PhoneNumberResendVerificationParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=NoneType, ) async def retrieve_conversation_window( self, phone_number: str, *, destination_number: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PhoneNumberRetrieveConversationWindowResponse: """ Returns whether the 24-hour conversation window is currently open for a given source/destination pair. If window_active is false, only template messages may be sent. Args: destination_number: Destination phone number in E.164 format extra_headers: Send extra headers extra_query: Add additional query parameters to the request extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds """ if not phone_number: raise ValueError(f"Expected a non-empty value for `phone_number` but received {phone_number!r}") return await self._get( path_template("/v2/whatsapp/phone_numbers/{phone_number}/conversation_window", phone_number=phone_number), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform( {"destination_number": destination_number}, phone_number_retrieve_conversation_window_params.PhoneNumberRetrieveConversationWindowParams, ), ), cast_to=PhoneNumberRetrieveConversationWindowResponse, ) async def retrieve_phone_number( self, phone_number: str, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PhoneNumberRetrievePhoneNumberResponse: """ Returns one WhatsApp phone number linked to the authenticated Telnyx account. For a coexistence number in the `syncing` state, the response includes `sync_progress`. Args: extra_headers: Send extra headers extra_query: Add additional query parameters to the request extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds """ if not phone_number: raise ValueError(f"Expected a non-empty value for `phone_number` but received {phone_number!r}") return await self._get( path_template("/whatsapp/phone_numbers/{phone_number}", phone_number=phone_number), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=PhoneNumberRetrievePhoneNumberResponse, ) async def verify( self, phone_number: str, *, code: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Submits the verification code received for the specified WhatsApp phone number. Args: extra_headers: Send extra headers extra_query: Add additional query parameters to the request extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds """ if not phone_number: raise ValueError(f"Expected a non-empty value for `phone_number` but received {phone_number!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( path_template("/v2/whatsapp/phone_numbers/{phone_number}/verify", phone_number=phone_number), body=await async_maybe_transform({"code": code}, phone_number_verify_params.PhoneNumberVerifyParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=NoneType, ) class PhoneNumbersResourceWithRawResponse: def __init__(self, phone_numbers: PhoneNumbersResource) -> None: self._phone_numbers = phone_numbers self.list = to_raw_response_wrapper( phone_numbers.list, ) self.delete = to_raw_response_wrapper( phone_numbers.delete, ) self.get = to_raw_response_wrapper( phone_numbers.get, ) self.resend_verification = to_raw_response_wrapper( phone_numbers.resend_verification, ) self.retrieve_conversation_window = to_raw_response_wrapper( phone_numbers.retrieve_conversation_window, ) self.retrieve_phone_number = to_raw_response_wrapper( phone_numbers.retrieve_phone_number, ) self.verify = to_raw_response_wrapper( phone_numbers.verify, ) @cached_property def calling_settings(self) -> CallingSettingsResourceWithRawResponse: """Manage Whatsapp phone numbers""" return CallingSettingsResourceWithRawResponse(self._phone_numbers.calling_settings) @cached_property def profile(self) -> ProfileResourceWithRawResponse: """Manage Whatsapp phone numbers""" return ProfileResourceWithRawResponse(self._phone_numbers.profile) @cached_property def conversational_components(self) -> ConversationalComponentsResourceWithRawResponse: """Manage Whatsapp phone numbers""" return ConversationalComponentsResourceWithRawResponse(self._phone_numbers.conversational_components) @cached_property def calling_routing(self) -> CallingRoutingResourceWithRawResponse: """Manage Whatsapp phone numbers""" return CallingRoutingResourceWithRawResponse(self._phone_numbers.calling_routing) class AsyncPhoneNumbersResourceWithRawResponse: def __init__(self, phone_numbers: AsyncPhoneNumbersResource) -> None: self._phone_numbers = phone_numbers self.list = async_to_raw_response_wrapper( phone_numbers.list, ) self.delete = async_to_raw_response_wrapper( phone_numbers.delete, ) self.get = async_to_raw_response_wrapper( phone_numbers.get, ) self.resend_verification = async_to_raw_response_wrapper( phone_numbers.resend_verification, ) self.retrieve_conversation_window = async_to_raw_response_wrapper( phone_numbers.retrieve_conversation_window, ) self.retrieve_phone_number = async_to_raw_response_wrapper( phone_numbers.retrieve_phone_number, ) self.verify = async_to_raw_response_wrapper( phone_numbers.verify, ) @cached_property def calling_settings(self) -> AsyncCallingSettingsResourceWithRawResponse: """Manage Whatsapp phone numbers""" return AsyncCallingSettingsResourceWithRawResponse(self._phone_numbers.calling_settings) @cached_property def profile(self) -> AsyncProfileResourceWithRawResponse: """Manage Whatsapp phone numbers""" return AsyncProfileResourceWithRawResponse(self._phone_numbers.profile) @cached_property def conversational_components(self) -> AsyncConversationalComponentsResourceWithRawResponse: """Manage Whatsapp phone numbers""" return AsyncConversationalComponentsResourceWithRawResponse(self._phone_numbers.conversational_components) @cached_property def calling_routing(self) -> AsyncCallingRoutingResourceWithRawResponse: """Manage Whatsapp phone numbers""" return AsyncCallingRoutingResourceWithRawResponse(self._phone_numbers.calling_routing) class PhoneNumbersResourceWithStreamingResponse: def __init__(self, phone_numbers: PhoneNumbersResource) -> None: self._phone_numbers = phone_numbers self.list = to_streamed_response_wrapper( phone_numbers.list, ) self.delete = to_streamed_response_wrapper( phone_numbers.delete, ) self.get = to_streamed_response_wrapper( phone_numbers.get, ) self.resend_verification = to_streamed_response_wrapper( phone_numbers.resend_verification, ) self.retrieve_conversation_window = to_streamed_response_wrapper( phone_numbers.retrieve_conversation_window, ) self.retrieve_phone_number = to_streamed_response_wrapper( phone_numbers.retrieve_phone_number, ) self.verify = to_streamed_response_wrapper( phone_numbers.verify, ) @cached_property def calling_settings(self) -> CallingSettingsResourceWithStreamingResponse: """Manage Whatsapp phone numbers""" return CallingSettingsResourceWithStreamingResponse(self._phone_numbers.calling_settings) @cached_property def profile(self) -> ProfileResourceWithStreamingResponse: """Manage Whatsapp phone numbers""" return ProfileResourceWithStreamingResponse(self._phone_numbers.profile) @cached_property def conversational_components(self) -> ConversationalComponentsResourceWithStreamingResponse: """Manage Whatsapp phone numbers""" return ConversationalComponentsResourceWithStreamingResponse(self._phone_numbers.conversational_components) @cached_property def calling_routing(self) -> CallingRoutingResourceWithStreamingResponse: """Manage Whatsapp phone numbers""" return CallingRoutingResourceWithStreamingResponse(self._phone_numbers.calling_routing) class AsyncPhoneNumbersResourceWithStreamingResponse: def __init__(self, phone_numbers: AsyncPhoneNumbersResource) -> None: self._phone_numbers = phone_numbers self.list = async_to_streamed_response_wrapper( phone_numbers.list, ) self.delete = async_to_streamed_response_wrapper( phone_numbers.delete, ) self.get = async_to_streamed_response_wrapper( phone_numbers.get, ) self.resend_verification = async_to_streamed_response_wrapper( phone_numbers.resend_verification, ) self.retrieve_conversation_window = async_to_streamed_response_wrapper( phone_numbers.retrieve_conversation_window, ) self.retrieve_phone_number = async_to_streamed_response_wrapper( phone_numbers.retrieve_phone_number, ) self.verify = async_to_streamed_response_wrapper( phone_numbers.verify, ) @cached_property def calling_settings(self) -> AsyncCallingSettingsResourceWithStreamingResponse: """Manage Whatsapp phone numbers""" return AsyncCallingSettingsResourceWithStreamingResponse(self._phone_numbers.calling_settings) @cached_property def profile(self) -> AsyncProfileResourceWithStreamingResponse: """Manage Whatsapp phone numbers""" return AsyncProfileResourceWithStreamingResponse(self._phone_numbers.profile) @cached_property def conversational_components(self) -> AsyncConversationalComponentsResourceWithStreamingResponse: """Manage Whatsapp phone numbers""" return AsyncConversationalComponentsResourceWithStreamingResponse(self._phone_numbers.conversational_components) @cached_property def calling_routing(self) -> AsyncCallingRoutingResourceWithStreamingResponse: """Manage Whatsapp phone numbers""" return AsyncCallingRoutingResourceWithStreamingResponse(self._phone_numbers.calling_routing)