From ccce7138163fad28f6d0055197367c2392676551 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 17 Oct 2024 14:06:21 +0000 Subject: [PATCH 01/12] [Librarian] Regenerated @ d97b0740a0c7cf86beebd56c6973927b07719cde 1fc3bb6195ebcbd02451fb8fc9080c695b075d4f --- CHANGES.md | 9 + twilio/rest/messaging/v1/__init__.py | 8 + .../rest/messaging/v1/request_managed_cert.py | 209 ++++++++++++++++++ twilio/rest/video/v1/room/__init__.py | 42 ++-- 4 files changed, 247 insertions(+), 21 deletions(-) create mode 100644 twilio/rest/messaging/v1/request_managed_cert.py diff --git a/CHANGES.md b/CHANGES.md index 5808d307b..bdadc9361 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,15 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-10-17] Version 9.3.4 +-------------------------- +**Api** +- Add response key `country` to fetch AvailablePhoneNumber resource by specific country. + +**Messaging** +- Make library and doc public for requestManagedCert Endpoint + + [2024-10-03] Version 9.3.3 -------------------------- **Library - Chore** diff --git a/twilio/rest/messaging/v1/__init__.py b/twilio/rest/messaging/v1/__init__.py index 6262dfe93..6bd630fbd 100644 --- a/twilio/rest/messaging/v1/__init__.py +++ b/twilio/rest/messaging/v1/__init__.py @@ -29,6 +29,7 @@ from twilio.rest.messaging.v1.linkshortening_messaging_service_domain_association import ( LinkshorteningMessagingServiceDomainAssociationList, ) +from twilio.rest.messaging.v1.request_managed_cert import RequestManagedCertList from twilio.rest.messaging.v1.service import ServiceList from twilio.rest.messaging.v1.tollfree_verification import TollfreeVerificationList from twilio.rest.messaging.v1.usecase import UsecaseList @@ -57,6 +58,7 @@ def __init__(self, domain: Domain): self._linkshortening_messaging_service_domain_association: Optional[ LinkshorteningMessagingServiceDomainAssociationList ] = None + self._request_managed_cert: Optional[RequestManagedCertList] = None self._services: Optional[ServiceList] = None self._tollfree_verifications: Optional[TollfreeVerificationList] = None self._usecases: Optional[UsecaseList] = None @@ -117,6 +119,12 @@ def linkshortening_messaging_service_domain_association( ) return self._linkshortening_messaging_service_domain_association + @property + def request_managed_cert(self) -> RequestManagedCertList: + if self._request_managed_cert is None: + self._request_managed_cert = RequestManagedCertList(self) + return self._request_managed_cert + @property def services(self) -> ServiceList: if self._services is None: diff --git a/twilio/rest/messaging/v1/request_managed_cert.py b/twilio/rest/messaging/v1/request_managed_cert.py new file mode 100644 index 000000000..fd79b5a68 --- /dev/null +++ b/twilio/rest/messaging/v1/request_managed_cert.py @@ -0,0 +1,209 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from datetime import datetime +from typing import Any, Dict, Optional +from twilio.base import deserialize, values +from twilio.base.instance_context import InstanceContext +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class RequestManagedCertInstance(InstanceResource): + """ + :ivar domain_sid: The unique string that we created to identify the Domain resource. + :ivar date_updated: Date that this Domain was last updated. + :ivar date_created: Date that this Domain was registered to the Twilio platform to create a new Domain object. + :ivar date_expires: Date that the private certificate associated with this domain expires. This is the expiration date of your existing cert. + :ivar domain_name: Full url path for this domain. + :ivar certificate_sid: The unique string that we created to identify this Certificate resource. + :ivar url: + :ivar managed: A boolean flag indicating if the certificate is managed by Twilio. + :ivar requesting: A boolean flag indicating if a managed certificate needs to be fulfilled by Twilio. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + domain_sid: Optional[str] = None, + ): + super().__init__(version) + + self.domain_sid: Optional[str] = payload.get("domain_sid") + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_expires: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_expires") + ) + self.domain_name: Optional[str] = payload.get("domain_name") + self.certificate_sid: Optional[str] = payload.get("certificate_sid") + self.url: Optional[str] = payload.get("url") + self.managed: Optional[bool] = payload.get("managed") + self.requesting: Optional[bool] = payload.get("requesting") + + self._solution = { + "domain_sid": domain_sid or self.domain_sid, + } + self._context: Optional[RequestManagedCertContext] = None + + @property + def _proxy(self) -> "RequestManagedCertContext": + """ + Generate an instance context for the instance, the context is capable of + performing various actions. All instance actions are proxied to the context + + :returns: RequestManagedCertContext for this RequestManagedCertInstance + """ + if self._context is None: + self._context = RequestManagedCertContext( + self._version, + domain_sid=self._solution["domain_sid"], + ) + return self._context + + def update(self) -> "RequestManagedCertInstance": + """ + Update the RequestManagedCertInstance + + + :returns: The updated RequestManagedCertInstance + """ + return self._proxy.update() + + async def update_async(self) -> "RequestManagedCertInstance": + """ + Asynchronous coroutine to update the RequestManagedCertInstance + + + :returns: The updated RequestManagedCertInstance + """ + return await self._proxy.update_async() + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class RequestManagedCertContext(InstanceContext): + + def __init__(self, version: Version, domain_sid: str): + """ + Initialize the RequestManagedCertContext + + :param version: Version that contains the resource + :param domain_sid: Unique string used to identify the domain that this certificate should be associated with. + """ + super().__init__(version) + + # Path Solution + self._solution = { + "domain_sid": domain_sid, + } + self._uri = "/LinkShortening/Domains/{domain_sid}/RequestManagedCert".format( + **self._solution + ) + + def update(self) -> RequestManagedCertInstance: + """ + Update the RequestManagedCertInstance + + + :returns: The updated RequestManagedCertInstance + """ + data = values.of({}) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return RequestManagedCertInstance( + self._version, payload, domain_sid=self._solution["domain_sid"] + ) + + async def update_async(self) -> RequestManagedCertInstance: + """ + Asynchronous coroutine to update the RequestManagedCertInstance + + + :returns: The updated RequestManagedCertInstance + """ + data = values.of({}) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return RequestManagedCertInstance( + self._version, payload, domain_sid=self._solution["domain_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class RequestManagedCertList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the RequestManagedCertList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + def get(self, domain_sid: str) -> RequestManagedCertContext: + """ + Constructs a RequestManagedCertContext + + :param domain_sid: Unique string used to identify the domain that this certificate should be associated with. + """ + return RequestManagedCertContext(self._version, domain_sid=domain_sid) + + def __call__(self, domain_sid: str) -> RequestManagedCertContext: + """ + Constructs a RequestManagedCertContext + + :param domain_sid: Unique string used to identify the domain that this certificate should be associated with. + """ + return RequestManagedCertContext(self._version, domain_sid=domain_sid) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/video/v1/room/__init__.py b/twilio/rest/video/v1/room/__init__.py index c735e5516..4a6822c94 100644 --- a/twilio/rest/video/v1/room/__init__.py +++ b/twilio/rest/video/v1/room/__init__.py @@ -43,25 +43,25 @@ class VideoCodec(object): H264 = "H264" """ - :ivar sid: The unique string that we created to identify the Room resource. + :ivar sid: The unique string that Twilio created to identify the Room resource. :ivar status: :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Room resource. :ivar enable_turn: Deprecated, now always considered to be true. :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource's `sid` in the URL to address the resource, assuming it does not contain any [reserved characters](https://tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. - :ivar status_callback: The URL we call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. - :ivar status_callback_method: The HTTP method we use to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. + :ivar status_callback: The URL Twilio calls using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. + :ivar status_callback_method: The HTTP method Twilio uses to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. :ivar end_time: The UTC end time of the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. :ivar duration: The duration of the room in seconds. :ivar type: :ivar max_participants: The maximum number of concurrent Participants allowed in the room. :ivar max_participant_duration: The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). :ivar max_concurrent_published_tracks: The maximum number of published audio, video, and data tracks all participants combined are allowed to publish in the room at the same time. Check [Programmable Video Limits](https://www.twilio.com/docs/video/programmable-video-limits) for more details. If it is set to 0 it means unconstrained. - :ivar record_participants_on_connect: Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** - :ivar video_codecs: An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** - :ivar media_region: The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#media-servers). ***This feature is not available in `peer-to-peer` rooms.*** - :ivar audio_only: When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. + :ivar record_participants_on_connect: Whether to start recording when Participants connect. + :ivar video_codecs: An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. + :ivar media_region: The region for the Room's media server. Can be one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#media-servers). + :ivar audio_only: When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. :ivar empty_room_timeout: Specifies how long (in minutes) a room will remain active after last participant leaves. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed. :ivar unused_room_timeout: Specifies how long (in minutes) a room will remain active if no one joins. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed. :ivar large_room: Indicates if this is a large room. @@ -419,14 +419,14 @@ def create( :param enable_turn: Deprecated, now always considered to be true. :param type: :param unique_name: An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource's `sid` in the URL to address the resource, assuming it does not contain any [reserved characters](https://tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. - :param status_callback: The URL we should call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. - :param status_callback_method: The HTTP method we should use to call `status_callback`. Can be `POST` or `GET`. - :param max_participants: The maximum number of concurrent Participants allowed in the room. Peer-to-peer rooms can have up to 10 Participants. Small Group rooms can have up to 4 Participants. Group rooms can have up to 50 Participants. - :param record_participants_on_connect: Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** - :param video_codecs: An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** - :param media_region: The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#group-rooms-media-servers). ***This feature is not available in `peer-to-peer` rooms.*** + :param status_callback: The URL Twilio should call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. + :param status_callback_method: The HTTP method Twilio should use to call `status_callback`. Can be `POST` or `GET`. + :param max_participants: The maximum number of concurrent Participants allowed in the room. The maximum allowed value is 50. + :param record_participants_on_connect: Whether to start recording when Participants connect. + :param video_codecs: An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. + :param media_region: The region for the Room's media server. Can be one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#group-rooms-media-servers). :param recording_rules: A collection of Recording Rules that describe how to include or exclude matching tracks for recording - :param audio_only: When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. + :param audio_only: When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. :param max_participant_duration: The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). :param empty_room_timeout: Configures how long (in minutes) a room will remain active after last participant leaves. Valid values range from 1 to 60 minutes (no fractions). :param unused_room_timeout: Configures how long (in minutes) a room will remain active if no one joins. Valid values range from 1 to 60 minutes (no fractions). @@ -488,14 +488,14 @@ async def create_async( :param enable_turn: Deprecated, now always considered to be true. :param type: :param unique_name: An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource's `sid` in the URL to address the resource, assuming it does not contain any [reserved characters](https://tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. - :param status_callback: The URL we should call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. - :param status_callback_method: The HTTP method we should use to call `status_callback`. Can be `POST` or `GET`. - :param max_participants: The maximum number of concurrent Participants allowed in the room. Peer-to-peer rooms can have up to 10 Participants. Small Group rooms can have up to 4 Participants. Group rooms can have up to 50 Participants. - :param record_participants_on_connect: Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** - :param video_codecs: An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** - :param media_region: The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#group-rooms-media-servers). ***This feature is not available in `peer-to-peer` rooms.*** + :param status_callback: The URL Twilio should call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. + :param status_callback_method: The HTTP method Twilio should use to call `status_callback`. Can be `POST` or `GET`. + :param max_participants: The maximum number of concurrent Participants allowed in the room. The maximum allowed value is 50. + :param record_participants_on_connect: Whether to start recording when Participants connect. + :param video_codecs: An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. + :param media_region: The region for the Room's media server. Can be one of the [available Media Regions](https://www.twilio.com/docs/video/ip-addresses#group-rooms-media-servers). :param recording_rules: A collection of Recording Rules that describe how to include or exclude matching tracks for recording - :param audio_only: When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. + :param audio_only: When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. :param max_participant_duration: The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). :param empty_room_timeout: Configures how long (in minutes) a room will remain active after last participant leaves. Valid values range from 1 to 60 minutes (no fractions). :param unused_room_timeout: Configures how long (in minutes) a room will remain active if no one joins. Valid values range from 1 to 60 minutes (no fractions). From 9f1414d97a6566d31a380dc884925847233f958a Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 17 Oct 2024 14:11:00 +0000 Subject: [PATCH 02/12] Release 9.3.4 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 911ec6d8a..a81b74cc5 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.3.3", + version="9.3.4", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index e5ba728ee..a14d90732 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "3", "3") +__version_info__ = ("9", "3", "4") __version__ = ".".join(__version_info__) From 086bc6bb518fa77c6f042f7a52d1c15d03cc4bc7 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 24 Oct 2024 13:27:35 +0000 Subject: [PATCH 03/12] [Librarian] Regenerated @ 2e932f6c59e0f9fb6cb96952802e5ebedd83b6f0 1852557f82faade033dbd5bd0615c9e1aa4d9fae --- CHANGES.md | 6 + twilio/rest/conversations/v1/__init__.py | 14 + .../v1/conversation_with_participants.py | 243 ++++++++++++++++ .../rest/conversations/v1/service/__init__.py | 25 ++ .../service/conversation_with_participants.py | 264 ++++++++++++++++++ .../marketplace/v1/referral_conversion.py | 140 ++-------- twilio/rest/numbers/v1/__init__.py | 24 +- ...=> porting_webhook_configuration_fetch.py} | 26 +- 8 files changed, 612 insertions(+), 130 deletions(-) create mode 100644 twilio/rest/conversations/v1/conversation_with_participants.py create mode 100644 twilio/rest/conversations/v1/service/conversation_with_participants.py rename twilio/rest/numbers/v1/{webhook.py => porting_webhook_configuration_fetch.py} (77%) diff --git a/CHANGES.md b/CHANGES.md index bdadc9361..a0c6db00a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,12 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-10-24] Version 9.3.5 +-------------------------- +**Conversations** +- Expose ConversationWithParticipants resource that allows creating a conversation with participants + + [2024-10-17] Version 9.3.4 -------------------------- **Api** diff --git a/twilio/rest/conversations/v1/__init__.py b/twilio/rest/conversations/v1/__init__.py index 3296ba2b4..1ec6c22a7 100644 --- a/twilio/rest/conversations/v1/__init__.py +++ b/twilio/rest/conversations/v1/__init__.py @@ -18,6 +18,9 @@ from twilio.rest.conversations.v1.address_configuration import AddressConfigurationList from twilio.rest.conversations.v1.configuration import ConfigurationList from twilio.rest.conversations.v1.conversation import ConversationList +from twilio.rest.conversations.v1.conversation_with_participants import ( + ConversationWithParticipantsList, +) from twilio.rest.conversations.v1.credential import CredentialList from twilio.rest.conversations.v1.participant_conversation import ( ParticipantConversationList, @@ -39,6 +42,9 @@ def __init__(self, domain: Domain): self._address_configurations: Optional[AddressConfigurationList] = None self._configuration: Optional[ConfigurationList] = None self._conversations: Optional[ConversationList] = None + self._conversation_with_participants: Optional[ + ConversationWithParticipantsList + ] = None self._credentials: Optional[CredentialList] = None self._participant_conversations: Optional[ParticipantConversationList] = None self._roles: Optional[RoleList] = None @@ -63,6 +69,14 @@ def conversations(self) -> ConversationList: self._conversations = ConversationList(self) return self._conversations + @property + def conversation_with_participants(self) -> ConversationWithParticipantsList: + if self._conversation_with_participants is None: + self._conversation_with_participants = ConversationWithParticipantsList( + self + ) + return self._conversation_with_participants + @property def credentials(self) -> CredentialList: if self._credentials is None: diff --git a/twilio/rest/conversations/v1/conversation_with_participants.py b/twilio/rest/conversations/v1/conversation_with_participants.py new file mode 100644 index 000000000..402f7adde --- /dev/null +++ b/twilio/rest/conversations/v1/conversation_with_participants.py @@ -0,0 +1,243 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union +from twilio.base import deserialize, serialize, values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class ConversationWithParticipantsInstance(InstanceResource): + + class State(object): + INACTIVE = "inactive" + ACTIVE = "active" + CLOSED = "closed" + + class WebhookEnabledType(object): + TRUE = "true" + FALSE = "false" + + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + :ivar chat_service_sid: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + :ivar messaging_service_sid: The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + :ivar attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + :ivar state: + :ivar date_created: The date that this resource was created. + :ivar date_updated: The date that this resource was last updated. + :ivar timers: Timer date values representing state update for this conversation. + :ivar links: Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. + :ivar bindings: + :ivar url: An absolute API resource URL for this conversation. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid") + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.unique_name: Optional[str] = payload.get("unique_name") + self.attributes: Optional[str] = payload.get("attributes") + self.state: Optional["ConversationWithParticipantsInstance.State"] = ( + payload.get("state") + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.timers: Optional[Dict[str, object]] = payload.get("timers") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.bindings: Optional[Dict[str, object]] = payload.get("bindings") + self.url: Optional[str] = payload.get("url") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class ConversationWithParticipantsList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the ConversationWithParticipantsList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/ConversationWithParticipants" + + def create( + self, + x_twilio_webhook_enabled: Union[ + "ConversationWithParticipantsInstance.WebhookEnabledType", object + ] = values.unset, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + date_created: Union[datetime, object] = values.unset, + date_updated: Union[datetime, object] = values.unset, + messaging_service_sid: Union[str, object] = values.unset, + attributes: Union[str, object] = values.unset, + state: Union[ + "ConversationWithParticipantsInstance.State", object + ] = values.unset, + timers_inactive: Union[str, object] = values.unset, + timers_closed: Union[str, object] = values.unset, + bindings_email_address: Union[str, object] = values.unset, + bindings_email_name: Union[str, object] = values.unset, + participant: Union[List[str], object] = values.unset, + ) -> ConversationWithParticipantsInstance: + """ + Create the ConversationWithParticipantsInstance + + :param x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header + :param friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional. + :param unique_name: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + :param date_created: The date that this resource was created. + :param date_updated: The date that this resource was last updated. + :param messaging_service_sid: The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + :param state: + :param timers_inactive: ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. + :param timers_closed: ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. + :param bindings_email_address: The default email address that will be used when sending outbound emails in this conversation. + :param bindings_email_name: The default name that will be used when sending outbound emails in this conversation. + :param participant: The participant to be added to the conversation in JSON format. The parameters are as in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + + :returns: The created ConversationWithParticipantsInstance + """ + + data = values.of( + { + "FriendlyName": friendly_name, + "UniqueName": unique_name, + "DateCreated": serialize.iso8601_datetime(date_created), + "DateUpdated": serialize.iso8601_datetime(date_updated), + "MessagingServiceSid": messaging_service_sid, + "Attributes": attributes, + "State": state, + "Timers.Inactive": timers_inactive, + "Timers.Closed": timers_closed, + "Bindings.Email.Address": bindings_email_address, + "Bindings.Email.Name": bindings_email_name, + "Participant": serialize.map(participant, lambda e: e), + } + ) + headers = values.of( + { + "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ConversationWithParticipantsInstance(self._version, payload) + + async def create_async( + self, + x_twilio_webhook_enabled: Union[ + "ConversationWithParticipantsInstance.WebhookEnabledType", object + ] = values.unset, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + date_created: Union[datetime, object] = values.unset, + date_updated: Union[datetime, object] = values.unset, + messaging_service_sid: Union[str, object] = values.unset, + attributes: Union[str, object] = values.unset, + state: Union[ + "ConversationWithParticipantsInstance.State", object + ] = values.unset, + timers_inactive: Union[str, object] = values.unset, + timers_closed: Union[str, object] = values.unset, + bindings_email_address: Union[str, object] = values.unset, + bindings_email_name: Union[str, object] = values.unset, + participant: Union[List[str], object] = values.unset, + ) -> ConversationWithParticipantsInstance: + """ + Asynchronously create the ConversationWithParticipantsInstance + + :param x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header + :param friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional. + :param unique_name: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + :param date_created: The date that this resource was created. + :param date_updated: The date that this resource was last updated. + :param messaging_service_sid: The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + :param state: + :param timers_inactive: ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. + :param timers_closed: ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. + :param bindings_email_address: The default email address that will be used when sending outbound emails in this conversation. + :param bindings_email_name: The default name that will be used when sending outbound emails in this conversation. + :param participant: The participant to be added to the conversation in JSON format. The parameters are as in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + + :returns: The created ConversationWithParticipantsInstance + """ + + data = values.of( + { + "FriendlyName": friendly_name, + "UniqueName": unique_name, + "DateCreated": serialize.iso8601_datetime(date_created), + "DateUpdated": serialize.iso8601_datetime(date_updated), + "MessagingServiceSid": messaging_service_sid, + "Attributes": attributes, + "State": state, + "Timers.Inactive": timers_inactive, + "Timers.Closed": timers_closed, + "Bindings.Email.Address": bindings_email_address, + "Bindings.Email.Name": bindings_email_name, + "Participant": serialize.map(participant, lambda e: e), + } + ) + headers = values.of( + { + "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ConversationWithParticipantsInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/conversations/v1/service/__init__.py b/twilio/rest/conversations/v1/service/__init__.py index a06afa2f7..415c25229 100644 --- a/twilio/rest/conversations/v1/service/__init__.py +++ b/twilio/rest/conversations/v1/service/__init__.py @@ -23,6 +23,9 @@ from twilio.rest.conversations.v1.service.binding import BindingList from twilio.rest.conversations.v1.service.configuration import ConfigurationList from twilio.rest.conversations.v1.service.conversation import ConversationList +from twilio.rest.conversations.v1.service.conversation_with_participants import ( + ConversationWithParticipantsList, +) from twilio.rest.conversations.v1.service.participant_conversation import ( ParticipantConversationList, ) @@ -135,6 +138,13 @@ def conversations(self) -> ConversationList: """ return self._proxy.conversations + @property + def conversation_with_participants(self) -> ConversationWithParticipantsList: + """ + Access the conversation_with_participants + """ + return self._proxy.conversation_with_participants + @property def participant_conversations(self) -> ParticipantConversationList: """ @@ -186,6 +196,9 @@ def __init__(self, version: Version, sid: str): self._bindings: Optional[BindingList] = None self._configuration: Optional[ConfigurationList] = None self._conversations: Optional[ConversationList] = None + self._conversation_with_participants: Optional[ + ConversationWithParticipantsList + ] = None self._participant_conversations: Optional[ParticipantConversationList] = None self._roles: Optional[RoleList] = None self._users: Optional[UserList] = None @@ -288,6 +301,18 @@ def conversations(self) -> ConversationList: ) return self._conversations + @property + def conversation_with_participants(self) -> ConversationWithParticipantsList: + """ + Access the conversation_with_participants + """ + if self._conversation_with_participants is None: + self._conversation_with_participants = ConversationWithParticipantsList( + self._version, + self._solution["sid"], + ) + return self._conversation_with_participants + @property def participant_conversations(self) -> ParticipantConversationList: """ diff --git a/twilio/rest/conversations/v1/service/conversation_with_participants.py b/twilio/rest/conversations/v1/service/conversation_with_participants.py new file mode 100644 index 000000000..123f15976 --- /dev/null +++ b/twilio/rest/conversations/v1/service/conversation_with_participants.py @@ -0,0 +1,264 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from datetime import datetime +from typing import Any, Dict, List, Optional, Union +from twilio.base import deserialize, serialize, values + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class ConversationWithParticipantsInstance(InstanceResource): + + class State(object): + INACTIVE = "inactive" + ACTIVE = "active" + CLOSED = "closed" + + class WebhookEnabledType(object): + TRUE = "true" + FALSE = "false" + + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + :ivar chat_service_sid: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + :ivar messaging_service_sid: The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + :ivar attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + :ivar state: + :ivar date_created: The date that this resource was created. + :ivar date_updated: The date that this resource was last updated. + :ivar timers: Timer date values representing state update for this conversation. + :ivar links: Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. + :ivar bindings: + :ivar url: An absolute API resource URL for this conversation. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], chat_service_sid: str + ): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid") + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.unique_name: Optional[str] = payload.get("unique_name") + self.attributes: Optional[str] = payload.get("attributes") + self.state: Optional["ConversationWithParticipantsInstance.State"] = ( + payload.get("state") + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.timers: Optional[Dict[str, object]] = payload.get("timers") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.bindings: Optional[Dict[str, object]] = payload.get("bindings") + self.url: Optional[str] = payload.get("url") + + self._solution = { + "chat_service_sid": chat_service_sid, + } + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return ( + "".format( + context + ) + ) + + +class ConversationWithParticipantsList(ListResource): + + def __init__(self, version: Version, chat_service_sid: str): + """ + Initialize the ConversationWithParticipantsList + + :param version: Version that contains the resource + :param chat_service_sid: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Conversation resource is associated with. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "chat_service_sid": chat_service_sid, + } + self._uri = "/Services/{chat_service_sid}/ConversationWithParticipants".format( + **self._solution + ) + + def create( + self, + x_twilio_webhook_enabled: Union[ + "ConversationWithParticipantsInstance.WebhookEnabledType", object + ] = values.unset, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + date_created: Union[datetime, object] = values.unset, + date_updated: Union[datetime, object] = values.unset, + messaging_service_sid: Union[str, object] = values.unset, + attributes: Union[str, object] = values.unset, + state: Union[ + "ConversationWithParticipantsInstance.State", object + ] = values.unset, + timers_inactive: Union[str, object] = values.unset, + timers_closed: Union[str, object] = values.unset, + bindings_email_address: Union[str, object] = values.unset, + bindings_email_name: Union[str, object] = values.unset, + participant: Union[List[str], object] = values.unset, + ) -> ConversationWithParticipantsInstance: + """ + Create the ConversationWithParticipantsInstance + + :param x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header + :param friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional. + :param unique_name: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + :param date_created: The date that this resource was created. + :param date_updated: The date that this resource was last updated. + :param messaging_service_sid: The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + :param state: + :param timers_inactive: ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. + :param timers_closed: ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. + :param bindings_email_address: The default email address that will be used when sending outbound emails in this conversation. + :param bindings_email_name: The default name that will be used when sending outbound emails in this conversation. + :param participant: The participant to be added to the conversation in JSON format. The parameters are as in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + + :returns: The created ConversationWithParticipantsInstance + """ + + data = values.of( + { + "FriendlyName": friendly_name, + "UniqueName": unique_name, + "DateCreated": serialize.iso8601_datetime(date_created), + "DateUpdated": serialize.iso8601_datetime(date_updated), + "MessagingServiceSid": messaging_service_sid, + "Attributes": attributes, + "State": state, + "Timers.Inactive": timers_inactive, + "Timers.Closed": timers_closed, + "Bindings.Email.Address": bindings_email_address, + "Bindings.Email.Name": bindings_email_name, + "Participant": serialize.map(participant, lambda e: e), + } + ) + headers = values.of( + { + "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ConversationWithParticipantsInstance( + self._version, payload, chat_service_sid=self._solution["chat_service_sid"] + ) + + async def create_async( + self, + x_twilio_webhook_enabled: Union[ + "ConversationWithParticipantsInstance.WebhookEnabledType", object + ] = values.unset, + friendly_name: Union[str, object] = values.unset, + unique_name: Union[str, object] = values.unset, + date_created: Union[datetime, object] = values.unset, + date_updated: Union[datetime, object] = values.unset, + messaging_service_sid: Union[str, object] = values.unset, + attributes: Union[str, object] = values.unset, + state: Union[ + "ConversationWithParticipantsInstance.State", object + ] = values.unset, + timers_inactive: Union[str, object] = values.unset, + timers_closed: Union[str, object] = values.unset, + bindings_email_address: Union[str, object] = values.unset, + bindings_email_name: Union[str, object] = values.unset, + participant: Union[List[str], object] = values.unset, + ) -> ConversationWithParticipantsInstance: + """ + Asynchronously create the ConversationWithParticipantsInstance + + :param x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header + :param friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional. + :param unique_name: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + :param date_created: The date that this resource was created. + :param date_updated: The date that this resource was last updated. + :param messaging_service_sid: The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to. + :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \\\"{}\\\" will be returned. + :param state: + :param timers_inactive: ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. + :param timers_closed: ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. + :param bindings_email_address: The default email address that will be used when sending outbound emails in this conversation. + :param bindings_email_name: The default name that will be used when sending outbound emails in this conversation. + :param participant: The participant to be added to the conversation in JSON format. The parameters are as in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + + :returns: The created ConversationWithParticipantsInstance + """ + + data = values.of( + { + "FriendlyName": friendly_name, + "UniqueName": unique_name, + "DateCreated": serialize.iso8601_datetime(date_created), + "DateUpdated": serialize.iso8601_datetime(date_updated), + "MessagingServiceSid": messaging_service_sid, + "Attributes": attributes, + "State": state, + "Timers.Inactive": timers_inactive, + "Timers.Closed": timers_closed, + "Bindings.Email.Address": bindings_email_address, + "Bindings.Email.Name": bindings_email_name, + "Participant": serialize.map(participant, lambda e: e), + } + ) + headers = values.of( + { + "X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled, + "Content-Type": "application/x-www-form-urlencoded", + } + ) + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ConversationWithParticipantsInstance( + self._version, payload, chat_service_sid=self._solution["chat_service_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/marketplace/v1/referral_conversion.py b/twilio/rest/marketplace/v1/referral_conversion.py index 62d6ad84f..47bb191ed 100644 --- a/twilio/rest/marketplace/v1/referral_conversion.py +++ b/twilio/rest/marketplace/v1/referral_conversion.py @@ -14,7 +14,7 @@ from typing import Any, Dict, Optional from twilio.base import values -from twilio.base.instance_context import InstanceContext + from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.version import Version @@ -30,67 +30,40 @@ def __init__(self, version: Version, payload: Dict[str, Any]): self.converted_account_sid: Optional[str] = payload.get("converted_account_sid") - self._context: Optional[ReferralConversionContext] = None - - @property - def _proxy(self) -> "ReferralConversionContext": - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ReferralConversionContext for this ReferralConversionInstance - """ - if self._context is None: - self._context = ReferralConversionContext( - self._version, - ) - return self._context - - def create( - self, create_referral_conversion_request: CreateReferralConversionRequest - ) -> "ReferralConversionInstance": + def __repr__(self) -> str: """ - Create the ReferralConversionInstance - - :param create_referral_conversion_request: + Provide a friendly representation - :returns: The created ReferralConversionInstance + :returns: Machine friendly representation """ - return self._proxy.create( - create_referral_conversion_request, - ) - async def create_async( - self, create_referral_conversion_request: CreateReferralConversionRequest - ) -> "ReferralConversionInstance": - """ - Asynchronous coroutine to create the ReferralConversionInstance + return "" - :param create_referral_conversion_request: - :returns: The created ReferralConversionInstance - """ - return await self._proxy.create_async( - create_referral_conversion_request, - ) +class ReferralConversionList(ListResource): - def __repr__(self) -> str: + class CreateReferralConversionRequest(object): """ - Provide a friendly representation - - :returns: Machine friendly representation + :ivar referral_account_sid: """ - return "" + def __init__(self, payload: Dict[str, Any]): + self.referral_account_sid: Optional[str] = payload.get( + "referral_account_sid" + ) -class ReferralConversionContext(InstanceContext): + def to_dict(self): + return { + "referral_account_sid": self.referral_account_sid, + } def __init__(self, version: Version): """ - Initialize the ReferralConversionContext + Initialize the ReferralConversionList :param version: Version that contains the resource + """ super().__init__(version) @@ -106,13 +79,14 @@ def create( :returns: The created ReferralConversionInstance """ - data = values.of( - { - "CreateReferralConversionRequest": create_referral_conversion_request, - } - ) + data = create_referral_conversion_request.to_dict() - payload = self._version.create(method="POST", uri=self._uri, data=data) + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" + + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) return ReferralConversionInstance(self._version, payload) @@ -120,75 +94,23 @@ async def create_async( self, create_referral_conversion_request: CreateReferralConversionRequest ) -> ReferralConversionInstance: """ - Asynchronous coroutine to create the ReferralConversionInstance + Asynchronously create the ReferralConversionInstance :param create_referral_conversion_request: :returns: The created ReferralConversionInstance """ - data = values.of( - { - "CreateReferralConversionRequest": create_referral_conversion_request, - } - ) + data = create_referral_conversion_request.to_dict() + + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) + headers["Content-Type"] = "application/json" payload = await self._version.create_async( - method="POST", uri=self._uri, data=data + method="POST", uri=self._uri, data=data, headers=headers ) return ReferralConversionInstance(self._version, payload) - def __repr__(self) -> str: - """ - Provide a friendly representation - - :returns: Machine friendly representation - """ - - return "" - - -class ReferralConversionList(ListResource): - - class CreateReferralConversionRequest(object): - """ - :ivar referral_account_sid: - """ - - def __init__(self, payload: Dict[str, Any]): - - self.referral_account_sid: Optional[str] = payload.get( - "referral_account_sid" - ) - - def to_dict(self): - return { - "referral_account_sid": self.referral_account_sid, - } - - def __init__(self, version: Version): - """ - Initialize the ReferralConversionList - - :param version: Version that contains the resource - - """ - super().__init__(version) - - def get(self) -> ReferralConversionContext: - """ - Constructs a ReferralConversionContext - - """ - return ReferralConversionContext(self._version) - - def __call__(self) -> ReferralConversionContext: - """ - Constructs a ReferralConversionContext - - """ - return ReferralConversionContext(self._version) - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 68f078a88..043364c3d 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -28,10 +28,12 @@ from twilio.rest.numbers.v1.porting_webhook_configuration_delete import ( PortingWebhookConfigurationDeleteList, ) +from twilio.rest.numbers.v1.porting_webhook_configuration_fetch import ( + PortingWebhookConfigurationFetchList, +) from twilio.rest.numbers.v1.signing_request_configuration import ( SigningRequestConfigurationList, ) -from twilio.rest.numbers.v1.webhook import WebhookList class V1(Version): @@ -56,10 +58,12 @@ def __init__(self, domain: Domain): self._porting_webhook_configurations_delete: Optional[ PortingWebhookConfigurationDeleteList ] = None + self._porting_webhook_configuration_fetch: Optional[ + PortingWebhookConfigurationFetchList + ] = None self._signing_request_configurations: Optional[ SigningRequestConfigurationList ] = None - self._webhook: Optional[WebhookList] = None @property def bulk_eligibilities(self) -> BulkEligibilityList: @@ -107,18 +111,22 @@ def porting_webhook_configurations_delete( ) return self._porting_webhook_configurations_delete + @property + def porting_webhook_configuration_fetch( + self, + ) -> PortingWebhookConfigurationFetchList: + if self._porting_webhook_configuration_fetch is None: + self._porting_webhook_configuration_fetch = ( + PortingWebhookConfigurationFetchList(self) + ) + return self._porting_webhook_configuration_fetch + @property def signing_request_configurations(self) -> SigningRequestConfigurationList: if self._signing_request_configurations is None: self._signing_request_configurations = SigningRequestConfigurationList(self) return self._signing_request_configurations - @property - def webhook(self) -> WebhookList: - if self._webhook is None: - self._webhook = WebhookList(self) - return self._webhook - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/webhook.py b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py similarity index 77% rename from twilio/rest/numbers/v1/webhook.py rename to twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py index 88ca64e9e..89b8064bd 100644 --- a/twilio/rest/numbers/v1/webhook.py +++ b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class WebhookInstance(InstanceResource): +class PortingWebhookConfigurationFetchInstance(InstanceResource): """ :ivar url: The URL of the webhook configuration request :ivar port_in_target_url: The complete webhook url that will be called when a notification event for port in request or port in phone number happens @@ -52,14 +52,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class WebhookList(ListResource): +class PortingWebhookConfigurationFetchList(ListResource): def __init__(self, version: Version): """ - Initialize the WebhookList + Initialize the PortingWebhookConfigurationFetchList :param version: Version that contains the resource @@ -68,25 +68,25 @@ def __init__(self, version: Version): self._uri = "/Porting/Configuration/Webhook" - def fetch(self) -> WebhookInstance: + def fetch(self) -> PortingWebhookConfigurationFetchInstance: """ - Asynchronously fetch the WebhookInstance + Asynchronously fetch the PortingWebhookConfigurationFetchInstance - :returns: The fetched WebhookInstance + :returns: The fetched PortingWebhookConfigurationFetchInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - return WebhookInstance(self._version, payload) + return PortingWebhookConfigurationFetchInstance(self._version, payload) - async def fetch_async(self) -> WebhookInstance: + async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: """ - Asynchronously fetch the WebhookInstance + Asynchronously fetch the PortingWebhookConfigurationFetchInstance - :returns: The fetched WebhookInstance + :returns: The fetched PortingWebhookConfigurationFetchInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -94,7 +94,7 @@ async def fetch_async(self) -> WebhookInstance: method="GET", uri=self._uri, headers=headers ) - return WebhookInstance(self._version, payload) + return PortingWebhookConfigurationFetchInstance(self._version, payload) def __repr__(self) -> str: """ @@ -102,4 +102,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" From 19e54f9c1e3ed865326641f7cbfb94d9555e2a94 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 24 Oct 2024 13:34:35 +0000 Subject: [PATCH 04/12] Release 9.3.5 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index a81b74cc5..2350dbfc2 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.3.4", + version="9.3.5", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index a14d90732..03a9b1157 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "3", "4") +__version_info__ = ("9", "3", "5") __version__ = ".".join(__version_info__) From efa28037b00092721feb27ee517df2063954d482 Mon Sep 17 00:00:00 2001 From: Shubham Date: Fri, 25 Oct 2024 17:11:20 +0530 Subject: [PATCH 05/12] chore: removing unavailable references from init files (#818) --- twilio/rest/autopilot/__init__.py | 25 --------------- twilio/rest/iam/__init__.py | 10 ------ twilio/rest/media/__init__.py | 35 -------------------- twilio/rest/oauth/__init__.py | 39 ----------------------- twilio/rest/preview/__init__.py | 9 ------ twilio/rest/preview_messaging/__init__.py | 13 -------- 6 files changed, 131 deletions(-) delete mode 100644 twilio/rest/autopilot/__init__.py delete mode 100644 twilio/rest/media/__init__.py delete mode 100644 twilio/rest/preview_messaging/__init__.py diff --git a/twilio/rest/autopilot/__init__.py b/twilio/rest/autopilot/__init__.py deleted file mode 100644 index f38232502..000000000 --- a/twilio/rest/autopilot/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -from warnings import warn - -from twilio.rest.autopilot.AutopilotBase import AutopilotBase -from twilio.rest.autopilot.v1.assistant import AssistantList -from twilio.rest.autopilot.v1.restore_assistant import RestoreAssistantList - - -class Autopilot(AutopilotBase): - @property - def assistants(self) -> AssistantList: - warn( - "assistants is deprecated. Use v1.assistants instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.assistants - - @property - def restore_assistant(self) -> RestoreAssistantList: - warn( - "restore_assistant is deprecated. Use v1.restore_assistant instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.restore_assistant diff --git a/twilio/rest/iam/__init__.py b/twilio/rest/iam/__init__.py index f992caa57..994ecee62 100644 --- a/twilio/rest/iam/__init__.py +++ b/twilio/rest/iam/__init__.py @@ -3,7 +3,6 @@ from twilio.rest.iam.IamBase import IamBase from twilio.rest.iam.v1.api_key import ApiKeyList from twilio.rest.iam.v1.get_api_keys import GetApiKeysList -from twilio.rest.iam.v1.new_api_key import NewApiKeyList class Iam(IamBase): @@ -24,12 +23,3 @@ def get_api_keys(self) -> GetApiKeysList: stacklevel=2, ) return self.v1.get_api_keys - - @property - def new_api_key(self) -> NewApiKeyList: - warn( - "new_api_key is deprecated. Use v1.new_api_key instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.new_api_key diff --git a/twilio/rest/media/__init__.py b/twilio/rest/media/__init__.py deleted file mode 100644 index ce6207e29..000000000 --- a/twilio/rest/media/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -from warnings import warn - -from twilio.rest.media.MediaBase import MediaBase -from twilio.rest.media.v1.media_processor import MediaProcessorList -from twilio.rest.media.v1.media_recording import MediaRecordingList -from twilio.rest.media.v1.player_streamer import PlayerStreamerList - - -class Media(MediaBase): - @property - def media_processor(self) -> MediaProcessorList: - warn( - "media_processor is deprecated. Use v1.media_processor instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.media_processor - - @property - def media_recording(self) -> MediaRecordingList: - warn( - "media_recording is deprecated. Use v1.media_recording instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.media_recording - - @property - def player_streamer(self) -> PlayerStreamerList: - warn( - "player_streamer is deprecated. Use v1.player_streamer instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.player_streamer diff --git a/twilio/rest/oauth/__init__.py b/twilio/rest/oauth/__init__.py index 709150e9e..586cf6b4d 100644 --- a/twilio/rest/oauth/__init__.py +++ b/twilio/rest/oauth/__init__.py @@ -1,40 +1,10 @@ from warnings import warn from twilio.rest.oauth.OauthBase import OauthBase -from twilio.rest.oauth.v1.device_code import DeviceCodeList -from twilio.rest.oauth.v1.oauth import OauthList -from twilio.rest.oauth.v1.openid_discovery import OpenidDiscoveryList from twilio.rest.oauth.v1.token import TokenList -from twilio.rest.oauth.v1.user_info import UserInfoList class Oauth(OauthBase): - @property - def oauth(self) -> OauthList: - warn( - "oauth is deprecated. Use v1.oauth instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.oauth - - @property - def device_code(self) -> DeviceCodeList: - warn( - "device_code is deprecated. Use v1.device_code instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.device_code - - @property - def openid_discovery(self) -> OpenidDiscoveryList: - warn( - "openid_discovery is deprecated. Use v1.openid_discovery instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.openid_discovery @property def token(self) -> TokenList: @@ -44,12 +14,3 @@ def token(self) -> TokenList: stacklevel=2, ) return self.v1.token - - @property - def user_info(self) -> UserInfoList: - warn( - "user_info is deprecated. Use v1.user_info instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.v1.user_info diff --git a/twilio/rest/preview/__init__.py b/twilio/rest/preview/__init__.py index 79d870e13..501ae417d 100644 --- a/twilio/rest/preview/__init__.py +++ b/twilio/rest/preview/__init__.py @@ -1,7 +1,6 @@ from warnings import warn from twilio.rest.preview.PreviewBase import PreviewBase -from twilio.rest.preview.deployed_devices.fleet import FleetList from twilio.rest.preview.hosted_numbers.authorization_document import ( AuthorizationDocumentList, ) @@ -15,14 +14,6 @@ class Preview(PreviewBase): - @property - def fleets(self) -> FleetList: - warn( - "fleets is deprecated. Use deployed_devices.fleets instead.", - DeprecationWarning, - stacklevel=2, - ) - return self.deployed_devices.fleets @property def authorization_documents(self) -> AuthorizationDocumentList: diff --git a/twilio/rest/preview_messaging/__init__.py b/twilio/rest/preview_messaging/__init__.py deleted file mode 100644 index 73bf67969..000000000 --- a/twilio/rest/preview_messaging/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -from twilio.rest.preview_messaging.PreviewMessagingBase import PreviewMessagingBase -from twilio.rest.preview_messaging.v1.broadcast import BroadcastList -from twilio.rest.preview_messaging.v1.message import MessageList - - -class PreviewMessaging(PreviewMessagingBase): - @property - def broadcast(self) -> BroadcastList: - return self.v1.broadcasts - - @property - def messages(self) -> MessageList: - return self.v1.messages From 15ee3e665980b6dc6bd66fac56e58ff8adc12b33 Mon Sep 17 00:00:00 2001 From: Twilio Date: Fri, 25 Oct 2024 11:45:55 +0000 Subject: [PATCH 06/12] [Librarian] Regenerated @ 2e932f6c59e0f9fb6cb96952802e5ebedd83b6f0 1852557f82faade033dbd5bd0615c9e1aa4d9fae --- CHANGES.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index a0c6db00a..f031545e1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,12 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-10-25] Version 9.3.6 +-------------------------- +**Library - Chore** +- [PR #818](https://github.com/twilio/twilio-python/pull/818): removing unavailable references from init files. Thanks to [@tiwarishubham635](https://github.com/tiwarishubham635)! + + [2024-10-24] Version 9.3.5 -------------------------- **Conversations** From 3fc2d25d6e7ceedf463f99ebceaaf56dde3de7bf Mon Sep 17 00:00:00 2001 From: Twilio Date: Fri, 25 Oct 2024 11:52:41 +0000 Subject: [PATCH 07/12] Release 9.3.6 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 2350dbfc2..152d6f98b 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.3.5", + version="9.3.6", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 03a9b1157..5fe186e28 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "3", "5") +__version_info__ = ("9", "3", "6") __version__ = ".".join(__version_info__) From 5aa42dc526d486140fd5c021a5e7da4e76318978 Mon Sep 17 00:00:00 2001 From: sbansla <104902068+sbansla@users.noreply.github.com> Date: Mon, 28 Oct 2024 17:32:59 +0530 Subject: [PATCH 08/12] chore: use older verison of aiohttp_retry (#819) * use older verison of aiohttp_retry --- requirements.txt | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index a29abc4d1..3de95e70c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,5 +2,5 @@ pygments>=2.7.4 # not directly required, pinned by Snyk to avoid a vulnerability requests>=2.31.0 PyJWT>=2.0.0, <3.0.0 aiohttp>=3.9.4 -aiohttp-retry>=2.8.3 +aiohttp-retry==2.8.3 certifi>=2023.7.22 # not directly required, pinned by Snyk to avoid a vulnerability diff --git a/setup.py b/setup.py index 152d6f98b..b769d7ff4 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ "requests >= 2.0.0", "PyJWT >= 2.0.0, < 3.0.0", "aiohttp>=3.8.4", - "aiohttp-retry>=2.8.3", + "aiohttp-retry==2.8.3", ], packages=find_packages(exclude=["tests", "tests.*"]), include_package_data=True, From 4f1e7d2d02b811035c3872a72e2f9d1a05a4544e Mon Sep 17 00:00:00 2001 From: Twilio Date: Fri, 15 Nov 2024 07:13:32 +0000 Subject: [PATCH 09/12] [Librarian] Regenerated @ 51e40434baa37a97b298d416220c6de10d9698c4 1ac2fcf2e173acdee4491031f59034933467a82c --- CHANGES.md | 14 ++++++++++ .../v2010/account/usage/record/__init__.py | 2 ++ .../v2010/account/usage/record/all_time.py | 2 ++ .../api/v2010/account/usage/record/daily.py | 2 ++ .../v2010/account/usage/record/last_month.py | 2 ++ .../api/v2010/account/usage/record/monthly.py | 2 ++ .../v2010/account/usage/record/this_month.py | 2 ++ .../api/v2010/account/usage/record/today.py | 2 ++ .../api/v2010/account/usage/record/yearly.py | 2 ++ .../v2010/account/usage/record/yesterday.py | 2 ++ .../rest/api/v2010/account/usage/trigger.py | 2 ++ twilio/rest/content/v1/content/__init__.py | 1 + .../v1/conversation_with_participants.py | 4 +-- .../service/conversation_with_participants.py | 4 +-- .../rest/insights/v1/conference/__init__.py | 1 + twilio/rest/insights/v1/room/__init__.py | 3 +++ twilio/rest/insights/v1/room/participant.py | 3 +++ twilio/rest/numbers/v1/__init__.py | 24 ++++++----------- ...hook_configuration_fetch.py => webhook.py} | 26 +++++++++---------- 19 files changed, 67 insertions(+), 33 deletions(-) rename twilio/rest/numbers/v1/{porting_webhook_configuration_fetch.py => webhook.py} (77%) diff --git a/CHANGES.md b/CHANGES.md index f031545e1..c879894ab 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,20 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-11-15] Version 9.3.7 +-------------------------- +**Library - Chore** +- [PR #819](https://github.com/twilio/twilio-python/pull/819): use older verison of aiohttp_retry. Thanks to [@sbansla](https://github.com/sbansla)! + +**Api** +- Added `ivr-virtual-agent-custom-voices` and `ivr-virtual-agent-genai` to `usage_record` API. +- Add open-api file tag to realtime_transcriptions + +**Taskrouter** +- Add `api-tag` property to workers reservation +- Add `api-tag` property to task reservation + + [2024-10-25] Version 9.3.6 -------------------------- **Library - Chore** diff --git a/twilio/rest/api/v2010/account/usage/record/__init__.py b/twilio/rest/api/v2010/account/usage/record/__init__.py index 0afc8e347..509b98e5a 100644 --- a/twilio/rest/api/v2010/account/usage/record/__init__.py +++ b/twilio/rest/api/v2010/account/usage/record/__init__.py @@ -80,6 +80,8 @@ class Category(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/api/v2010/account/usage/record/all_time.py b/twilio/rest/api/v2010/account/usage/record/all_time.py index 7c0b6f5ce..f7da24250 100644 --- a/twilio/rest/api/v2010/account/usage/record/all_time.py +++ b/twilio/rest/api/v2010/account/usage/record/all_time.py @@ -72,6 +72,8 @@ class Category(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/api/v2010/account/usage/record/daily.py b/twilio/rest/api/v2010/account/usage/record/daily.py index a0acd62b2..6eff180ba 100644 --- a/twilio/rest/api/v2010/account/usage/record/daily.py +++ b/twilio/rest/api/v2010/account/usage/record/daily.py @@ -72,6 +72,8 @@ class Category(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/api/v2010/account/usage/record/last_month.py b/twilio/rest/api/v2010/account/usage/record/last_month.py index 21fa1e1b6..bcaacc4ae 100644 --- a/twilio/rest/api/v2010/account/usage/record/last_month.py +++ b/twilio/rest/api/v2010/account/usage/record/last_month.py @@ -72,6 +72,8 @@ class Category(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/api/v2010/account/usage/record/monthly.py b/twilio/rest/api/v2010/account/usage/record/monthly.py index 0eff14396..3b606977c 100644 --- a/twilio/rest/api/v2010/account/usage/record/monthly.py +++ b/twilio/rest/api/v2010/account/usage/record/monthly.py @@ -72,6 +72,8 @@ class Category(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/api/v2010/account/usage/record/this_month.py b/twilio/rest/api/v2010/account/usage/record/this_month.py index 646b4a49d..9b7fc8a51 100644 --- a/twilio/rest/api/v2010/account/usage/record/this_month.py +++ b/twilio/rest/api/v2010/account/usage/record/this_month.py @@ -72,6 +72,8 @@ class Category(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/api/v2010/account/usage/record/today.py b/twilio/rest/api/v2010/account/usage/record/today.py index 30de9d4cb..fed8286f7 100644 --- a/twilio/rest/api/v2010/account/usage/record/today.py +++ b/twilio/rest/api/v2010/account/usage/record/today.py @@ -72,6 +72,8 @@ class Category(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/api/v2010/account/usage/record/yearly.py b/twilio/rest/api/v2010/account/usage/record/yearly.py index fbe9dd1f6..e773670d2 100644 --- a/twilio/rest/api/v2010/account/usage/record/yearly.py +++ b/twilio/rest/api/v2010/account/usage/record/yearly.py @@ -72,6 +72,8 @@ class Category(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/api/v2010/account/usage/record/yesterday.py b/twilio/rest/api/v2010/account/usage/record/yesterday.py index db5f9eb47..a0efe356e 100644 --- a/twilio/rest/api/v2010/account/usage/record/yesterday.py +++ b/twilio/rest/api/v2010/account/usage/record/yesterday.py @@ -72,6 +72,8 @@ class Category(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/api/v2010/account/usage/trigger.py b/twilio/rest/api/v2010/account/usage/trigger.py index c3a1b241c..ba63beec1 100644 --- a/twilio/rest/api/v2010/account/usage/trigger.py +++ b/twilio/rest/api/v2010/account/usage/trigger.py @@ -83,6 +83,8 @@ class UsageCategory(object): GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" IMP_V1_USAGE = "imp-v1-usage" + IVR_VIRTUAL_AGENT_CUSTOM_VOICES = "ivr-virtual-agent-custom-voices" + IVR_VIRTUAL_AGENT_GENAI = "ivr-virtual-agent-genai" LOOKUPS = "lookups" MARKETPLACE = "marketplace" MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = ( diff --git a/twilio/rest/content/v1/content/__init__.py b/twilio/rest/content/v1/content/__init__.py index 3ddc8b926..b5261516a 100644 --- a/twilio/rest/content/v1/content/__init__.py +++ b/twilio/rest/content/v1/content/__init__.py @@ -34,6 +34,7 @@ class CallToActionActionType(object): PHONE_NUMBER = "PHONE_NUMBER" COPY_CODE = "COPY_CODE" VOICE_CALL = "VOICE_CALL" + VOICE_CALL_REQUEST = "VOICE_CALL_REQUEST" class CardActionType(object): URL = "URL" diff --git a/twilio/rest/conversations/v1/conversation_with_participants.py b/twilio/rest/conversations/v1/conversation_with_participants.py index 402f7adde..b50c2da1a 100644 --- a/twilio/rest/conversations/v1/conversation_with_participants.py +++ b/twilio/rest/conversations/v1/conversation_with_participants.py @@ -131,7 +131,7 @@ def create( :param timers_closed: ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. :param bindings_email_address: The default email address that will be used when sending outbound emails in this conversation. :param bindings_email_name: The default name that will be used when sending outbound emails in this conversation. - :param participant: The participant to be added to the conversation in JSON format. The parameters are as in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + :param participant: The participant to be added to the conversation in JSON format. The JSON object attributes are as parameters in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. :returns: The created ConversationWithParticipantsInstance """ @@ -200,7 +200,7 @@ async def create_async( :param timers_closed: ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. :param bindings_email_address: The default email address that will be used when sending outbound emails in this conversation. :param bindings_email_name: The default name that will be used when sending outbound emails in this conversation. - :param participant: The participant to be added to the conversation in JSON format. The parameters are as in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + :param participant: The participant to be added to the conversation in JSON format. The JSON object attributes are as parameters in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. :returns: The created ConversationWithParticipantsInstance """ diff --git a/twilio/rest/conversations/v1/service/conversation_with_participants.py b/twilio/rest/conversations/v1/service/conversation_with_participants.py index 123f15976..ef1495deb 100644 --- a/twilio/rest/conversations/v1/service/conversation_with_participants.py +++ b/twilio/rest/conversations/v1/service/conversation_with_participants.py @@ -148,7 +148,7 @@ def create( :param timers_closed: ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. :param bindings_email_address: The default email address that will be used when sending outbound emails in this conversation. :param bindings_email_name: The default name that will be used when sending outbound emails in this conversation. - :param participant: The participant to be added to the conversation in JSON format. The parameters are as in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + :param participant: The participant to be added to the conversation in JSON format. The JSON object attributes are as parameters in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. :returns: The created ConversationWithParticipantsInstance """ @@ -219,7 +219,7 @@ async def create_async( :param timers_closed: ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. :param bindings_email_address: The default email address that will be used when sending outbound emails in this conversation. :param bindings_email_name: The default name that will be used when sending outbound emails in this conversation. - :param participant: The participant to be added to the conversation in JSON format. The parameters are as in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. + :param participant: The participant to be added to the conversation in JSON format. The JSON object attributes are as parameters in [Participant Resource](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). The maximum number of participants that can be added in a single request is 10. :returns: The created ConversationWithParticipantsInstance """ diff --git a/twilio/rest/insights/v1/conference/__init__.py b/twilio/rest/insights/v1/conference/__init__.py index 1ee8c09dc..63b8abbf9 100644 --- a/twilio/rest/insights/v1/conference/__init__.py +++ b/twilio/rest/insights/v1/conference/__init__.py @@ -70,6 +70,7 @@ class Tag(object): HIGH_LATENCY = "high_latency" LOW_MOS = "low_mos" DETECTED_SILENCE = "detected_silence" + NO_CONCURRENT_PARTICIPANTS = "no_concurrent_participants" """ :ivar conference_sid: The unique SID identifier of the Conference. diff --git a/twilio/rest/insights/v1/room/__init__.py b/twilio/rest/insights/v1/room/__init__.py index 7361018e2..abcc9f8c5 100644 --- a/twilio/rest/insights/v1/room/__init__.py +++ b/twilio/rest/insights/v1/room/__init__.py @@ -29,6 +29,7 @@ class Codec(object): VP8 = "VP8" H264 = "H264" VP9 = "VP9" + OPUS = "opus" class CreatedMethod(object): SDK = "sdk" @@ -75,6 +76,8 @@ class TwilioRealm(object): IN1 = "in1" DE1 = "de1" GLL = "gll" + STAGE_US1 = "stage_us1" + DEV_US1 = "dev_us1" """ :ivar account_sid: Account SID associated with this room. diff --git a/twilio/rest/insights/v1/room/participant.py b/twilio/rest/insights/v1/room/participant.py index 0f6617f54..6c2b8448c 100644 --- a/twilio/rest/insights/v1/room/participant.py +++ b/twilio/rest/insights/v1/room/participant.py @@ -28,6 +28,7 @@ class Codec(object): VP8 = "VP8" H264 = "H264" VP9 = "VP9" + OPUS = "opus" class EdgeLocation(object): ASHBURN = "ashburn" @@ -55,6 +56,8 @@ class TwilioRealm(object): IN1 = "in1" DE1 = "de1" GLL = "gll" + STAGE_US1 = "stage_us1" + DEV_US1 = "dev_us1" """ :ivar participant_sid: Unique identifier for the participant. diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 043364c3d..68f078a88 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -28,12 +28,10 @@ from twilio.rest.numbers.v1.porting_webhook_configuration_delete import ( PortingWebhookConfigurationDeleteList, ) -from twilio.rest.numbers.v1.porting_webhook_configuration_fetch import ( - PortingWebhookConfigurationFetchList, -) from twilio.rest.numbers.v1.signing_request_configuration import ( SigningRequestConfigurationList, ) +from twilio.rest.numbers.v1.webhook import WebhookList class V1(Version): @@ -58,12 +56,10 @@ def __init__(self, domain: Domain): self._porting_webhook_configurations_delete: Optional[ PortingWebhookConfigurationDeleteList ] = None - self._porting_webhook_configuration_fetch: Optional[ - PortingWebhookConfigurationFetchList - ] = None self._signing_request_configurations: Optional[ SigningRequestConfigurationList ] = None + self._webhook: Optional[WebhookList] = None @property def bulk_eligibilities(self) -> BulkEligibilityList: @@ -111,22 +107,18 @@ def porting_webhook_configurations_delete( ) return self._porting_webhook_configurations_delete - @property - def porting_webhook_configuration_fetch( - self, - ) -> PortingWebhookConfigurationFetchList: - if self._porting_webhook_configuration_fetch is None: - self._porting_webhook_configuration_fetch = ( - PortingWebhookConfigurationFetchList(self) - ) - return self._porting_webhook_configuration_fetch - @property def signing_request_configurations(self) -> SigningRequestConfigurationList: if self._signing_request_configurations is None: self._signing_request_configurations = SigningRequestConfigurationList(self) return self._signing_request_configurations + @property + def webhook(self) -> WebhookList: + if self._webhook is None: + self._webhook = WebhookList(self) + return self._webhook + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py b/twilio/rest/numbers/v1/webhook.py similarity index 77% rename from twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py rename to twilio/rest/numbers/v1/webhook.py index 89b8064bd..88ca64e9e 100644 --- a/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py +++ b/twilio/rest/numbers/v1/webhook.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class PortingWebhookConfigurationFetchInstance(InstanceResource): +class WebhookInstance(InstanceResource): """ :ivar url: The URL of the webhook configuration request :ivar port_in_target_url: The complete webhook url that will be called when a notification event for port in request or port in phone number happens @@ -52,14 +52,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class PortingWebhookConfigurationFetchList(ListResource): +class WebhookList(ListResource): def __init__(self, version: Version): """ - Initialize the PortingWebhookConfigurationFetchList + Initialize the WebhookList :param version: Version that contains the resource @@ -68,25 +68,25 @@ def __init__(self, version: Version): self._uri = "/Porting/Configuration/Webhook" - def fetch(self) -> PortingWebhookConfigurationFetchInstance: + def fetch(self) -> WebhookInstance: """ - Asynchronously fetch the PortingWebhookConfigurationFetchInstance + Asynchronously fetch the WebhookInstance - :returns: The fetched PortingWebhookConfigurationFetchInstance + :returns: The fetched WebhookInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - return PortingWebhookConfigurationFetchInstance(self._version, payload) + return WebhookInstance(self._version, payload) - async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: + async def fetch_async(self) -> WebhookInstance: """ - Asynchronously fetch the PortingWebhookConfigurationFetchInstance + Asynchronously fetch the WebhookInstance - :returns: The fetched PortingWebhookConfigurationFetchInstance + :returns: The fetched WebhookInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -94,7 +94,7 @@ async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: method="GET", uri=self._uri, headers=headers ) - return PortingWebhookConfigurationFetchInstance(self._version, payload) + return WebhookInstance(self._version, payload) def __repr__(self) -> str: """ @@ -102,4 +102,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" From ce5ce5d68511b26d60bb4a0f79a0597fe8b1adeb Mon Sep 17 00:00:00 2001 From: Twilio Date: Fri, 15 Nov 2024 07:18:24 +0000 Subject: [PATCH 10/12] Release 9.3.7 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index b769d7ff4..f46054d7e 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.3.6", + version="9.3.7", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 5fe186e28..86740d01f 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "3", "6") +__version_info__ = ("9", "3", "7") __version__ = ".".join(__version_info__) From bae3eca0fb53619a3796badd083406d04b907767 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 5 Dec 2024 10:12:33 +0000 Subject: [PATCH 11/12] [Librarian] Regenerated @ 45fa5159053e1c1f62f6d613f3b67a9239b43a5f 2551818144b7f525e66740ded45831b930db82b8 --- CHANGES.md | 16 ++ .../api/v2010/account/call/transcription.py | 6 + twilio/rest/numbers/v1/__init__.py | 24 +- ...=> porting_webhook_configuration_fetch.py} | 26 +- twilio/rest/numbers/v2/hosted_number_order.py | 140 +++++++++- twilio/twiml/voice_response.py | 251 ++++++++++++++++++ 6 files changed, 439 insertions(+), 24 deletions(-) rename twilio/rest/numbers/v1/{webhook.py => porting_webhook_configuration_fetch.py} (77%) diff --git a/CHANGES.md b/CHANGES.md index c879894ab..aa224e00f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,22 @@ twilio-python Changelog Here you can see the full list of changes between each twilio-python release. +[2024-12-05] Version 9.3.8 +-------------------------- +**Api** +- Add optional parameter `intelligence_service` to `transcription` +- Updated `phone_number_sid` to be populated for sip trunking terminating calls. + +**Numbers** +- Add Update Hosted Number Order V2 API endpoint +- Update Port in docs + +**Twiml** +- Add optional parameter `intelligence_service` to `` +- Add support for new `` and `` noun +- Add `events` attribute to `` verb + + [2024-11-15] Version 9.3.7 -------------------------- **Library - Chore** diff --git a/twilio/rest/api/v2010/account/call/transcription.py b/twilio/rest/api/v2010/account/call/transcription.py index d4aa87e3d..c649b8ad1 100644 --- a/twilio/rest/api/v2010/account/call/transcription.py +++ b/twilio/rest/api/v2010/account/call/transcription.py @@ -261,6 +261,7 @@ def create( speech_model: Union[str, object] = values.unset, hints: Union[str, object] = values.unset, enable_automatic_punctuation: Union[bool, object] = values.unset, + intelligence_service: Union[str, object] = values.unset, ) -> TranscriptionInstance: """ Create the TranscriptionInstance @@ -278,6 +279,7 @@ def create( :param speech_model: Recognition model used by the transcription engine, among those supported by the provider :param hints: A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. :param enable_automatic_punctuation: The provider will add punctuation to recognition result + :param intelligence_service: The SID or the unique name of the [IntelligentService](https://www.twilio.com/docs/voice/intelligence/api/service-resource) to process the transcription. :returns: The created TranscriptionInstance """ @@ -299,6 +301,7 @@ def create( "EnableAutomaticPunctuation": serialize.boolean_to_string( enable_automatic_punctuation ), + "IntelligenceService": intelligence_service, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -329,6 +332,7 @@ async def create_async( speech_model: Union[str, object] = values.unset, hints: Union[str, object] = values.unset, enable_automatic_punctuation: Union[bool, object] = values.unset, + intelligence_service: Union[str, object] = values.unset, ) -> TranscriptionInstance: """ Asynchronously create the TranscriptionInstance @@ -346,6 +350,7 @@ async def create_async( :param speech_model: Recognition model used by the transcription engine, among those supported by the provider :param hints: A Phrase contains words and phrase \\\"hints\\\" so that the speech recognition engine is more likely to recognize them. :param enable_automatic_punctuation: The provider will add punctuation to recognition result + :param intelligence_service: The SID or the unique name of the [IntelligentService](https://www.twilio.com/docs/voice/intelligence/api/service-resource) to process the transcription. :returns: The created TranscriptionInstance """ @@ -367,6 +372,7 @@ async def create_async( "EnableAutomaticPunctuation": serialize.boolean_to_string( enable_automatic_punctuation ), + "IntelligenceService": intelligence_service, } ) headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 68f078a88..043364c3d 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -28,10 +28,12 @@ from twilio.rest.numbers.v1.porting_webhook_configuration_delete import ( PortingWebhookConfigurationDeleteList, ) +from twilio.rest.numbers.v1.porting_webhook_configuration_fetch import ( + PortingWebhookConfigurationFetchList, +) from twilio.rest.numbers.v1.signing_request_configuration import ( SigningRequestConfigurationList, ) -from twilio.rest.numbers.v1.webhook import WebhookList class V1(Version): @@ -56,10 +58,12 @@ def __init__(self, domain: Domain): self._porting_webhook_configurations_delete: Optional[ PortingWebhookConfigurationDeleteList ] = None + self._porting_webhook_configuration_fetch: Optional[ + PortingWebhookConfigurationFetchList + ] = None self._signing_request_configurations: Optional[ SigningRequestConfigurationList ] = None - self._webhook: Optional[WebhookList] = None @property def bulk_eligibilities(self) -> BulkEligibilityList: @@ -107,18 +111,22 @@ def porting_webhook_configurations_delete( ) return self._porting_webhook_configurations_delete + @property + def porting_webhook_configuration_fetch( + self, + ) -> PortingWebhookConfigurationFetchList: + if self._porting_webhook_configuration_fetch is None: + self._porting_webhook_configuration_fetch = ( + PortingWebhookConfigurationFetchList(self) + ) + return self._porting_webhook_configuration_fetch + @property def signing_request_configurations(self) -> SigningRequestConfigurationList: if self._signing_request_configurations is None: self._signing_request_configurations = SigningRequestConfigurationList(self) return self._signing_request_configurations - @property - def webhook(self) -> WebhookList: - if self._webhook is None: - self._webhook = WebhookList(self) - return self._webhook - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/webhook.py b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py similarity index 77% rename from twilio/rest/numbers/v1/webhook.py rename to twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py index 88ca64e9e..89b8064bd 100644 --- a/twilio/rest/numbers/v1/webhook.py +++ b/twilio/rest/numbers/v1/porting_webhook_configuration_fetch.py @@ -21,7 +21,7 @@ from twilio.base.version import Version -class WebhookInstance(InstanceResource): +class PortingWebhookConfigurationFetchInstance(InstanceResource): """ :ivar url: The URL of the webhook configuration request :ivar port_in_target_url: The complete webhook url that will be called when a notification event for port in request or port in phone number happens @@ -52,14 +52,14 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" -class WebhookList(ListResource): +class PortingWebhookConfigurationFetchList(ListResource): def __init__(self, version: Version): """ - Initialize the WebhookList + Initialize the PortingWebhookConfigurationFetchList :param version: Version that contains the resource @@ -68,25 +68,25 @@ def __init__(self, version: Version): self._uri = "/Porting/Configuration/Webhook" - def fetch(self) -> WebhookInstance: + def fetch(self) -> PortingWebhookConfigurationFetchInstance: """ - Asynchronously fetch the WebhookInstance + Asynchronously fetch the PortingWebhookConfigurationFetchInstance - :returns: The fetched WebhookInstance + :returns: The fetched PortingWebhookConfigurationFetchInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) payload = self._version.fetch(method="GET", uri=self._uri, headers=headers) - return WebhookInstance(self._version, payload) + return PortingWebhookConfigurationFetchInstance(self._version, payload) - async def fetch_async(self) -> WebhookInstance: + async def fetch_async(self) -> PortingWebhookConfigurationFetchInstance: """ - Asynchronously fetch the WebhookInstance + Asynchronously fetch the PortingWebhookConfigurationFetchInstance - :returns: The fetched WebhookInstance + :returns: The fetched PortingWebhookConfigurationFetchInstance """ headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) @@ -94,7 +94,7 @@ async def fetch_async(self) -> WebhookInstance: method="GET", uri=self._uri, headers=headers ) - return WebhookInstance(self._version, payload) + return PortingWebhookConfigurationFetchInstance(self._version, payload) def __repr__(self) -> str: """ @@ -102,4 +102,4 @@ def __repr__(self) -> str: :returns: Machine friendly representation """ - return "" + return "" diff --git a/twilio/rest/numbers/v2/hosted_number_order.py b/twilio/rest/numbers/v2/hosted_number_order.py index b2660cfc3..0fab0fe34 100644 --- a/twilio/rest/numbers/v2/hosted_number_order.py +++ b/twilio/rest/numbers/v2/hosted_number_order.py @@ -26,6 +26,7 @@ class HostedNumberOrderInstance(InstanceResource): class Status(object): RECEIVED = "received" + PENDING_VERIFICATION = "pending-verification" VERIFIED = "verified" PENDING_LOA = "pending-loa" CARRIER_PROCESSING = "carrier-processing" @@ -33,6 +34,9 @@ class Status(object): FAILED = "failed" ACTION_REQUIRED = "action-required" + class VerificationType(object): + PHONE_CALL = "phone-call" + """ :ivar sid: A 34 character string that uniquely identifies this HostedNumberOrder. :ivar account_sid: A 34 character string that uniquely identifies the account. @@ -53,6 +57,12 @@ class Status(object): :ivar contact_phone_number: The contact phone number of the person authorized to sign the Authorization Document. :ivar bulk_hosting_request_sid: A 34 character string that uniquely identifies the bulk hosting request associated with this HostedNumberOrder. :ivar next_step: The next step you need to take to complete the hosted number order and request it successfully. + :ivar verification_attempts: The number of attempts made to verify ownership via a call for the hosted phone number. + :ivar verification_call_sids: The Call SIDs that identify the calls placed to verify ownership. + :ivar verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :ivar verification_call_extension: The numerical extension to dial when making the ownership verification call. + :ivar verification_code: The digits the user must pass in the ownership verification call. + :ivar verification_type: """ def __init__( @@ -89,6 +99,22 @@ def __init__( "bulk_hosting_request_sid" ) self.next_step: Optional[str] = payload.get("next_step") + self.verification_attempts: Optional[int] = deserialize.integer( + payload.get("verification_attempts") + ) + self.verification_call_sids: Optional[List[str]] = payload.get( + "verification_call_sids" + ) + self.verification_call_delay: Optional[int] = deserialize.integer( + payload.get("verification_call_delay") + ) + self.verification_call_extension: Optional[str] = payload.get( + "verification_call_extension" + ) + self.verification_code: Optional[str] = payload.get("verification_code") + self.verification_type: Optional[ + "HostedNumberOrderInstance.VerificationType" + ] = payload.get("verification_type") self._solution = { "sid": sid or self.sid, @@ -146,6 +172,48 @@ async def fetch_async(self) -> "HostedNumberOrderInstance": """ return await self._proxy.fetch_async() + def update( + self, + status: "HostedNumberOrderInstance.Status", + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + ) -> "HostedNumberOrderInstance": + """ + Update the HostedNumberOrderInstance + + :param status: + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + + :returns: The updated HostedNumberOrderInstance + """ + return self._proxy.update( + status=status, + verification_call_delay=verification_call_delay, + verification_call_extension=verification_call_extension, + ) + + async def update_async( + self, + status: "HostedNumberOrderInstance.Status", + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + ) -> "HostedNumberOrderInstance": + """ + Asynchronous coroutine to update the HostedNumberOrderInstance + + :param status: + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + + :returns: The updated HostedNumberOrderInstance + """ + return await self._proxy.update_async( + status=status, + verification_call_delay=verification_call_delay, + verification_call_extension=verification_call_extension, + ) + def __repr__(self) -> str: """ Provide a friendly representation @@ -163,7 +231,7 @@ def __init__(self, version: Version, sid: str): Initialize the HostedNumberOrderContext :param version: Version that contains the resource - :param sid: A 34 character string that uniquely identifies this HostedNumberOrder. + :param sid: The SID of the HostedNumberOrder resource to update. """ super().__init__(version) @@ -235,6 +303,72 @@ async def fetch_async(self) -> HostedNumberOrderInstance: sid=self._solution["sid"], ) + def update( + self, + status: "HostedNumberOrderInstance.Status", + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + ) -> HostedNumberOrderInstance: + """ + Update the HostedNumberOrderInstance + + :param status: + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + + :returns: The updated HostedNumberOrderInstance + """ + data = values.of( + { + "Status": status, + "VerificationCallDelay": verification_call_delay, + "VerificationCallExtension": verification_call_extension, + } + ) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return HostedNumberOrderInstance( + self._version, payload, sid=self._solution["sid"] + ) + + async def update_async( + self, + status: "HostedNumberOrderInstance.Status", + verification_call_delay: Union[int, object] = values.unset, + verification_call_extension: Union[str, object] = values.unset, + ) -> HostedNumberOrderInstance: + """ + Asynchronous coroutine to update the HostedNumberOrderInstance + + :param status: + :param verification_call_delay: The number of seconds to wait before initiating the ownership verification call. Can be a value between 0 and 60, inclusive. + :param verification_call_extension: The numerical extension to dial when making the ownership verification call. + + :returns: The updated HostedNumberOrderInstance + """ + data = values.of( + { + "Status": status, + "VerificationCallDelay": verification_call_delay, + "VerificationCallExtension": verification_call_extension, + } + ) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return HostedNumberOrderInstance( + self._version, payload, sid=self._solution["sid"] + ) + def __repr__(self) -> str: """ Provide a friendly representation @@ -698,7 +832,7 @@ def get(self, sid: str) -> HostedNumberOrderContext: """ Constructs a HostedNumberOrderContext - :param sid: A 34 character string that uniquely identifies this HostedNumberOrder. + :param sid: The SID of the HostedNumberOrder resource to update. """ return HostedNumberOrderContext(self._version, sid=sid) @@ -706,7 +840,7 @@ def __call__(self, sid: str) -> HostedNumberOrderContext: """ Constructs a HostedNumberOrderContext - :param sid: A 34 character string that uniquely identifies this HostedNumberOrder. + :param sid: The SID of the HostedNumberOrder resource to update. """ return HostedNumberOrderContext(self._version, sid=sid) diff --git a/twilio/twiml/voice_response.py b/twilio/twiml/voice_response.py index c6d453e14..6f3d17e92 100644 --- a/twilio/twiml/voice_response.py +++ b/twilio/twiml/voice_response.py @@ -50,6 +50,7 @@ def dial( sequential=None, refer_url=None, refer_method=None, + events=None, **kwargs ): """ @@ -73,6 +74,7 @@ def dial( :param sequential: Used to determine if child TwiML nouns should be dialed in order, one after the other (sequential) or dial all at once (parallel). Default is false, parallel :param refer_url: Webhook that will receive future SIP REFER requests :param refer_method: The HTTP method to use for the refer Webhook + :param events: Subscription to events :param kwargs: additional attributes :returns: element @@ -97,6 +99,7 @@ def dial( sequential=sequential, refer_url=refer_url, refer_method=refer_method, + events=events, **kwargs ) ) @@ -678,6 +681,7 @@ def transcription( speech_model=None, hints=None, enable_automatic_punctuation=None, + intelligence_service=None, **kwargs ): """ @@ -696,6 +700,7 @@ def transcription( :param speech_model: Speech Model used by the transcription engine :param hints: Hints to be provided to the transcription engine :param enable_automatic_punctuation: Enable Automatic Punctuation + :param intelligence_service: The SID or the unique name of the Intelligence Service to be used :param kwargs: additional attributes :returns: element @@ -715,6 +720,7 @@ def transcription( speech_model=speech_model, hints=hints, enable_automatic_punctuation=enable_automatic_punctuation, + intelligence_service=intelligence_service, **kwargs ) ) @@ -897,6 +903,7 @@ def transcription( speech_model=None, hints=None, enable_automatic_punctuation=None, + intelligence_service=None, **kwargs ): """ @@ -915,6 +922,7 @@ def transcription( :param speech_model: Speech Model used by the transcription engine :param hints: Hints to be provided to the transcription engine :param enable_automatic_punctuation: Enable Automatic Punctuation + :param intelligence_service: The SID or the unique name of the Intelligence Service to be used :param kwargs: additional attributes :returns: element @@ -934,6 +942,7 @@ def transcription( speech_model=speech_model, hints=hints, enable_automatic_punctuation=enable_automatic_punctuation, + intelligence_service=intelligence_service, **kwargs ) ) @@ -2725,6 +2734,248 @@ def conversation( ) ) + def conversation_relay( + self, + url=None, + language=None, + tts_language=None, + transcription_language=None, + tts_provider=None, + voice=None, + transcription_provider=None, + speech_model=None, + profanity_filter=None, + dtmf_detection=None, + welcome_greeting=None, + partial_prompts=None, + interruptible=None, + interrupt_by_dtmf=None, + welcome_greeting_interruptible=None, + debug=None, + **kwargs + ): + """ + Create a element + + :param url: URL of the remote service where the session is connected to + :param language: Language to be used for both text-to-speech and transcription + :param tts_language: Language to be used for text-to-speech + :param transcription_language: Language to be used for transcription + :param tts_provider: Provider to be used for text-to-speech + :param voice: Voice to be used for text-to-speech + :param transcription_provider: Provider to be used for transcription + :param speech_model: Speech model to be used for transcription + :param profanity_filter: Whether profanities should be filtered out of the speech transcription + :param dtmf_detection: Whether DTMF tones should be detected and reported in speech transcription + :param welcome_greeting: The sentence to be played automatically when the session is connected + :param partial_prompts: Whether partial prompts should be reported to WebSocket server before the caller finishes speaking + :param interruptible: Whether caller's speaking can interrupt the play of text-to-speech + :param interrupt_by_dtmf: Whether DTMF tone can interrupt the play of text-to-speech + :param welcome_greeting_interruptible: Whether caller's speaking can interrupt the welcome greeting + :param debug: Whether debugging on the session is enabled + :param kwargs: additional attributes + + :returns: element + """ + return self.nest( + ConversationRelay( + url=url, + language=language, + tts_language=tts_language, + transcription_language=transcription_language, + tts_provider=tts_provider, + voice=voice, + transcription_provider=transcription_provider, + speech_model=speech_model, + profanity_filter=profanity_filter, + dtmf_detection=dtmf_detection, + welcome_greeting=welcome_greeting, + partial_prompts=partial_prompts, + interruptible=interruptible, + interrupt_by_dtmf=interrupt_by_dtmf, + welcome_greeting_interruptible=welcome_greeting_interruptible, + debug=debug, + **kwargs + ) + ) + + def assistant( + self, + id=None, + language=None, + tts_language=None, + transcription_language=None, + tts_provider=None, + voice=None, + transcription_provider=None, + speech_model=None, + profanity_filter=None, + dtmf_detection=None, + welcome_greeting=None, + partial_prompts=None, + interruptible=None, + interrupt_by_dtmf=None, + welcome_greeting_interruptible=None, + debug=None, + **kwargs + ): + """ + Create a element + + :param id: The assistant ID of the AI Assistant + :param language: Language to be used for both text-to-speech and transcription + :param tts_language: Language to be used for text-to-speech + :param transcription_language: Language to be used for transcription + :param tts_provider: Provider to be used for text-to-speech + :param voice: Voice to be used for text-to-speech + :param transcription_provider: Provider to be used for transcription + :param speech_model: Speech model to be used for transcription + :param profanity_filter: Whether profanities should be filtered out of the speech transcription + :param dtmf_detection: Whether DTMF tones should be detected and reported in speech transcription + :param welcome_greeting: The sentence to be played automatically when the session is connected + :param partial_prompts: Whether partial prompts should be reported to WebSocket server before the caller finishes speaking + :param interruptible: Whether caller's speaking can interrupt the play of text-to-speech + :param interrupt_by_dtmf: Whether DTMF tone can interrupt the play of text-to-speech + :param welcome_greeting_interruptible: Whether caller's speaking can interrupt the welcome greeting + :param debug: Whether debugging on the session is enabled + :param kwargs: additional attributes + + :returns: element + """ + return self.nest( + Assistant( + id=id, + language=language, + tts_language=tts_language, + transcription_language=transcription_language, + tts_provider=tts_provider, + voice=voice, + transcription_provider=transcription_provider, + speech_model=speech_model, + profanity_filter=profanity_filter, + dtmf_detection=dtmf_detection, + welcome_greeting=welcome_greeting, + partial_prompts=partial_prompts, + interruptible=interruptible, + interrupt_by_dtmf=interrupt_by_dtmf, + welcome_greeting_interruptible=welcome_greeting_interruptible, + debug=debug, + **kwargs + ) + ) + + +class Assistant(TwiML): + """ TwiML Noun""" + + def __init__(self, **kwargs): + super(Assistant, self).__init__(**kwargs) + self.name = "Assistant" + + def language( + self, + code=None, + tts_provider=None, + voice=None, + transcription_provider=None, + speech_model=None, + **kwargs + ): + """ + Create a element + + :param code: Language code of this language setting is for + :param tts_provider: Provider to be used for text-to-speech of this language + :param voice: Voice to be used for text-to-speech of this language + :param transcription_provider: Provider to be used for transcription of this language + :param speech_model: Speech model to be used for transcription of this language + :param kwargs: additional attributes + + :returns: element + """ + return self.nest( + Language( + code=code, + tts_provider=tts_provider, + voice=voice, + transcription_provider=transcription_provider, + speech_model=speech_model, + **kwargs + ) + ) + + def parameter(self, name=None, value=None, **kwargs): + """ + Create a element + + :param name: The name of the custom parameter + :param value: The value of the custom parameter + :param kwargs: additional attributes + + :returns: element + """ + return self.nest(Parameter(name=name, value=value, **kwargs)) + + +class Language(TwiML): + """ TwiML Noun""" + + def __init__(self, **kwargs): + super(Language, self).__init__(**kwargs) + self.name = "Language" + + +class ConversationRelay(TwiML): + """ TwiML Noun""" + + def __init__(self, **kwargs): + super(ConversationRelay, self).__init__(**kwargs) + self.name = "ConversationRelay" + + def language( + self, + code=None, + tts_provider=None, + voice=None, + transcription_provider=None, + speech_model=None, + **kwargs + ): + """ + Create a element + + :param code: Language code of this language setting is for + :param tts_provider: Provider to be used for text-to-speech of this language + :param voice: Voice to be used for text-to-speech of this language + :param transcription_provider: Provider to be used for transcription of this language + :param speech_model: Speech model to be used for transcription of this language + :param kwargs: additional attributes + + :returns: element + """ + return self.nest( + Language( + code=code, + tts_provider=tts_provider, + voice=voice, + transcription_provider=transcription_provider, + speech_model=speech_model, + **kwargs + ) + ) + + def parameter(self, name=None, value=None, **kwargs): + """ + Create a element + + :param name: The name of the custom parameter + :param value: The value of the custom parameter + :param kwargs: additional attributes + + :returns: element + """ + return self.nest(Parameter(name=name, value=value, **kwargs)) + class Conversation(TwiML): """ TwiML Noun""" From fb5388940759d6e7db9cbfcd05b2cd91d883bff6 Mon Sep 17 00:00:00 2001 From: Twilio Date: Thu, 5 Dec 2024 10:17:17 +0000 Subject: [PATCH 12/12] Release 9.3.8 --- setup.py | 2 +- twilio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index f46054d7e..016e3b95c 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="twilio", - version="9.3.7", + version="9.3.8", description="Twilio API client and TwiML generator", author="Twilio", help_center="https://www.twilio.com/help/contact", diff --git a/twilio/__init__.py b/twilio/__init__.py index 86740d01f..a574bfeb0 100644 --- a/twilio/__init__.py +++ b/twilio/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ("9", "3", "7") +__version_info__ = ("9", "3", "8") __version__ = ".".join(__version_info__)