Skip to content

Commit

Permalink
[Librarian] Regenerated @ 08245333f4a8c9235d547b189cd9c422f73e0e7e 7b…
Browse files Browse the repository at this point in the history
…b98153c25ebfee95e6e85bd4c57969e6d02435
  • Loading branch information
twilio-dx committed Sep 25, 2024
1 parent 4168b09 commit 75e8b14
Show file tree
Hide file tree
Showing 14 changed files with 1,778 additions and 32 deletions.
11 changes: 11 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ twilio-python Changelog

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

[2024-09-25] Version 9.3.2
--------------------------
**Accounts**
- Update docs and mounts.
- Change library visibility to public
- Enable consent and contact bulk upsert APIs in prod.

**Serverless**
- Add is_plugin parameter in deployments api to check if it is plugins deployment


[2024-09-18] Version 9.3.1
--------------------------
**Library - Chore**
Expand Down
16 changes: 16 additions & 0 deletions twilio/rest/accounts/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from twilio.base.version import Version
from twilio.base.domain import Domain
from twilio.rest.accounts.v1.auth_token_promotion import AuthTokenPromotionList
from twilio.rest.accounts.v1.bulk_consents import BulkConsentsList
from twilio.rest.accounts.v1.bulk_contacts import BulkContactsList
from twilio.rest.accounts.v1.credential import CredentialList
from twilio.rest.accounts.v1.safelist import SafelistList
from twilio.rest.accounts.v1.secondary_auth_token import SecondaryAuthTokenList
Expand All @@ -31,6 +33,8 @@ def __init__(self, domain: Domain):
"""
super().__init__(domain, "v1")
self._auth_token_promotion: Optional[AuthTokenPromotionList] = None
self._bulk_consents: Optional[BulkConsentsList] = None
self._bulk_contacts: Optional[BulkContactsList] = None
self._credentials: Optional[CredentialList] = None
self._safelist: Optional[SafelistList] = None
self._secondary_auth_token: Optional[SecondaryAuthTokenList] = None
Expand All @@ -41,6 +45,18 @@ def auth_token_promotion(self) -> AuthTokenPromotionList:
self._auth_token_promotion = AuthTokenPromotionList(self)
return self._auth_token_promotion

@property
def bulk_consents(self) -> BulkConsentsList:
if self._bulk_consents is None:
self._bulk_consents = BulkConsentsList(self)
return self._bulk_consents

@property
def bulk_contacts(self) -> BulkContactsList:
if self._bulk_contacts is None:
self._bulk_contacts = BulkContactsList(self)
return self._bulk_contacts

@property
def credentials(self) -> CredentialList:
if self._credentials is None:
Expand Down
106 changes: 106 additions & 0 deletions twilio/rest/accounts/v1/bulk_consents.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
r"""
This code was generated by
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
Twilio - Accounts
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 typing import Any, Dict, List, Optional
from twilio.base import serialize, values

from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource import ListResource
from twilio.base.version import Version


class BulkConsentsInstance(InstanceResource):
"""
:ivar items: A list of objects where each object represents the result of processing a `correlation_id`. Each object contains the following fields: `correlation_id`, a unique 32-character UUID that maps the response to the original request; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty.
"""

def __init__(self, version: Version, payload: Dict[str, Any]):
super().__init__(version)

self.items: Optional[Dict[str, object]] = payload.get("items")

def __repr__(self) -> str:
"""
Provide a friendly representation
:returns: Machine friendly representation
"""

return "<Twilio.Accounts.V1.BulkConsentsInstance>"


class BulkConsentsList(ListResource):

def __init__(self, version: Version):
"""
Initialize the BulkConsentsList
:param version: Version that contains the resource
"""
super().__init__(version)

self._uri = "/Consents/Bulk"

