8000 [Librarian] Regenerated @ 2e932f6c59e0f9fb6cb96952802e5ebedd83b6f0 18… · twilio/twilio-python@086bc6b · GitHub
[go: up one dir, main page]

Skip to content

Commit 086bc6b

Browse files
committed
[Librarian] Regenerated @ 2e932f6c59e0f9fb6cb96952802e5ebedd83b6f0 1852557f82faade033dbd5bd0615c9e1aa4d9fae
1 parent 9f1414d commit 086bc6b

File tree

8 files changed

+612
-130
lines changed

8 files changed

+612
-130
lines changed

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ twilio-python Changelog
33

44
Here you can see the full list of changes between each twilio-python release.
55

6+
[2024-10-24] Version 9.3.5
7+
--------------------------
8+
**Conversations**
9+
- Expose ConversationWithParticipants resource that allows creating a conversation with participants
10+
11+
612
[2024-10-17] Version 9.3.4
713
--------------------------
814
**Api**

twilio/rest/conversations/v1/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
from twilio.rest.conversations.v1.address_configuration import AddressConfigurationList
1919
from twilio.rest.conversations.v1.configuration import ConfigurationList
2020
from twilio.rest.conversations.v1.conversation import ConversationList
21+
from twilio.rest.conversations.v1.conversation_with_participants import (
22+
ConversationWithParticipantsList,
23+
)
2124
from twilio.rest.conversations.v1.credential import CredentialList
2225
from twilio.rest.conversations.v1.participant_conversation import (
2326
ParticipantConversationList,
@@ -39,6 +42,9 @@ def __init__(self, domain: Domain):
3942
self._address_configurations: Optional[AddressConfigurationList] = None
4043
self._configuration: Optional[ConfigurationList] = None
4144
self._conversations: Optional[ConversationList] = None
45+
self._conversation_with_participants: Optional[
46+
ConversationWithParticipantsList
47+
] = None
4248
self._credentials: Optional[CredentialList] = None
4349
self._participant_conversations: Optional[ParticipantConversationList] = None
4450
self._roles: Optional[RoleList] = None
@@ -63,6 +69,14 @@ def conversations(self) -> ConversationList:
6369
self._conversations = ConversationList(self)
6470
return self._conversations
6571

72+
@property
73+
def conversation_with_participants(self) -> ConversationWithParticipantsList:
74+
if self._conversation_with_participants is None:
75+
self._conversation_with_participants = ConversationWithParticipantsList(
76+
self
77+
)
78+
return self._conversation_with_participants
79+
6680
@property
6781
def credentials(self) -> CredentialList:
6882
if self._credentials is None:
Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
r"""
2+
This code was generated by
3+
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4+
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5+
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6+
7+
Twilio - Conversations
8+
This is the public Twilio REST API.
9+
10+
NOTE: This class is auto generated by OpenAPI Generator.
11+
https://openapi-generator.tech
12+
Do not edit the class manually.
13+
"""
14+
15+
from datetime import datetime
16+
from typing import Any, Dict, List, Optional, Union
17+
from twilio.base import deserialize, serialize, values
18+
19+
from twilio.base.instance_resource import InstanceResource
20+
from twilio.base.list_resource import ListResource
21+
from twilio.base.version import Version
22+
23+
24+
class ConversationWithParticipantsInstance(InstanceResource):
25+
26+
class State(object):
27+
INACTIVE = "inactive"
28+
ACTIVE = "active"
29+
CLOSED = "closed"
30+
31+
class WebhookEnabledType(object):
32+
TRUE = "true"
33+
FALSE = "false"
34+
35+
"""
36+
:ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation.
37+
:ivar chat_service_sid: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to.
38+
:ivar messaging_service_sid: The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to.
39+
:ivar sid: A 34 character string that uniquely identifies this resource.
40+
:ivar friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional.
41+
: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.
42+
: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.
43+
:ivar state:
44+
:ivar date_created: The date that this resource was created.
45+
:ivar date_updated: The date that this resource was last updated.
46+
:ivar timers: Timer date values representing state update for this conversation.
47+
: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.
48+
:ivar bindings:
49+
:ivar url: An absolute API resource URL for this conversation.
50+
"""
51+
52+
def __init__(self, version: Version, payload: Dict[str, Any]):
53+
super().__init__(version)
54+
55+
self.account_sid: Optional[str] = payload.get("account_sid")
56+
self.chat_service_sid: Optional[str] = payload.get("chat_service_sid")
57+
self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid")
58+
self.sid: Optional[str] = payload.get("sid")
59+
self.friendly_name: Optional[str] = payload.get("friendly_name")
60+
self.unique_name: Optional[str] = payload.get("unique_name")
61+
self.attributes: Optional[str] = payload.get("attributes")
62+
self.state: Optional["ConversationWithParticipantsInstance.State"] = (
63+
payload.get("state")
64+
)
65+
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
66+
payload.get("date_created")
67+
)
68+
self.date_updated: Optional[datetime] = deserialize.iso8601_datetime(
69+
payload.get("date_updated")
70+
)
71+
self.timers: Optional[Dict[str, object]] = payload.get("timers")
72+
self.links: Optional[Dict[str, object]] = payload.get("links")
73+
self.bindings: Optional[Dict[str, object]] = payload.get("bindings")
74+
self.url: Optional[str] = payload.get("url")
75+
76+
def __repr__(self) -> str:
77+
"""
78+
Provide a friendly representation
79+
80+
:returns: Machine friendly representation
81+
"""
82+
83+
return "<Twilio.Conversations.V1.ConversationWithParticipantsInstance>"
84+
85+
86+
class ConversationWithParticipantsList(ListResource):
87+
88+
def __init__(self, version: Version):
89+
"""
90+
Initialize the ConversationWithParticipantsList
91+
92+
:param version: Version that contains the resource
93+
94+
"""
95+
super().__init__(version)
96+
97+
self._uri = "/ConversationWithParticipants"
98+
99+
def create(
100+
self,
101+
x_twilio_webhook_enabled: Union[
102+
"ConversationWithParticipantsInstance.WebhookEnabledType", object
103+
] = values.unset,
104+
friendly_name: Union[str, object] = values.unset,
105+
unique_name: Union[str, object] = values.unset,
106+
date_created: Union[datetime, object] = values.unset,
107+
date_updated: Union[datetime, object] = values.unset,
108+
messaging_service_sid: Union[str, object] = values.unset,
109+
attributes: Union[str, object] = values.unset,
110+
state: Union[
111+
"ConversationWithParticipantsInstance.State", object
112+
] = values.unset,
113+
timers_inactive: Union[str, object] = values.unset,
114+
timers_closed: Union[str, object] = values.unset,
115+
bindings_email_address: Union[str, object] = values.unset,
116+
bindings_email_name: Union[str, object] = values.unset,
117+
participant: Union[List[str], object] = values.unset,
118+
) -> ConversationWithParticipantsInstance:
119+
"""
120+
Create the ConversationWithParticipantsInstance
121+
122+
:param x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header
123+
:param friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional.
124+
: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.
125+
:param date_created: The date that this resource was created.
126+
:param date_updated: The date that this resource was last updated.
127+
:param messaging_service_sid: The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to.
128+
: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.
129+
:param state:
130+
:param timers_inactive: ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute.
131+
:param timers_closed: ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes.
132+
:param bindings_email_address: The default email address that will be used when sending outbound emails in this conversation.
133+
:param bindings_email_name: The default name that will be used when sending outbound emails in this conversation.
134+
: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.
135+
136+
:returns: The created ConversationWithParticipantsInstance
137+
"""
138+
139+
data = values.of(
140+
{
141+
"FriendlyName": friendly_name,
142+
"UniqueName": unique_name,
143+
"DateCreated": serialize.iso8601_datetime(date_created),
144+
"DateUpdated": serialize.iso8601_datetime(date_updated),
145+
"MessagingServiceSid": messaging_service_sid,
146+
"Attributes": attributes,
147+
"State": state,
148+
"Timers.Inactive": timers_inactive,
149+
"Timers.Closed": timers_closed,
150+
"Bindings.Email.Address": bindings_email_address,
151+
"Bindings.Email.Name": bindings_email_name,
152+
"Participant": serialize.map(participant, lambda e: e),
153+
}
154+
)
155+
headers = values.of(
156+
{
157+
"X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled,
158+
"Content-Type": "application/x-www-form-urlencoded",
159+
}
160+
)
161+
162+
payload = self._version.create(
163+
method="POST", uri=self._uri, data=data, headers=headers
164+
)
165+
166+
return ConversationWithParticipantsInstance(self._version, payload)
167+
168+
async def create_async(
169+
self,
170+
x_twilio_webhook_enabled: Union[
171+
"ConversationWithParticipantsInstance.WebhookEnabledType", object
172+
] = values.unset,
173+
friendly_name: Union[str, object] = values.unset,
174+
unique_name: Union[str, object] = values.unset,
175+
date_created: Union[datetime, object] = values.unset,
176+
date_updated: Union[datetime, object] = values.unset,
177+
messaging_service_sid: Union[str, object] = values.unset,
178+
attributes: Union[str, object] = values.unset,
179+
state: Union[
180+
"ConversationWithParticipantsInstance.State", object
181+
] = values.unset,
182+
timers_inactive: Union[str, object] = values.unset,
183+
timers_closed: Union[str, object] = values.unset,
184+
bindings_email_address: Union[str, object] = values.unset,
185+
bindings_email_name: Union[str, object] = values.unset,
186+
participant: Union[List[str], object] = values.unset,
187+
) -> ConversationWithParticipantsInstance:
188+
"""
189+
Asynchronously create the ConversationWithParticipantsInstance
190+
191+
:param x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header
192+
:param friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional.
193+
: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.
194+
:param date_created: The date that this resource was created.
195+
:param date_updated: The date that this resource was last updated.
196+
:param messaging_service_sid: The unique ID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) this conversation belongs to.
197+
: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.
198+
:param state:
199+
:param timers_inactive: ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute.
200+
:param timers_closed: ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes.
201+
:param bindings_email_address: The default email address that will be used when sending outbound emails in this conversation.
202+
:param bindings_email_name: The default name that will be used when sending outbound emails in this conversation.
203+
: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.
204+
205+
:returns: The created ConversationWithParticipantsInstance
206+
"""
207+
208+
data = values.of(
209+
{
210+
"FriendlyName": friendly_name,
211+
"UniqueName": unique_name,
212+
"DateCreated": serialize.iso8601_datetime(date_created),
213+
"DateUpdated": serialize.iso8601_datetime(date_updated),
214+
"MessagingServiceSid": messaging_service_sid,
215+
"Attributes": attributes,
216+
"State": state,
217+
"Timers.Inactive": timers_inactive,
218+
"Timers.Closed": timers_closed,
219+
"Bindings.Email.Address": bindings_email_address,
220+
"Bindings.Email.Name": bindings_email_name,
221+
"Participant": serialize.map(participant, lambda e: e),
222+
}
223+
)
224+
headers = values.of(
225+
{
226+
"X-Twilio-Webhook-Enabled": x_twilio_webhook_enabled,
227+
"Content-Type": "application/x-www-form-urlencoded",
228+
}
229+
)
230+
231+
payload = await self._version.create_async(
232+
method="POST", uri=self._uri, data=data, headers=headers
233+
)
234+
235+
return ConversationWithParticipantsInstance(self._version, payload)
236+
237+
def __repr__(self) -> str:
238+
"""
239+
Provide a friendly representation
240+
241+
:returns: Machine friendly representation
242+
"""
243+
return "<Twilio.Conversations.V1.ConversationWithParticipantsList>"

