diff --git a/twilio/rest/content/v1/content/approval_create.py b/twilio/rest/content/v1/content/approval_create.py index 137c0a6d0..4f22f2df1 100644 --- a/twilio/rest/content/v1/content/approval_create.py +++ b/twilio/rest/content/v1/content/approval_create.py @@ -12,7 +12,7 @@ Do not edit the class manually. """ -from typing import Any, Dict, Optional, Union +from typing import Any, Dict, Optional from twilio.base import values from twilio.base.instance_resource import InstanceResource @@ -30,7 +30,7 @@ class ApprovalCreateInstance(InstanceResource): :ivar allow_category_change: """ - def __init__(self, version: Version, payload: Dict[str, Any], sid: str): + def __init__(self, version: Version, payload: Dict[str, Any], content_sid: str): super().__init__(version) self.name: Optional[str] = payload.get("name") @@ -43,7 +43,7 @@ def __init__(self, version: Version, payload: Dict[str, Any], sid: str): ) self._solution = { - "sid": sid, + "content_sid": content_sid, } def __repr__(self) -> str: @@ -58,33 +58,52 @@ def __repr__(self) -> str: class ApprovalCreateList(ListResource): - def __init__(self, version: Version, sid: str): + class ContentApprovalRequest(object): + """ + :ivar name: Name of the template. + :ivar category: A WhatsApp recognized template category. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.name: Optional[str] = payload.get("name") + self.category: Optional[str] = payload.get("category") + + def to_dict(self): + return { + "name": self.name, + "category": self.category, + } + + def __init__(self, version: Version, content_sid: str): """ Initialize the ApprovalCreateList :param version: Version that contains the resource - :param sid: + :param content_sid: """ super().__init__(version) # Path Solution self._solution = { - "sid": sid, + "content_sid": content_sid, } - self._uri = "/Content/{sid}/ApprovalRequests/whatsapp".format(**self._solution) + self._uri = "/Content/{content_sid}/ApprovalRequests/whatsapp".format( + **self._solution + ) def create( - self, body: Union[object, object] = values.unset + self, content_approval_request: ContentApprovalRequest ) -> ApprovalCreateInstance: """ Create the ApprovalCreateInstance - :param body: + :param content_approval_request: :returns: The created ApprovalCreateInstance """ - data = body.to_dict() + data = content_approval_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) headers["Content-Type"] = "application/json" @@ -93,19 +112,21 @@ def create( method="POST", uri=self._uri, data=data, headers=headers ) - return ApprovalCreateInstance(self._version, payload, sid=self._solution["sid"]) + return ApprovalCreateInstance( + self._version, payload, content_sid=self._solution["content_sid"] + ) async def create_async( - self, body: Union[object, object] = values.unset + self, content_approval_request: ContentApprovalRequest ) -> ApprovalCreateInstance: """ Asynchronously create the ApprovalCreateInstance - :param body: + :param content_approval_request: :returns: The created ApprovalCreateInstance """ - data = body.to_dict() + data = content_approval_request.to_dict() headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) headers["Content-Type"] = "application/json" @@ -114,7 +135,9 @@ async def create_async( method="POST", uri=self._uri, data=data, headers=headers ) - return ApprovalCreateInstance(self._version, payload, sid=self._solution["sid"]) + return ApprovalCreateInstance( + self._version, payload, content_sid=self._solution["content_sid"] + ) def __repr__(self) -> str: """ diff --git a/twilio/rest/content/v1/content_and_approvals.py b/twilio/rest/content/v1/content_and_approvals.py index e2d6d72aa..de40cfc17 100644 --- a/twilio/rest/content/v1/content_and_approvals.py +++ b/twilio/rest/content/v1/content_and_approvals.py @@ -31,7 +31,7 @@ class ContentAndApprovalsInstance(InstanceResource): :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. - :ivar types: The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. :ivar approval_requests: The submitted information and approval request status of the Content resource. """ diff --git a/twilio/rest/content/v1/legacy_content.py b/twilio/rest/content/v1/legacy_content.py index 5705c33b0..cfb4ac698 100644 --- a/twilio/rest/content/v1/legacy_content.py +++ b/twilio/rest/content/v1/legacy_content.py @@ -31,7 +31,7 @@ class LegacyContentInstance(InstanceResource): :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. - :ivar types: The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. :ivar legacy_template_name: The string name of the legacy content template associated with this Content resource, unique across all template names for its account. Only lowercase letters, numbers and underscores are allowed :ivar legacy_body: The string body field of the legacy content template associated with this Content resource :ivar url: The URL of the resource, relative to `https://content.twilio.com`.