def create(self, items: List[object]) -> BulkConsentsInstance:
"""
Create the BulkConsentsInstance
:param items: This is a list of objects that describes a contact's opt-in status. Each object contains the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID used to uniquely map the request item with the response item; `sender_id`, which can be either a valid messaging service SID or a from phone number; `status`, a string representing the consent status. Can be one of [`opt-in`, `opt-out`]; and `source`, a string indicating the medium through which the consent was collected. Can be one of [`website`, `offline`, `opt-in-message`, `opt-out-message`, `others`].
:returns: The created BulkConsentsInstance
"""

data = values.of(
{
"Items": serialize.map(items, lambda e: serialize.object(e)),
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = self._version.create(
method="POST", uri=self._uri, data=data, headers=headers
)

return BulkConsentsInstance(self._version, payload)

async def create_async(self, items: List[object]) -> BulkConsentsInstance:
"""
Asynchronously create the BulkConsentsInstance
:param items: This is a list of objects that describes a contact's opt-in status. Each object contains the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID used to uniquely map the request item with the response item; `sender_id`, which can be either a valid messaging service SID or a from phone number; `status`, a string representing the consent status. Can be one of [`opt-in`, `opt-out`]; and `source`, a string indicating the medium through which the consent was collected. Can be one of [`website`, `offline`, `opt-in-message`, `opt-out-message`, `others`].
:returns: The created BulkConsentsInstance
"""

data = values.of(
{
"Items": serialize.map(items, lambda e: serialize.object(e)),
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = await self._version.create_async(
method="POST", uri=self._uri, data=data, headers=headers
)

return BulkConsentsInstance(self._version, payload)

def __repr__(self) -> str:
"""
Provide a friendly representation
:returns: Machine friendly representation
"""
return "<Twilio.Accounts.V1.BulkConsentsList>"
106 changes: 106 additions & 0 deletions twilio/rest/accounts/v1/bulk_contacts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
r"""
This code was generated by
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
Twilio - Accounts
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 typing import Any, Dict, List, Optional
from twilio.base import serialize, values

from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource import ListResource
from twilio.base.version import Version


class BulkContactsInstance(InstanceResource):
"""
:ivar items: A list of objects where each object represents the result of processing a `correlation_id`. Each object contains the following fields: `correlation_id`, a unique 32-character UUID that maps the response to the original request; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty.
"""

def __init__(self, version: Version, payload: Dict[str, Any]):
super().__init__(version)

self.items: Optional[Dict[str, object]] = payload.get("items")

def __repr__(self) -> str:
"""
Provide a friendly representation
:returns: Machine friendly representation
"""

return "<Twilio.Accounts.V1.BulkContactsInstance>"


class BulkContactsList(ListResource):

def __init__(self, version: Version):
"""
Initialize the BulkContactsList
:param version: Version that contains the resource
"""
super().__init__(version)

self._uri = "/Contacts/Bulk"

def create(self, items: List[object]) -> BulkContactsInstance:
"""
Create the BulkContactsInstance
:param items: A list of objects where each object represents a contact's details. Each object includes the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID that maps the response to the original request; `country_iso_code`, a string representing the country using the ISO format (e.g., US for the United States); and `zip_code`, a string representing the postal code.
:returns: The created BulkContactsInstance
"""

data = values.of(
{
"Items": serialize.map(items, lambda e: serialize.object(e)),
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = self._version.create(
method="POST", uri=self._uri, data=data, headers=headers
)

return BulkContactsInstance(self._version, payload)

async def create_async(self, items: List[object]) -> BulkContactsInstance:
"""
Asynchronously create the BulkContactsInstance
:param items: A list of objects where each object represents a contact's details. Each object includes the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID that maps the response to the original request; `country_iso_code`, a string representing the country using the ISO format (e.g., US for the United States); and `zip_code`, a string representing the postal code.
:returns: The created BulkContactsInstance
"""

data = values.of(
{
"Items": serialize.map(items, lambda e: serialize.object(e)),
}
)
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

payload = await self._version.create_async(
method="POST", uri=self._uri, data=data, headers=headers
)

return BulkContactsInstance(self._version, payload)

def __repr__(self) -> str:
"""
Provide a friendly representation
:returns: Machine friendly representation
"""
return "<Twilio.Accounts.V1.BulkContactsList>"
67 changes: 67 additions & 0 deletions twilio/rest/assistants/v1/assistant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
from twilio.base.list_resource import ListResource
from twilio.base.version import Version
from twilio.base.page import Page
from twilio.rest.assistants.v1.assistant.assistants_knowledge import (
AssistantsKnowledgeList,
)
from twilio.rest.assistants.v1.assistant.assistants_tool import AssistantsToolList
from twilio.rest.assistants.v1.assistant.feedback import FeedbackList
from twilio.rest.assistants.v1.assistant.message import MessageList


class AssistantInstance(InstanceResource):
Expand All @@ -31,6 +36,7 @@ class AssistantInstance(InstanceResource):
:ivar model: The default model used by the assistant.
:ivar name: The name of the assistant.
:ivar owner: The owner/company of the assistant.
:ivar url: The url of the assistant resource.
:ivar personality_prompt: The personality prompt to be used for assistant.
:ivar date_created: The date and time in GMT when the Assistant 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 Assistant was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
Expand All @@ -49,6 +55,7 @@ def __init__(
self.model: Optional[str] = payload.get("model")
self.name: Optional[str] = payload.get("name")
self.owner: Optional[str] = payload.get("owner")
self.url: Optional[str] = payload.get("url")
self.personality_prompt: Optional[str] = payload.get("personality_prompt")
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
payload.get("date_created")
Expand Down Expand Up @@ -149,13 +156,34 @@ async def update_async(
assistants_v1_service_update_assistant_request=assistants_v1_service_update_assistant_request,
)

@property
def assistants_knowledge(self) -> AssistantsKnowledgeList:
"""
Access the assistants_knowledge
"""
return self._proxy.assistants_knowledge

@property
def assistants_tools(self) -> AssistantsToolList:
"""
Access the assistants_tools
"""
return self._proxy.assistants_tools

@property
def feedbacks(self) -> FeedbackList:
"""
Access the feedbacks
"""
return self._proxy.feedbacks

@property
def messages(self) -> MessageList:
"""
Access the messages
"""
return self._proxy.messages

def __repr__(self) -> str:
"""
Provide a friendly representation
Expand Down Expand Up @@ -183,7 +211,10 @@ def __init__(self, version: Version, id: str):
}
self._uri = "/Assistants/{id}".format(**self._solution)

self._assistants_knowledge: Optional[AssistantsKnowledgeList] = None
self._assistants_tools: Optional[AssistantsToolList] = None
self._feedbacks: Optional[FeedbackList] = None
self._messages: Optional[MessageList] = None

def delete(self) -> bool:
"""
Expand Down Expand Up @@ -299,6 +330,30 @@ async def update_async(

return AssistantInstance(self._version, payload, id=self._solution["id"])

@property
def assistants_knowledge(self) -> AssistantsKnowledgeList:
"""
Access the assistants_knowledge
"""
if self._assistants_knowledge is None:
self._assistants_knowledge = AssistantsKnowledgeList(
self._version,
self._solution["id"],
)
return self._assistants_knowledge

@property
def assistants_tools(self) -> AssistantsToolList:
"""
Access the assistants_tools
"""
if self._assistants_tools is None:
self._assistants_tools = AssistantsToolList(
self._version,
self._solution["id"],
)
return self._assistants_tools

@property
def feedbacks(self) -> FeedbackList:
"""
Expand All @@ -311,6 +366,18 @@ def feedbacks(self) -> FeedbackList:
)
return self._feedbacks

@property
def messages(self) -> MessageList:
"""
Access the messages
"""
if self._messages is None:
self._messages = MessageList(
self._version,
self._solution["id"],
)
return self._messages

def __repr__(self) -> str:
"""
Provide a friendly representation
Expand Down
Loading

0 comments on commit 75e8b14

Please sign in to comment.