twilio/rest/conversations/v1/service/__init__.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
from twilio.rest.conversations.v1.service.binding import BindingList
2424
from twilio.rest.conversations.v1.service.configuration import ConfigurationList
2525
from twilio.rest.conversations.v1.service.conversation import ConversationList
26+
from twilio.rest.conversations.v1.service.conversation_with_participants import (
27+
ConversationWithParticipantsList,
28+
)
2629
from twilio.rest.conversations.v1.service.participant_conversation import (
2730
ParticipantConversationList,
2831
)
@@ -135,6 +138,13 @@ def conversations(self) -> ConversationList:
135138
"""
136139
return self._proxy.conversations
137140

141+
@property
142+
def conversation_with_participants(self) -> ConversationWithParticipantsList:
143+
"""
144+
Access the conversation_with_participants
145+
"""
146+
return self._proxy.conversation_with_participants
147+
138148
@property
139149
def participant_conversations(self) -> ParticipantConversationList:
140150
"""
@@ -186,6 +196,9 @@ def __init__(self, version: Version, sid: str):
186196
self._bindings: Optional[BindingList] = None
187197
self._configuration: Optional[ConfigurationList] = None
188198
self._conversations: Optional[ConversationList] = None
199+
self._conversation_with_participants: Optional[
200+
ConversationWithParticipantsList
201+
] = None
189202
self._participant_conversations: Optional[ParticipantConversationList] = None
190203
self._roles: Optional[RoleList] = None
191204
self._users: Optional[UserList] = None
@@ -288,6 +301,18 @@ def conversations(self) -> ConversationList:
288301
)
289302
return self._conversations
290303

304+
@property
305+
def conversation_with_participants(self) -> ConversationWithParticipantsList:
306+
"""
307+
Access the conversation_with_participants
308+
"""
309+
if self._conversation_with_participants is None:
310+
self._conversation_with_participants = ConversationWithParticipantsList(
311+
self._version,
312+
self._solution["sid"],
313+
)
314+
return self._conversation_with_participants
315+
291316
@property
292317
def participant_conversations(self) -> ParticipantConversationList:
293318
"""

0 commit comments

Comments
 (0)
0