r"""
    This code was generated by
   ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
    |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
    |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \

    Twilio - Content
    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, Iterator, AsyncIterator
from twilio.base import deserialize, values
from twilio.base.api_response import ApiResponse
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
from twilio.base.page import Page
from twilio.rest.content.v1.content.approval_create import ApprovalCreateList
from twilio.rest.content.v1.content.approval_fetch import ApprovalFetchList


class ContentInstance(InstanceResource):

    class AuthenticationAction(object):
        """
        :ivar type:
        :ivar copy_code_text:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.type: Optional["ContentInstance.AuthenticationActionType"] = (
                payload.get("type")
            )
            self.copy_code_text: Optional[str] = payload.get("copy_code_text")

        def to_dict(self):
            return {
                "type": self.type,
                "copy_code_text": self.copy_code_text,
            }

    class CallToActionAction(object):
        """
        :ivar type:
        :ivar title:
        :ivar url:
        :ivar phone:
        :ivar code:
        :ivar id:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.type: Optional["ContentInstance.CallToActionActionType"] = payload.get(
                "type"
            )
            self.title: Optional[str] = payload.get("title")
            self.url: Optional[str] = payload.get("url")
            self.phone: Optional[str] = payload.get("phone")
            self.code: Optional[str] = payload.get("code")
            self.id: Optional[str] = payload.get("id")

        def to_dict(self):
            return {
                "type": self.type,
                "title": self.title,
                "url": self.url,
                "phone": self.phone,
                "code": self.code,
                "id": self.id,
            }

    class CardAction(object):
        """
        :ivar type:
        :ivar title:
        :ivar url:
        :ivar phone:
        :ivar id:
        :ivar code:
        :ivar webview_size:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.type: Optional["ContentInstance.CardActionType"] = payload.get("type")
            self.title: Optional[str] = payload.get("title")
            self.url: Optional[str] = payload.get("url")
            self.phone: Optional[str] = payload.get("phone")
            self.id: Optional[str] = payload.get("id")
            self.code: Optional[str] = payload.get("code")
            self.webview_size: Optional["ContentInstance.WebviewSizeType"] = (
                payload.get("webview_size")
            )

        def to_dict(self):
            return {
                "type": self.type,
                "title": self.title,
                "url": self.url,
                "phone": self.phone,
                "id": self.id,
                "code": self.code,
                "webview_size": self.webview_size,
            }

    class CarouselAction(object):
        """
        :ivar type:
        :ivar title:
        :ivar url:
        :ivar phone:
        :ivar id:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.type: Optional["ContentInstance.CarouselActionType"] = payload.get(
                "type"
            )
            self.title: Optional[str] = payload.get("title")
            self.url: Optional[str] = payload.get("url")
            self.phone: Optional[str] = payload.get("phone")
            self.id: Optional[str] = payload.get("id")

        def to_dict(self):
            return {
                "type": self.type,
                "title": self.title,
                "url": self.url,
                "phone": self.phone,
                "id": self.id,
            }

    class CarouselCard(object):
        """
        :ivar title:
        :ivar body:
        :ivar media:
        :ivar actions:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.title: Optional[str] = payload.get("title")
            self.body: Optional[str] = payload.get("body")
            self.media: Optional[str] = payload.get("media")
            self.actions: Optional[List[ContentList.CarouselAction]] = payload.get(
                "actions"
            )

        def to_dict(self):
            return {
                "title": self.title,
                "body": self.body,
                "media": self.media,
                "actions": (
                    [actions.to_dict() for actions in self.actions]
                    if self.actions is not None
                    else None
                ),
            }

    class CatalogItem(object):
        """
        :ivar id:
        :ivar section_title:
        :ivar name:
        :ivar media_url:
        :ivar price:
        :ivar description:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.id: Optional[str] = payload.get("id")
            self.section_title: Optional[str] = payload.get("section_title")
            self.name: Optional[str] = payload.get("name")
            self.media_url: Optional[str] = payload.get("media_url")
            self.price: Optional[float] = payload.get("price")
            self.description: Optional[str] = payload.get("description")

        def to_dict(self):
            return {
                "id": self.id,
                "section_title": self.section_title,
                "name": self.name,
                "media_url": self.media_url,
                "price": self.price,
                "description": self.description,
            }

    class ContentCreateRequest(object):
        """
        :ivar friendly_name: User defined name of the content
        :ivar variables: Key value pairs of variable name to value
        :ivar language: Language code for the content
        :ivar types:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.friendly_name: Optional[str] = payload.get("friendly_name")
            self.variables: Optional[Dict[str, str]] = payload.get("variables")
            self.language: Optional[str] = payload.get("language")
            self.types: Optional[ContentList.Types] = payload.get("types")

        def to_dict(self):
            return {
                "friendly_name": self.friendly_name,
                "variables": self.variables,
                "language": self.language,
                "types": self.types.to_dict() if self.types is not None else None,
            }

    class ContentUpdateRequest(object):
        """
        :ivar friendly_name: User defined name of the content
        :ivar variables: Key value pairs of variable name to value
        :ivar language: Language code for the content
        :ivar types:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.friendly_name: Optional[str] = payload.get("friendly_name")
            self.variables: Optional[Dict[str, str]] = payload.get("variables")
            self.language: Optional[str] = payload.get("language")
            self.types: Optional[ContentList.Types] = payload.get("types")

        def to_dict(self):
            return {
                "friendly_name": self.friendly_name,
                "variables": self.variables,
                "language": self.language,
                "types": self.types.to_dict() if self.types is not None else None,
            }

    class FlowsPage(object):
        """
        :ivar id:
        :ivar next_page_id:
        :ivar title:
        :ivar subtitle:
        :ivar layout:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.id: Optional[str] = payload.get("id")
            self.next_page_id: Optional[str] = payload.get("next_page_id")
            self.title: Optional[str] = payload.get("title")
            self.subtitle: Optional[str] = payload.get("subtitle")
            self.layout: Optional[List[ContentList.FlowsPageComponent]] = payload.get(
                "layout"
            )

        def to_dict(self):
            return {
                "id": self.id,
                "next_page_id": self.next_page_id,
                "title": self.title,
                "subtitle": self.subtitle,
                "layout": (
                    [layout.to_dict() for layout in self.layout]
                    if self.layout is not None
                    else None
                ),
            }

    class FlowsPageComponent(object):
        """
        :ivar label:
        :ivar type:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.label: Optional[str] = payload.get("label")
            self.type: Optional[str] = payload.get("type")

        def to_dict(self):
            return {
                "label": self.label,
                "type": self.type,
            }

    class ListItem(object):
        """
        :ivar id:
        :ivar item:
        :ivar description:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.id: Optional[str] = payload.get("id")
            self.item: Optional[str] = payload.get("item")
            self.description: Optional[str] = payload.get("description")

        def to_dict(self):
            return {
                "id": self.id,
                "item": self.item,
                "description": self.description,
            }

    class QuickReplyAction(object):
        """
        :ivar type:
        :ivar title:
        :ivar id:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.type: Optional["ContentInstance.QuickReplyActionType"] = payload.get(
                "type"
            )
            self.title: Optional[str] = payload.get("title")
            self.id: Optional[str] = payload.get("id")

        def to_dict(self):
            return {
                "type": self.type,
                "title": self.title,
                "id": self.id,
            }

    class TwilioCallToAction(object):
        """
        :ivar body:
        :ivar actions:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.actions: Optional[List[ContentList.CallToActionAction]] = payload.get(
                "actions"
            )

        def to_dict(self):
            return {
                "body": self.body,
                "actions": (
                    [actions.to_dict() for actions in self.actions]
                    if self.actions is not None
                    else None
                ),
            }

    class TwilioCard(object):
        """
        :ivar title:
        :ivar subtitle:
        :ivar media:
        :ivar actions:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.title: Optional[str] = payload.get("title")
            self.subtitle: Optional[str] = payload.get("subtitle")
            self.media: Optional[List[str]] = payload.get("media")
            self.actions: Optional[List[ContentList.CardAction]] = payload.get(
                "actions"
            )

        def to_dict(self):
            return {
                "title": self.title,
                "subtitle": self.subtitle,
                "media": self.media,
                "actions": (
                    [actions.to_dict() for actions in self.actions]
                    if self.actions is not None
                    else None
                ),
            }

    class TwilioCarousel(object):
        """
        :ivar body:
        :ivar cards:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.cards: Optional[List[ContentList.CarouselCard]] = payload.get("cards")

        def to_dict(self):
            return {
                "body": self.body,
                "cards": (
                    [cards.to_dict() for cards in self.cards]
                    if self.cards is not None
                    else None
                ),
            }

    class TwilioCatalog(object):
        """
        :ivar title:
        :ivar body:
        :ivar subtitle:
        :ivar id:
        :ivar items:
        :ivar dynamic_items:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.title: Optional[str] = payload.get("title")
            self.body: Optional[str] = payload.get("body")
            self.subtitle: Optional[str] = payload.get("subtitle")
            self.id: Optional[str] = payload.get("id")
            self.items: Optional[List[ContentList.CatalogItem]] = payload.get("items")
            self.dynamic_items: Optional[str] = payload.get("dynamic_items")

        def to_dict(self):
            return {
                "title": self.title,
                "body": self.body,
                "subtitle": self.subtitle,
                "id": self.id,
                "items": (
                    [items.to_dict() for items in self.items]
                    if self.items is not None
                    else None
                ),
                "dynamic_items": self.dynamic_items,
            }

    class TwilioFlows(object):
        """
        :ivar body:
        :ivar button_text:
        :ivar subtitle:
        :ivar media_url:
        :ivar pages:
        :ivar type:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.button_text: Optional[str] = payload.get("button_text")
            self.subtitle: Optional[str] = payload.get("subtitle")
            self.media_url: Optional[str] = payload.get("media_url")
            self.pages: Optional[List[ContentList.FlowsPage]] = payload.get("pages")
            self.type: Optional[str] = payload.get("type")

        def to_dict(self):
            return {
                "body": self.body,
                "button_text": self.button_text,
                "subtitle": self.subtitle,
                "media_url": self.media_url,
                "pages": (
                    [pages.to_dict() for pages in self.pages]
                    if self.pages is not None
                    else None
                ),
                "type": self.type,
            }

    class TwilioListPicker(object):
        """
        :ivar body:
        :ivar button:
        :ivar items:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.button: Optional[str] = payload.get("button")
            self.items: Optional[List[ContentList.ListItem]] = payload.get("items")

        def to_dict(self):
            return {
                "body": self.body,
                "button": self.button,
                "items": (
                    [items.to_dict() for items in self.items]
                    if self.items is not None
                    else None
                ),
            }

    class TwilioLocation(object):
        """
        :ivar latitude:
        :ivar longitude:
        :ivar label:
        :ivar id:
        :ivar address:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.latitude: Optional[float] = payload.get("latitude")
            self.longitude: Optional[float] = payload.get("longitude")
            self.label: Optional[str] = payload.get("label")
            self.id: Optional[str] = payload.get("id")
            self.address: Optional[str] = payload.get("address")

        def to_dict(self):
            return {
                "latitude": self.latitude,
                "longitude": self.longitude,
                "label": self.label,
                "id": self.id,
                "address": self.address,
            }

    class TwilioMedia(object):
        """
        :ivar body:
        :ivar media:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.media: Optional[List[str]] = payload.get("media")

        def to_dict(self):
            return {
                "body": self.body,
                "media": self.media,
            }

    class TwilioQuickReply(object):
        """
        :ivar body:
        :ivar actions:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.actions: Optional[List[ContentList.QuickReplyAction]] = payload.get(
                "actions"
            )

        def to_dict(self):
            return {
                "body": self.body,
                "actions": (
                    [actions.to_dict() for actions in self.actions]
                    if self.actions is not None
                    else None
                ),
            }

    class TwilioSchedule(object):
        """
        :ivar id:
        :ivar title:
        :ivar time_slots:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.id: Optional[str] = payload.get("id")
            self.title: Optional[str] = payload.get("title")
            self.time_slots: Optional[str] = payload.get("time_slots")

        def to_dict(self):
            return {
                "id": self.id,
                "title": self.title,
                "time_slots": self.time_slots,
            }

    class TwilioText(object):
        """
        :ivar body:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")

        def to_dict(self):
            return {
                "body": self.body,
            }

    class Types(object):
        """
        :ivar twilio_text:
        :ivar twilio_media:
        :ivar twilio_location:
        :ivar twilio_list_picker:
        :ivar twilio_call_to_action:
        :ivar twilio_quick_reply:
        :ivar twilio_card:
        :ivar twilio_catalog:
        :ivar twilio_carousel:
        :ivar twilio_flows:
        :ivar twilio_schedule:
        :ivar whatsapp_card:
        :ivar whatsapp_authentication:
        :ivar whatsapp_flows:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.twilio_text: Optional[ContentList.TwilioText] = payload.get(
                "twilio_text"
            )
            self.twilio_media: Optional[ContentList.TwilioMedia] = payload.get(
                "twilio_media"
            )
            self.twilio_location: Optional[ContentList.TwilioLocation] = payload.get(
                "twilio_location"
            )
            self.twilio_list_picker: Optional[ContentList.TwilioListPicker] = (
                payload.get("twilio_list_picker")
            )
            self.twilio_call_to_action: Optional[ContentList.TwilioCallToAction] = (
                payload.get("twilio_call_to_action")
            )
            self.twilio_quick_reply: Optional[ContentList.TwilioQuickReply] = (
                payload.get("twilio_quick_reply")
            )
            self.twilio_card: Optional[ContentList.TwilioCard] = payload.get(
                "twilio_card"
            )
            self.twilio_catalog: Optional[ContentList.TwilioCatalog] = payload.get(
                "twilio_catalog"
            )
            self.twilio_carousel: Optional[ContentList.TwilioCarousel] = payload.get(
                "twilio_carousel"
            )
            self.twilio_flows: Optional[ContentList.TwilioFlows] = payload.get(
                "twilio_flows"
            )
            self.twilio_schedule: Optional[ContentList.TwilioSchedule] = payload.get(
                "twilio_schedule"
            )
            self.whatsapp_card: Optional[ContentList.WhatsappCard] = payload.get(
                "whatsapp_card"
            )
            self.whatsapp_authentication: Optional[
                ContentList.WhatsappAuthentication
            ] = payload.get("whatsapp_authentication")
            self.whatsapp_flows: Optional[ContentList.WhatsappFlows] = payload.get(
                "whatsapp_flows"
            )

        def to_dict(self):
            return {
                "twilio_text": (
                    self.twilio_text.to_dict() if self.twilio_text is not None else None
                ),
                "twilio_media": (
                    self.twilio_media.to_dict()
                    if self.twilio_media is not None
                    else None
                ),
                "twilio_location": (
                    self.twilio_location.to_dict()
                    if self.twilio_location is not None
                    else None
                ),
                "twilio_list_picker": (
                    self.twilio_list_picker.to_dict()
                    if self.twilio_list_picker is not None
                    else None
                ),
                "twilio_call_to_action": (
                    self.twilio_call_to_action.to_dict()
                    if self.twilio_call_to_action is not None
                    else None
                ),
                "twilio_quick_reply": (
                    self.twilio_quick_reply.to_dict()
                    if self.twilio_quick_reply is not None
                    else None
                ),
                "twilio_card": (
                    self.twilio_card.to_dict() if self.twilio_card is not None else None
                ),
                "twilio_catalog": (
                    self.twilio_catalog.to_dict()
                    if self.twilio_catalog is not None
                    else None
                ),
                "twilio_carousel": (
                    self.twilio_carousel.to_dict()
                    if self.twilio_carousel is not None
                    else None
                ),
                "twilio_flows": (
                    self.twilio_flows.to_dict()
                    if self.twilio_flows is not None
                    else None
                ),
                "twilio_schedule": (
                    self.twilio_schedule.to_dict()
                    if self.twilio_schedule is not None
                    else None
                ),
                "whatsapp_card": (
                    self.whatsapp_card.to_dict()
                    if self.whatsapp_card is not None
                    else None
                ),
                "whatsapp_authentication": (
                    self.whatsapp_authentication.to_dict()
                    if self.whatsapp_authentication is not None
                    else None
                ),
                "whatsapp_flows": (
                    self.whatsapp_flows.to_dict()
                    if self.whatsapp_flows is not None
                    else None
                ),
            }

    class WhatsappAuthentication(object):
        """
        :ivar add_security_recommendation:
        :ivar code_expiration_minutes:
        :ivar actions:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.add_security_recommendation: Optional[bool] = payload.get(
                "add_security_recommendation"
            )
            self.code_expiration_minutes: Optional[float] = payload.get(
                "code_expiration_minutes"
            )
            self.actions: Optional[List[ContentList.AuthenticationAction]] = (
                payload.get("actions")
            )

        def to_dict(self):
            return {
                "add_security_recommendation": self.add_security_recommendation,
                "code_expiration_minutes": self.code_expiration_minutes,
                "actions": (
                    [actions.to_dict() for actions in self.actions]
                    if self.actions is not None
                    else None
                ),
            }

    class WhatsappCard(object):
        """
        :ivar body:
        :ivar footer:
        :ivar media:
        :ivar header_text:
        :ivar actions:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.footer: Optional[str] = payload.get("footer")
            self.media: Optional[List[str]] = payload.get("media")
            self.header_text: Optional[str] = payload.get("header_text")
            self.actions: Optional[List[ContentList.CardAction]] = payload.get(
                "actions"
            )

        def to_dict(self):
            return {
                "body": self.body,
                "footer": self.footer,
                "media": self.media,
                "header_text": self.header_text,
                "actions": (
                    [actions.to_dict() for actions in self.actions]
                    if self.actions is not None
                    else None
                ),
            }

    class WhatsappFlows(object):
        """
        :ivar body:
        :ivar button_text:
        :ivar subtitle:
        :ivar media_url:
        :ivar flow_id:
        :ivar flow_token:
        :ivar flow_first_page_id:
        :ivar is_flow_first_page_endpoint:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.button_text: Optional[str] = payload.get("button_text")
            self.subtitle: Optional[str] = payload.get("subtitle")
            self.media_url: Optional[str] = payload.get("media_url")
            self.flow_id: Optional[str] = payload.get("flow_id")
            self.flow_token: Optional[str] = payload.get("flow_token")
            self.flow_first_page_id: Optional[str] = payload.get("flow_first_page_id")
            self.is_flow_first_page_endpoint: Optional[bool] = payload.get(
                "is_flow_first_page_endpoint"
            )

        def to_dict(self):
            return {
                "body": self.body,
                "button_text": self.button_text,
                "subtitle": self.subtitle,
                "media_url": self.media_url,
                "flow_id": self.flow_id,
                "flow_token": self.flow_token,
                "flow_first_page_id": self.flow_first_page_id,
                "is_flow_first_page_endpoint": self.is_flow_first_page_endpoint,
            }

    class AuthenticationActionType(object):
        COPY_CODE = "COPY_CODE"

    class CallToActionActionType(object):
        URL = "URL"
        PHONE_NUMBER = "PHONE_NUMBER"
        COPY_CODE = "COPY_CODE"
        VOICE_CALL = "VOICE_CALL"
        VOICE_CALL_REQUEST = "VOICE_CALL_REQUEST"

    class CardActionType(object):
        URL = "URL"
        PHONE_NUMBER = "PHONE_NUMBER"
        QUICK_REPLY = "QUICK_REPLY"
        COPY_CODE = "COPY_CODE"
        VOICE_CALL = "VOICE_CALL"

    class CarouselActionType(object):
        URL = "URL"
        PHONE_NUMBER = "PHONE_NUMBER"
        QUICK_REPLY = "QUICK_REPLY"

    class QuickReplyActionType(object):
        QUICK_REPLY = "QUICK_REPLY"

    class WebviewSizeType(object):
        TALL = "TALL"
        FULL = "FULL"
        HALF = "HALF"
        NONE = "NONE"

    """
    :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
    :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
    :ivar sid: The unique string that that we created to identify the Content resource.
    :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource.
    :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-api/content-types-overview) (e.g. twilio/text) for this Content resource.
    :ivar url: The URL of the resource, relative to `https://content.twilio.com`.
    :ivar links: A list of links related to the Content resource, such as approval_fetch and approval_create
    """

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

        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.sid: Optional[str] = payload.get("sid")
        self.account_sid: Optional[str] = payload.get("account_sid")
        self.friendly_name: Optional[str] = payload.get("friendly_name")
        self.language: Optional[str] = payload.get("language")
        self.variables: Optional[Dict[str, object]] = payload.get("variables")
        self.types: Optional[Dict[str, object]] = payload.get("types")
        self.url: Optional[str] = payload.get("url")
        self.links: Optional[Dict[str, object]] = payload.get("links")

        self._solution = {
            "sid": sid or self.sid,
        }
        self._context: Optional[ContentContext] = None

    @property
    def _proxy(self) -> "ContentContext":
        """
        Generate an instance context for the instance, the context is capable of
        performing various actions. All instance actions are proxied to the context

        :returns: ContentContext for this ContentInstance
        """
        if self._context is None:
            self._context = ContentContext(
                self._version,
                sid=self._solution["sid"],
            )
        return self._context

    def delete(self) -> bool:
        """
        Deletes the ContentInstance


        :returns: True if delete succeeds, False otherwise
        """
        return self._proxy.delete()

    async def delete_async(self) -> bool:
        """
        Asynchronous coroutine that deletes the ContentInstance


        :returns: True if delete succeeds, False otherwise
        """
        return await self._proxy.delete_async()

    def delete_with_http_info(self) -> ApiResponse:
        """
        Deletes the ContentInstance with HTTP info


        :returns: ApiResponse with success boolean, status code, and headers
        """
        return self._proxy.delete_with_http_info()

    async def delete_with_http_info_async(self) -> ApiResponse:
        """
        Asynchronous coroutine that deletes the ContentInstance with HTTP info


        :returns: ApiResponse with success boolean, status code, and headers
        """
        return await self._proxy.delete_with_http_info_async()

    def fetch(self) -> "ContentInstance":
        """
        Fetch the ContentInstance


        :returns: The fetched ContentInstance
        """
        return self._proxy.fetch()

    async def fetch_async(self) -> "ContentInstance":
        """
        Asynchronous coroutine to fetch the ContentInstance


        :returns: The fetched ContentInstance
        """
        return await self._proxy.fetch_async()

    def fetch_with_http_info(self) -> ApiResponse:
        """
        Fetch the ContentInstance with HTTP info


        :returns: ApiResponse with instance, status code, and headers
        """
        return self._proxy.fetch_with_http_info()

    async def fetch_with_http_info_async(self) -> ApiResponse:
        """
        Asynchronous coroutine to fetch the ContentInstance with HTTP info


        :returns: ApiResponse with instance, status code, and headers
        """
        return await self._proxy.fetch_with_http_info_async()

    def update(self, content_update_request: ContentUpdateRequest) -> "ContentInstance":
        """
        Update the ContentInstance

        :param content_update_request:

        :returns: The updated ContentInstance
        """
        return self._proxy.update(
            content_update_request=content_update_request,
        )

    async def update_async(
        self, content_update_request: ContentUpdateRequest
    ) -> "ContentInstance":
        """
        Asynchronous coroutine to update the ContentInstance

        :param content_update_request:

        :returns: The updated ContentInstance
        """
        return await self._proxy.update_async(
            content_update_request=content_update_request,
        )

    def update_with_http_info(
        self, content_update_request: ContentUpdateRequest
    ) -> ApiResponse:
        """
        Update the ContentInstance with HTTP info

        :param content_update_request:

        :returns: ApiResponse with instance, status code, and headers
        """
        return self._proxy.update_with_http_info(
            content_update_request=content_update_request,
        )

    async def update_with_http_info_async(
        self, content_update_request: ContentUpdateRequest
    ) -> ApiResponse:
        """
        Asynchronous coroutine to update the ContentInstance with HTTP info

        :param content_update_request:

        :returns: ApiResponse with instance, status code, and headers
        """
        return await self._proxy.update_with_http_info_async(
            content_update_request=content_update_request,
        )

    @property
    def approval_create(self) -> ApprovalCreateList:
        """
        Access the approval_create
        """
        return self._proxy.approval_create

    @property
    def approval_fetch(self) -> ApprovalFetchList:
        """
        Access the approval_fetch
        """
        return self._proxy.approval_fetch

    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 "<Twilio.Content.V1.ContentInstance {}>".format(context)


class ContentContext(InstanceContext):

    class AuthenticationAction(object):
        """
        :ivar type:
        :ivar copy_code_text:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.type: Optional["ContentInstance.AuthenticationActionType"] = (
                payload.get("type")
            )
            self.copy_code_text: Optional[str] = payload.get("copy_code_text")

        def to_dict(self):
            return {
                "type": self.type,
                "copy_code_text": self.copy_code_text,
            }

    class CallToActionAction(object):
        """
        :ivar type:
        :ivar title:
        :ivar url:
        :ivar phone:
        :ivar code:
        :ivar id:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.type: Optional["ContentInstance.CallToActionActionType"] = payload.get(
                "type"
            )
            self.title: Optional[str] = payload.get("title")
            self.url: Optional[str] = payload.get("url")
            self.phone: Optional[str] = payload.get("phone")
            self.code: Optional[str] = payload.get("code")
            self.id: Optional[str] = payload.get("id")

        def to_dict(self):
            return {
                "type": self.type,
                "title": self.title,
                "url": self.url,
                "phone": self.phone,
                "code": self.code,
                "id": self.id,
            }

    class CardAction(object):
        """
        :ivar type:
        :ivar title:
        :ivar url:
        :ivar phone:
        :ivar id:
        :ivar code:
        :ivar webview_size:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.type: Optional["ContentInstance.CardActionType"] = payload.get("type")
            self.title: Optional[str] = payload.get("title")
            self.url: Optional[str] = payload.get("url")
            self.phone: Optional[str] = payload.get("phone")
            self.id: Optional[str] = payload.get("id")
            self.code: Optional[str] = payload.get("code")
            self.webview_size: Optional["ContentInstance.WebviewSizeType"] = (
                payload.get("webview_size")
            )

        def to_dict(self):
            return {
                "type": self.type,
                "title": self.title,
                "url": self.url,
                "phone": self.phone,
                "id": self.id,
                "code": self.code,
                "webview_size": self.webview_size,
            }

    class CarouselAction(object):
        """
        :ivar type:
        :ivar title:
        :ivar url:
        :ivar phone:
        :ivar id:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.type: Optional["ContentInstance.CarouselActionType"] = payload.get(
                "type"
            )
            self.title: Optional[str] = payload.get("title")
            self.url: Optional[str] = payload.get("url")
            self.phone: Optional[str] = payload.get("phone")
            self.id: Optional[str] = payload.get("id")

        def to_dict(self):
            return {
                "type": self.type,
                "title": self.title,
                "url": self.url,
                "phone": self.phone,
                "id": self.id,
            }

    class CarouselCard(object):
        """
        :ivar title:
        :ivar body:
        :ivar media:
        :ivar actions:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.title: Optional[str] = payload.get("title")
            self.body: Optional[str] = payload.get("body")
            self.media: Optional[str] = payload.get("media")
            self.actions: Optional[List[ContentList.CarouselAction]] = payload.get(
                "actions"
            )

        def to_dict(self):
            return {
                "title": self.title,
                "body": self.body,
                "media": self.media,
                "actions": (
                    [actions.to_dict() for actions in self.actions]
                    if self.actions is not None
                    else None
                ),
            }

    class CatalogItem(object):
        """
        :ivar id:
        :ivar section_title:
        :ivar name:
        :ivar media_url:
        :ivar price:
        :ivar description:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.id: Optional[str] = payload.get("id")
            self.section_title: Optional[str] = payload.get("section_title")
            self.name: Optional[str] = payload.get("name")
            self.media_url: Optional[str] = payload.get("media_url")
            self.price: Optional[float] = payload.get("price")
            self.description: Optional[str] = payload.get("description")

        def to_dict(self):
            return {
                "id": self.id,
                "section_title": self.section_title,
                "name": self.name,
                "media_url": self.media_url,
                "price": self.price,
                "description": self.description,
            }

    class ContentCreateRequest(object):
        """
        :ivar friendly_name: User defined name of the content
        :ivar variables: Key value pairs of variable name to value
        :ivar language: Language code for the content
        :ivar types:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.friendly_name: Optional[str] = payload.get("friendly_name")
            self.variables: Optional[Dict[str, str]] = payload.get("variables")
            self.language: Optional[str] = payload.get("language")
            self.types: Optional[ContentList.Types] = payload.get("types")

        def to_dict(self):
            return {
                "friendly_name": self.friendly_name,
                "variables": self.variables,
                "language": self.language,
                "types": self.types.to_dict() if self.types is not None else None,
            }

    class ContentUpdateRequest(object):
        """
        :ivar friendly_name: User defined name of the content
        :ivar variables: Key value pairs of variable name to value
        :ivar language: Language code for the content
        :ivar types:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.friendly_name: Optional[str] = payload.get("friendly_name")
            self.variables: Optional[Dict[str, str]] = payload.get("variables")
            self.language: Optional[str] = payload.get("language")
            self.types: Optional[ContentList.Types] = payload.get("types")

        def to_dict(self):
            return {
                "friendly_name": self.friendly_name,
                "variables": self.variables,
                "language": self.language,
                "types": self.types.to_dict() if self.types is not None else None,
            }

    class FlowsPage(object):
        """
        :ivar id:
        :ivar next_page_id:
        :ivar title:
        :ivar subtitle:
        :ivar layout:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.id: Optional[str] = payload.get("id")
            self.next_page_id: Optional[str] = payload.get("next_page_id")
            self.title: Optional[str] = payload.get("title")
            self.subtitle: Optional[str] = payload.get("subtitle")
            self.layout: Optional[List[ContentList.FlowsPageComponent]] = payload.get(
                "layout"
            )

        def to_dict(self):
            return {
                "id": self.id,
                "next_page_id": self.next_page_id,
                "title": self.title,
                "subtitle": self.subtitle,
                "layout": (
                    [layout.to_dict() for layout in self.layout]
                    if self.layout is not None
                    else None
                ),
            }

    class FlowsPageComponent(object):
        """
        :ivar label:
        :ivar type:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.label: Optional[str] = payload.get("label")
            self.type: Optional[str] = payload.get("type")

        def to_dict(self):
            return {
                "label": self.label,
                "type": self.type,
            }

    class ListItem(object):
        """
        :ivar id:
        :ivar item:
        :ivar description:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.id: Optional[str] = payload.get("id")
            self.item: Optional[str] = payload.get("item")
            self.description: Optional[str] = payload.get("description")

        def to_dict(self):
            return {
                "id": self.id,
                "item": self.item,
                "description": self.description,
            }

    class QuickReplyAction(object):
        """
        :ivar type:
        :ivar title:
        :ivar id:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.type: Optional["ContentInstance.QuickReplyActionType"] = payload.get(
                "type"
            )
            self.title: Optional[str] = payload.get("title")
            self.id: Optional[str] = payload.get("id")

        def to_dict(self):
            return {
                "type": self.type,
                "title": self.title,
                "id": self.id,
            }

    class TwilioCallToAction(object):
        """
        :ivar body:
        :ivar actions:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.actions: Optional[List[ContentList.CallToActionAction]] = payload.get(
                "actions"
            )

        def to_dict(self):
            return {
                "body": self.body,
                "actions": (
                    [actions.to_dict() for actions in self.actions]
                    if self.actions is not None
                    else None
                ),
            }

    class TwilioCard(object):
        """
        :ivar title:
        :ivar subtitle:
        :ivar media:
        :ivar actions:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.title: Optional[str] = payload.get("title")
            self.subtitle: Optional[str] = payload.get("subtitle")
            self.media: Optional[List[str]] = payload.get("media")
            self.actions: Optional[List[ContentList.CardAction]] = payload.get(
                "actions"
            )

        def to_dict(self):
            return {
                "title": self.title,
                "subtitle": self.subtitle,
                "media": self.media,
                "actions": (
                    [actions.to_dict() for actions in self.actions]
                    if self.actions is not None
                    else None
                ),
            }

    class TwilioCarousel(object):
        """
        :ivar body:
        :ivar cards:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.cards: Optional[List[ContentList.CarouselCard]] = payload.get("cards")

        def to_dict(self):
            return {
                "body": self.body,
                "cards": (
                    [cards.to_dict() for cards in self.cards]
                    if self.cards is not None
                    else None
                ),
            }

    class TwilioCatalog(object):
        """
        :ivar title:
        :ivar body:
        :ivar subtitle:
        :ivar id:
        :ivar items:
        :ivar dynamic_items:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.title: Optional[str] = payload.get("title")
            self.body: Optional[str] = payload.get("body")
            self.subtitle: Optional[str] = payload.get("subtitle")
            self.id: Optional[str] = payload.get("id")
            self.items: Optional[List[ContentList.CatalogItem]] = payload.get("items")
            self.dynamic_items: Optional[str] = payload.get("dynamic_items")

        def to_dict(self):
            return {
                "title": self.title,
                "body": self.body,
                "subtitle": self.subtitle,
                "id": self.id,
                "items": (
                    [items.to_dict() for items in self.items]
                    if self.items is not None
                    else None
                ),
                "dynamic_items": self.dynamic_items,
            }

    class TwilioFlows(object):
        """
        :ivar body:
        :ivar button_text:
        :ivar subtitle:
        :ivar media_url:
        :ivar pages:
        :ivar type:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.button_text: Optional[str] = payload.get("button_text")
            self.subtitle: Optional[str] = payload.get("subtitle")
            self.media_url: Optional[str] = payload.get("media_url")
            self.pages: Optional[List[ContentList.FlowsPage]] = payload.get("pages")
            self.type: Optional[str] = payload.get("type")

        def to_dict(self):
            return {
                "body": self.body,
                "button_text": self.button_text,
                "subtitle": self.subtitle,
                "media_url": self.media_url,
                "pages": (
                    [pages.to_dict() for pages in self.pages]
                    if self.pages is not None
                    else None
                ),
                "type": self.type,
            }

    class TwilioListPicker(object):
        """
        :ivar body:
        :ivar button:
        :ivar items:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.button: Optional[str] = payload.get("button")
            self.items: Optional[List[ContentList.ListItem]] = payload.get("items")

        def to_dict(self):
            return {
                "body": self.body,
                "button": self.button,
                "items": (
                    [items.to_dict() for items in self.items]
                    if self.items is not None
                    else None
                ),
            }

    class TwilioLocation(object):
        """
        :ivar latitude:
        :ivar longitude:
        :ivar label:
        :ivar id:
        :ivar address:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.latitude: Optional[float] = payload.get("latitude")
            self.longitude: Optional[float] = payload.get("longitude")
            self.label: Optional[str] = payload.get("label")
            self.id: Optional[str] = payload.get("id")
            self.address: Optional[str] = payload.get("address")

        def to_dict(self):
            return {
                "latitude": self.latitude,
                "longitude": self.longitude,
                "label": self.label,
                "id": self.id,
                "address": self.address,
            }

    class TwilioMedia(object):
        """
        :ivar body:
        :ivar media:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.media: Optional[List[str]] = payload.get("media")

        def to_dict(self):
            return {
                "body": self.body,
                "media": self.media,
            }

    class TwilioQuickReply(object):
        """
        :ivar body:
        :ivar actions:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.actions: Optional[List[ContentList.QuickReplyAction]] = payload.get(
                "actions"
            )

        def to_dict(self):
            return {
                "body": self.body,
                "actions": (
                    [actions.to_dict() for actions in self.actions]
                    if self.actions is not None
                    else None
                ),
            }

    class TwilioSchedule(object):
        """
        :ivar id:
        :ivar title:
        :ivar time_slots:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.id: Optional[str] = payload.get("id")
            self.title: Optional[str] = payload.get("title")
            self.time_slots: Optional[str] = payload.get("time_slots")

        def to_dict(self):
            return {
                "id": self.id,
                "title": self.title,
                "time_slots": self.time_slots,
            }

    class TwilioText(object):
        """
        :ivar body:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")

        def to_dict(self):
            return {
                "body": self.body,
            }

    class Types(object):
        """
        :ivar twilio_text:
        :ivar twilio_media:
        :ivar twilio_location:
        :ivar twilio_list_picker:
        :ivar twilio_call_to_action:
        :ivar twilio_quick_reply:
        :ivar twilio_card:
        :ivar twilio_catalog:
        :ivar twilio_carousel:
        :ivar twilio_flows:
        :ivar twilio_schedule:
        :ivar whatsapp_card:
        :ivar whatsapp_authentication:
        :ivar whatsapp_flows:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.twilio_text: Optional[ContentList.TwilioText] = payload.get(
                "twilio_text"
            )
            self.twilio_media: Optional[ContentList.TwilioMedia] = payload.get(
                "twilio_media"
            )
            self.twilio_location: Optional[ContentList.TwilioLocation] = payload.get(
                "twilio_location"
            )
            self.twilio_list_picker: Optional[ContentList.TwilioListPicker] = (
                payload.get("twilio_list_picker")
            )
            self.twilio_call_to_action: Optional[ContentList.TwilioCallToAction] = (
                payload.get("twilio_call_to_action")
            )
            self.twilio_quick_reply: Optional[ContentList.TwilioQuickReply] = (
                payload.get("twilio_quick_reply")
            )
            self.twilio_card: Optional[ContentList.TwilioCard] = payload.get(
                "twilio_card"
            )
            self.twilio_catalog: Optional[ContentList.TwilioCatalog] = payload.get(
                "twilio_catalog"
            )
            self.twilio_carousel: Optional[ContentList.TwilioCarousel] = payload.get(
                "twilio_carousel"
            )
            self.twilio_flows: Optional[ContentList.TwilioFlows] = payload.get(
                "twilio_flows"
            )
            self.twilio_schedule: Optional[ContentList.TwilioSchedule] = payload.get(
                "twilio_schedule"
            )
            self.whatsapp_card: Optional[ContentList.WhatsappCard] = payload.get(
                "whatsapp_card"
            )
            self.whatsapp_authentication: Optional[
                ContentList.WhatsappAuthentication
            ] = payload.get("whatsapp_authentication")
            self.whatsapp_flows: Optional[ContentList.WhatsappFlows] = payload.get(
                "whatsapp_flows"
            )

        def to_dict(self):
            return {
                "twilio_text": (
                    self.twilio_text.to_dict() if self.twilio_text is not None else None
                ),
                "twilio_media": (
                    self.twilio_media.to_dict()
                    if self.twilio_media is not None
                    else None
                ),
                "twilio_location": (
                    self.twilio_location.to_dict()
                    if self.twilio_location is not None
                    else None
                ),
                "twilio_list_picker": (
                    self.twilio_list_picker.to_dict()
                    if self.twilio_list_picker is not None
                    else None
                ),
                "twilio_call_to_action": (
                    self.twilio_call_to_action.to_dict()
                    if self.twilio_call_to_action is not None
                    else None
                ),
                "twilio_quick_reply": (
                    self.twilio_quick_reply.to_dict()
                    if self.twilio_quick_reply is not None
                    else None
                ),
                "twilio_card": (
                    self.twilio_card.to_dict() if self.twilio_card is not None else None
                ),
                "twilio_catalog": (
                    self.twilio_catalog.to_dict()
                    if self.twilio_catalog is not None
                    else None
                ),
                "twilio_carousel": (
                    self.twilio_carousel.to_dict()
                    if self.twilio_carousel is not None
                    else None
                ),
                "twilio_flows": (
                    self.twilio_flows.to_dict()
                    if self.twilio_flows is not None
                    else None
                ),
                "twilio_schedule": (
                    self.twilio_schedule.to_dict()
                    if self.twilio_schedule is not None
                    else None
                ),
                "whatsapp_card": (
                    self.whatsapp_card.to_dict()
                    if self.whatsapp_card is not None
                    else None
                ),
                "whatsapp_authentication": (
                    self.whatsapp_authentication.to_dict()
                    if self.whatsapp_authentication is not None
                    else None
                ),
                "whatsapp_flows": (
                    self.whatsapp_flows.to_dict()
                    if self.whatsapp_flows is not None
                    else None
                ),
            }

    class WhatsappAuthentication(object):
        """
        :ivar add_security_recommendation:
        :ivar code_expiration_minutes:
        :ivar actions:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.add_security_recommendation: Optional[bool] = payload.get(
                "add_security_recommendation"
            )
            self.code_expiration_minutes: Optional[float] = payload.get(
                "code_expiration_minutes"
            )
            self.actions: Optional[List[ContentList.AuthenticationAction]] = (
                payload.get("actions")
            )

        def to_dict(self):
            return {
                "add_security_recommendation": self.add_security_recommendation,
                "code_expiration_minutes": self.code_expiration_minutes,
                "actions": (
                    [actions.to_dict() for actions in self.actions]
                    if self.actions is not None
                    else None
                ),
            }

    class WhatsappCard(object):
        """
        :ivar body:
        :ivar footer:
        :ivar media:
        :ivar header_text:
        :ivar actions:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.footer: Optional[str] = payload.get("footer")
            self.media: Optional[List[str]] = payload.get("media")
            self.header_text: Optional[str] = payload.get("header_text")
            self.actions: Optional[List[ContentList.CardAction]] = payload.get(
                "actions"
            )

        def to_dict(self):
            return {
                "body": self.body,
                "footer": self.footer,
                "media": self.media,
                "header_text": self.header_text,
                "actions": (
                    [actions.to_dict() for actions in self.actions]
                    if self.actions is not None
                    else None
                ),
            }

    class WhatsappFlows(object):
        """
        :ivar body:
        :ivar button_text:
        :ivar subtitle:
        :ivar media_url:
        :ivar flow_id:
        :ivar flow_token:
        :ivar flow_first_page_id:
        :ivar is_flow_first_page_endpoint:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.button_text: Optional[str] = payload.get("button_text")
            self.subtitle: Optional[str] = payload.get("subtitle")
            self.media_url: Optional[str] = payload.get("media_url")
            self.flow_id: Optional[str] = payload.get("flow_id")
            self.flow_token: Optional[str] = payload.get("flow_token")
            self.flow_first_page_id: Optional[str] = payload.get("flow_first_page_id")
            self.is_flow_first_page_endpoint: Optional[bool] = payload.get(
                "is_flow_first_page_endpoint"
            )

        def to_dict(self):
            return {
                "body": self.body,
                "button_text": self.button_text,
                "subtitle": self.subtitle,
                "media_url": self.media_url,
                "flow_id": self.flow_id,
                "flow_token": self.flow_token,
                "flow_first_page_id": self.flow_first_page_id,
                "is_flow_first_page_endpoint": self.is_flow_first_page_endpoint,
            }

    def __init__(self, version: Version, sid: str):
        """
        Initialize the ContentContext

        :param version: Version that contains the resource
        :param sid: The Twilio-provided string that uniquely identifies the Content resource to update.
        """
        super().__init__(version)

        # Path Solution
        self._solution = {
            "sid": sid,
        }
        self._uri = "/Content/{sid}".format(**self._solution)

        self._approval_create: Optional[ApprovalCreateList] = None
        self._approval_fetch: Optional[ApprovalFetchList] = None

    def _delete(self) -> tuple:
        """
        Internal helper for delete operation

        Returns:
            tuple: (success_boolean, status_code, headers)
        """

        headers = values.of({})

        return self._version.delete_with_response_info(
            method="DELETE", uri=self._uri, headers=headers
        )

    def delete(self) -> bool:
        """
        Deletes the ContentInstance


        :returns: True if delete succeeds, False otherwise
        """
        success, _, _ = self._delete()
        return success

    def delete_with_http_info(self) -> ApiResponse:
        """
        Deletes the ContentInstance and return response metadata


        :returns: ApiResponse with success boolean, status code, and headers
        """
        success, status_code, headers = self._delete()
        return ApiResponse(data=success, status_code=status_code, headers=headers)

    async def _delete_async(self) -> tuple:
        """
        Internal async helper for delete operation

        Returns:
            tuple: (success_boolean, status_code, headers)
        """

        headers = values.of({})

        return await self._version.delete_with_response_info_async(
            method="DELETE", uri=self._uri, headers=headers
        )

    async def delete_async(self) -> bool:
        """
        Asynchronous coroutine that deletes the ContentInstance


        :returns: True if delete succeeds, False otherwise
        """
        success, _, _ = await self._delete_async()
        return success

    async def delete_with_http_info_async(self) -> ApiResponse:
        """
        Asynchronous coroutine that deletes the ContentInstance and return response metadata


        :returns: ApiResponse with success boolean, status code, and headers
        """
        success, status_code, headers = await self._delete_async()
        return ApiResponse(data=success, status_code=status_code, headers=headers)

    def _fetch(self) -> tuple:
        """
        Internal helper for fetch operation

        Returns:
            tuple: (payload, status_code, headers)
        """

        headers = values.of({})

        headers["Accept"] = "application/json"

        return self._version.fetch_with_response_info(
            method="GET", uri=self._uri, headers=headers
        )

    def fetch(self) -> ContentInstance:
        """
        Fetch the ContentInstance


        :returns: The fetched ContentInstance
        """
        payload, _, _ = self._fetch()
        return ContentInstance(
            self._version,
            payload,
            sid=self._solution["sid"],
        )

    def fetch_with_http_info(self) -> ApiResponse:
        """
        Fetch the ContentInstance and return response metadata


        :returns: ApiResponse with instance, status code, and headers
        """
        payload, status_code, headers = self._fetch()
        instance = ContentInstance(
            self._version,
            payload,
            sid=self._solution["sid"],
        )
        return ApiResponse(data=instance, status_code=status_code, headers=headers)

    async def _fetch_async(self) -> tuple:
        """
        Internal async helper for fetch operation

        Returns:
            tuple: (payload, status_code, headers)
        """

        headers = values.of({})

        headers["Accept"] = "application/json"

        return await self._version.fetch_with_response_info_async(
            method="GET", uri=self._uri, headers=headers
        )

    async def fetch_async(self) -> ContentInstance:
        """
        Asynchronous coroutine to fetch the ContentInstance


        :returns: The fetched ContentInstance
        """
        payload, _, _ = await self._fetch_async()
        return ContentInstance(
            self._version,
            payload,
            sid=self._solution["sid"],
        )

    async def fetch_with_http_info_async(self) -> ApiResponse:
        """
        Asynchronous coroutine to fetch the ContentInstance and return response metadata


        :returns: ApiResponse with instance, status code, and headers
        """
        payload, status_code, headers = await self._fetch_async()
        instance = ContentInstance(
            self._version,
            payload,
            sid=self._solution["sid"],
        )
        return ApiResponse(data=instance, status_code=status_code, headers=headers)

    def _update(self, content_update_request: ContentUpdateRequest) -> tuple:
        """
        Internal helper for update operation

        Returns:
            tuple: (payload, status_code, headers)
        """
        data = content_update_request.to_dict()

        headers = values.of({})

        headers["Content-Type"] = "application/json"

        headers["Accept"] = "application/json"

        return self._version.update_with_response_info(
            method="PUT", uri=self._uri, data=data, headers=headers
        )

    def update(self, content_update_request: ContentUpdateRequest) -> ContentInstance:
        """
        Update the ContentInstance

        :param content_update_request:

        :returns: The updated ContentInstance
        """
        payload, _, _ = self._update(content_update_request=content_update_request)
        return ContentInstance(self._version, payload, sid=self._solution["sid"])

    def update_with_http_info(
        self, content_update_request: ContentUpdateRequest
    ) -> ApiResponse:
        """
        Update the ContentInstance and return response metadata

        :param content_update_request:

        :returns: ApiResponse with instance, status code, and headers
        """
        payload, status_code, headers = self._update(
            content_update_request=content_update_request
        )
        instance = ContentInstance(self._version, payload, sid=self._solution["sid"])
        return ApiResponse(data=instance, status_code=status_code, headers=headers)

    async def _update_async(
        self, content_update_request: ContentUpdateRequest
    ) -> tuple:
        """
        Internal async helper for update operation

        Returns:
            tuple: (payload, status_code, headers)
        """
        data = content_update_request.to_dict()

        headers = values.of({})

        headers["Content-Type"] = "application/json"

        headers["Accept"] = "application/json"

        return await self._version.update_with_response_info_async(
            method="PUT", uri=self._uri, data=data, headers=headers
        )

    async def update_async(
        self, content_update_request: ContentUpdateRequest
    ) -> ContentInstance:
        """
        Asynchronous coroutine to update the ContentInstance

        :param content_update_request:

        :returns: The updated ContentInstance
        """
        payload, _, _ = await self._update_async(
            content_update_request=content_update_request
        )
        return ContentInstance(self._version, payload, sid=self._solution["sid"])

    async def update_with_http_info_async(
        self, content_update_request: ContentUpdateRequest
    ) -> ApiResponse:
        """
        Asynchronous coroutine to update the ContentInstance and return response metadata

        :param content_update_request:

        :returns: ApiResponse with instance, status code, and headers
        """
        payload, status_code, headers = await self._update_async(
            content_update_request=content_update_request
        )
        instance = ContentInstance(self._version, payload, sid=self._solution["sid"])
        return ApiResponse(data=instance, status_code=status_code, headers=headers)

    @property
    def approval_create(self) -> ApprovalCreateList:
        """
        Access the approval_create
        """
        if self._approval_create is None:
            self._approval_create = ApprovalCreateList(
                self._version,
                self._solution["sid"],
            )
        return self._approval_create

    @property
    def approval_fetch(self) -> ApprovalFetchList:
        """
        Access the approval_fetch
        """
        if self._approval_fetch is None:
            self._approval_fetch = ApprovalFetchList(
                self._version,
                self._solution["sid"],
            )
        return self._approval_fetch

    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 "<Twilio.Content.V1.ContentContext {}>".format(context)


class ContentPage(Page):

    def get_instance(self, payload: Dict[str, Any]) -> ContentInstance:
        """
        Build an instance of ContentInstance

        :param payload: Payload response from the API
        """
        return ContentInstance(self._version, payload)

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

        :returns: Machine friendly representation
        """
        return "<Twilio.Content.V1.ContentPage>"


class ContentList(ListResource):

    class AuthenticationAction(object):
        """
        :ivar type:
        :ivar copy_code_text:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.type: Optional["ContentInstance.AuthenticationActionType"] = (
                payload.get("type")
            )
            self.copy_code_text: Optional[str] = payload.get("copy_code_text")

        def to_dict(self):
            return {
                "type": self.type,
                "copy_code_text": self.copy_code_text,
            }

    class CallToActionAction(object):
        """
        :ivar type:
        :ivar title:
        :ivar url:
        :ivar phone:
        :ivar code:
        :ivar id:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.type: Optional["ContentInstance.CallToActionActionType"] = payload.get(
                "type"
            )
            self.title: Optional[str] = payload.get("title")
            self.url: Optional[str] = payload.get("url")
            self.phone: Optional[str] = payload.get("phone")
            self.code: Optional[str] = payload.get("code")
            self.id: Optional[str] = payload.get("id")

        def to_dict(self):
            return {
                "type": self.type,
                "title": self.title,
                "url": self.url,
                "phone": self.phone,
                "code": self.code,
                "id": self.id,
            }

    class CardAction(object):
        """
        :ivar type:
        :ivar title:
        :ivar url:
        :ivar phone:
        :ivar id:
        :ivar code:
        :ivar webview_size:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.type: Optional["ContentInstance.CardActionType"] = payload.get("type")
            self.title: Optional[str] = payload.get("title")
            self.url: Optional[str] = payload.get("url")
            self.phone: Optional[str] = payload.get("phone")
            self.id: Optional[str] = payload.get("id")
            self.code: Optional[str] = payload.get("code")
            self.webview_size: Optional["ContentInstance.WebviewSizeType"] = (
                payload.get("webview_size")
            )

        def to_dict(self):
            return {
                "type": self.type,
                "title": self.title,
                "url": self.url,
                "phone": self.phone,
                "id": self.id,
                "code": self.code,
                "webview_size": self.webview_size,
            }

    class CarouselAction(object):
        """
        :ivar type:
        :ivar title:
        :ivar url:
        :ivar phone:
        :ivar id:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.type: Optional["ContentInstance.CarouselActionType"] = payload.get(
                "type"
            )
            self.title: Optional[str] = payload.get("title")
            self.url: Optional[str] = payload.get("url")
            self.phone: Optional[str] = payload.get("phone")
            self.id: Optional[str] = payload.get("id")

        def to_dict(self):
            return {
                "type": self.type,
                "title": self.title,
                "url": self.url,
                "phone": self.phone,
                "id": self.id,
            }

    class CarouselCard(object):
        """
        :ivar title:
        :ivar body:
        :ivar media:
        :ivar actions:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.title: Optional[str] = payload.get("title")
            self.body: Optional[str] = payload.get("body")
            self.media: Optional[str] = payload.get("media")
            self.actions: Optional[List[ContentList.CarouselAction]] = payload.get(
                "actions"
            )

        def to_dict(self):
            return {
                "title": self.title,
                "body": self.body,
                "media": self.media,
                "actions": (
                    [actions.to_dict() for actions in self.actions]
                    if self.actions is not None
                    else None
                ),
            }

    class CatalogItem(object):
        """
        :ivar id:
        :ivar section_title:
        :ivar name:
        :ivar media_url:
        :ivar price:
        :ivar description:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.id: Optional[str] = payload.get("id")
            self.section_title: Optional[str] = payload.get("section_title")
            self.name: Optional[str] = payload.get("name")
            self.media_url: Optional[str] = payload.get("media_url")
            self.price: Optional[float] = payload.get("price")
            self.description: Optional[str] = payload.get("description")

        def to_dict(self):
            return {
                "id": self.id,
                "section_title": self.section_title,
                "name": self.name,
                "media_url": self.media_url,
                "price": self.price,
                "description": self.description,
            }

    class ContentCreateRequest(object):
        """
        :ivar friendly_name: User defined name of the content
        :ivar variables: Key value pairs of variable name to value
        :ivar language: Language code for the content
        :ivar types:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.friendly_name: Optional[str] = payload.get("friendly_name")
            self.variables: Optional[Dict[str, str]] = payload.get("variables")
            self.language: Optional[str] = payload.get("language")
            self.types: Optional[ContentList.Types] = payload.get("types")

        def to_dict(self):
            return {
                "friendly_name": self.friendly_name,
                "variables": self.variables,
                "language": self.language,
                "types": self.types.to_dict() if self.types is not None else None,
            }

    class ContentUpdateRequest(object):
        """
        :ivar friendly_name: User defined name of the content
        :ivar variables: Key value pairs of variable name to value
        :ivar language: Language code for the content
        :ivar types:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.friendly_name: Optional[str] = payload.get("friendly_name")
            self.variables: Optional[Dict[str, str]] = payload.get("variables")
            self.language: Optional[str] = payload.get("language")
            self.types: Optional[ContentList.Types] = payload.get("types")

        def to_dict(self):
            return {
                "friendly_name": self.friendly_name,
                "variables": self.variables,
                "language": self.language,
                "types": self.types.to_dict() if self.types is not None else None,
            }

    class FlowsPage(object):
        """
        :ivar id:
        :ivar next_page_id:
        :ivar title:
        :ivar subtitle:
        :ivar layout:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.id: Optional[str] = payload.get("id")
            self.next_page_id: Optional[str] = payload.get("next_page_id")
            self.title: Optional[str] = payload.get("title")
            self.subtitle: Optional[str] = payload.get("subtitle")
            self.layout: Optional[List[ContentList.FlowsPageComponent]] = payload.get(
                "layout"
            )

        def to_dict(self):
            return {
                "id": self.id,
                "next_page_id": self.next_page_id,
                "title": self.title,
                "subtitle": self.subtitle,
                "layout": (
                    [layout.to_dict() for layout in self.layout]
                    if self.layout is not None
                    else None
                ),
            }

    class FlowsPageComponent(object):
        """
        :ivar label:
        :ivar type:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.label: Optional[str] = payload.get("label")
            self.type: Optional[str] = payload.get("type")

        def to_dict(self):
            return {
                "label": self.label,
                "type": self.type,
            }

    class ListItem(object):
        """
        :ivar id:
        :ivar item:
        :ivar description:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.id: Optional[str] = payload.get("id")
            self.item: Optional[str] = payload.get("item")
            self.description: Optional[str] = payload.get("description")

        def to_dict(self):
            return {
                "id": self.id,
                "item": self.item,
                "description": self.description,
            }

    class QuickReplyAction(object):
        """
        :ivar type:
        :ivar title:
        :ivar id:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.type: Optional["ContentInstance.QuickReplyActionType"] = payload.get(
                "type"
            )
            self.title: Optional[str] = payload.get("title")
            self.id: Optional[str] = payload.get("id")

        def to_dict(self):
            return {
                "type": self.type,
                "title": self.title,
                "id": self.id,
            }

    class TwilioCallToAction(object):
        """
        :ivar body:
        :ivar actions:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.actions: Optional[List[ContentList.CallToActionAction]] = payload.get(
                "actions"
            )

        def to_dict(self):
            return {
                "body": self.body,
                "actions": (
                    [actions.to_dict() for actions in self.actions]
                    if self.actions is not None
                    else None
                ),
            }

    class TwilioCard(object):
        """
        :ivar title:
        :ivar subtitle:
        :ivar media:
        :ivar actions:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.title: Optional[str] = payload.get("title")
            self.subtitle: Optional[str] = payload.get("subtitle")
            self.media: Optional[List[str]] = payload.get("media")
            self.actions: Optional[List[ContentList.CardAction]] = payload.get(
                "actions"
            )

        def to_dict(self):
            return {
                "title": self.title,
                "subtitle": self.subtitle,
                "media": self.media,
                "actions": (
                    [actions.to_dict() for actions in self.actions]
                    if self.actions is not None
                    else None
                ),
            }

    class TwilioCarousel(object):
        """
        :ivar body:
        :ivar cards:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.cards: Optional[List[ContentList.CarouselCard]] = payload.get("cards")

        def to_dict(self):
            return {
                "body": self.body,
                "cards": (
                    [cards.to_dict() for cards in self.cards]
                    if self.cards is not None
                    else None
                ),
            }

    class TwilioCatalog(object):
        """
        :ivar title:
        :ivar body:
        :ivar subtitle:
        :ivar id:
        :ivar items:
        :ivar dynamic_items:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.title: Optional[str] = payload.get("title")
            self.body: Optional[str] = payload.get("body")
            self.subtitle: Optional[str] = payload.get("subtitle")
            self.id: Optional[str] = payload.get("id")
            self.items: Optional[List[ContentList.CatalogItem]] = payload.get("items")
            self.dynamic_items: Optional[str] = payload.get("dynamic_items")

        def to_dict(self):
            return {
                "title": self.title,
                "body": self.body,
                "subtitle": self.subtitle,
                "id": self.id,
                "items": (
                    [items.to_dict() for items in self.items]
                    if self.items is not None
                    else None
                ),
                "dynamic_items": self.dynamic_items,
            }

    class TwilioFlows(object):
        """
        :ivar body:
        :ivar button_text:
        :ivar subtitle:
        :ivar media_url:
        :ivar pages:
        :ivar type:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.button_text: Optional[str] = payload.get("button_text")
            self.subtitle: Optional[str] = payload.get("subtitle")
            self.media_url: Optional[str] = payload.get("media_url")
            self.pages: Optional[List[ContentList.FlowsPage]] = payload.get("pages")
            self.type: Optional[str] = payload.get("type")

        def to_dict(self):
            return {
                "body": self.body,
                "button_text": self.button_text,
                "subtitle": self.subtitle,
                "media_url": self.media_url,
                "pages": (
                    [pages.to_dict() for pages in self.pages]
                    if self.pages is not None
                    else None
                ),
                "type": self.type,
            }

    class TwilioListPicker(object):
        """
        :ivar body:
        :ivar button:
        :ivar items:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.button: Optional[str] = payload.get("button")
            self.items: Optional[List[ContentList.ListItem]] = payload.get("items")

        def to_dict(self):
            return {
                "body": self.body,
                "button": self.button,
                "items": (
                    [items.to_dict() for items in self.items]
                    if self.items is not None
                    else None
                ),
            }

    class TwilioLocation(object):
        """
        :ivar latitude:
        :ivar longitude:
        :ivar label:
        :ivar id:
        :ivar address:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.latitude: Optional[float] = payload.get("latitude")
            self.longitude: Optional[float] = payload.get("longitude")
            self.label: Optional[str] = payload.get("label")
            self.id: Optional[str] = payload.get("id")
            self.address: Optional[str] = payload.get("address")

        def to_dict(self):
            return {
                "latitude": self.latitude,
                "longitude": self.longitude,
                "label": self.label,
                "id": self.id,
                "address": self.address,
            }

    class TwilioMedia(object):
        """
        :ivar body:
        :ivar media:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.media: Optional[List[str]] = payload.get("media")

        def to_dict(self):
            return {
                "body": self.body,
                "media": self.media,
            }

    class TwilioQuickReply(object):
        """
        :ivar body:
        :ivar actions:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.actions: Optional[List[ContentList.QuickReplyAction]] = payload.get(
                "actions"
            )

        def to_dict(self):
            return {
                "body": self.body,
                "actions": (
                    [actions.to_dict() for actions in self.actions]
                    if self.actions is not None
                    else None
                ),
            }

    class TwilioSchedule(object):
        """
        :ivar id:
        :ivar title:
        :ivar time_slots:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.id: Optional[str] = payload.get("id")
            self.title: Optional[str] = payload.get("title")
            self.time_slots: Optional[str] = payload.get("time_slots")

        def to_dict(self):
            return {
                "id": self.id,
                "title": self.title,
                "time_slots": self.time_slots,
            }

    class TwilioText(object):
        """
        :ivar body:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")

        def to_dict(self):
            return {
                "body": self.body,
            }

    class Types(object):
        """
        :ivar twilio_text:
        :ivar twilio_media:
        :ivar twilio_location:
        :ivar twilio_list_picker:
        :ivar twilio_call_to_action:
        :ivar twilio_quick_reply:
        :ivar twilio_card:
        :ivar twilio_catalog:
        :ivar twilio_carousel:
        :ivar twilio_flows:
        :ivar twilio_schedule:
        :ivar whatsapp_card:
        :ivar whatsapp_authentication:
        :ivar whatsapp_flows:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.twilio_text: Optional[ContentList.TwilioText] = payload.get(
                "twilio_text"
            )
            self.twilio_media: Optional[ContentList.TwilioMedia] = payload.get(
                "twilio_media"
            )
            self.twilio_location: Optional[ContentList.TwilioLocation] = payload.get(
                "twilio_location"
            )
            self.twilio_list_picker: Optional[ContentList.TwilioListPicker] = (
                payload.get("twilio_list_picker")
            )
            self.twilio_call_to_action: Optional[ContentList.TwilioCallToAction] = (
                payload.get("twilio_call_to_action")
            )
            self.twilio_quick_reply: Optional[ContentList.TwilioQuickReply] = (
                payload.get("twilio_quick_reply")
            )
            self.twilio_card: Optional[ContentList.TwilioCard] = payload.get(
                "twilio_card"
            )
            self.twilio_catalog: Optional[ContentList.TwilioCatalog] = payload.get(
                "twilio_catalog"
            )
            self.twilio_carousel: Optional[ContentList.TwilioCarousel] = payload.get(
                "twilio_carousel"
            )
            self.twilio_flows: Optional[ContentList.TwilioFlows] = payload.get(
                "twilio_flows"
            )
            self.twilio_schedule: Optional[ContentList.TwilioSchedule] = payload.get(
                "twilio_schedule"
            )
            self.whatsapp_card: Optional[ContentList.WhatsappCard] = payload.get(
                "whatsapp_card"
            )
            self.whatsapp_authentication: Optional[
                ContentList.WhatsappAuthentication
            ] = payload.get("whatsapp_authentication")
            self.whatsapp_flows: Optional[ContentList.WhatsappFlows] = payload.get(
                "whatsapp_flows"
            )

        def to_dict(self):
            return {
                "twilio_text": (
                    self.twilio_text.to_dict() if self.twilio_text is not None else None
                ),
                "twilio_media": (
                    self.twilio_media.to_dict()
                    if self.twilio_media is not None
                    else None
                ),
                "twilio_location": (
                    self.twilio_location.to_dict()
                    if self.twilio_location is not None
                    else None
                ),
                "twilio_list_picker": (
                    self.twilio_list_picker.to_dict()
                    if self.twilio_list_picker is not None
                    else None
                ),
                "twilio_call_to_action": (
                    self.twilio_call_to_action.to_dict()
                    if self.twilio_call_to_action is not None
                    else None
                ),
                "twilio_quick_reply": (
                    self.twilio_quick_reply.to_dict()
                    if self.twilio_quick_reply is not None
                    else None
                ),
                "twilio_card": (
                    self.twilio_card.to_dict() if self.twilio_card is not None else None
                ),
                "twilio_catalog": (
                    self.twilio_catalog.to_dict()
                    if self.twilio_catalog is not None
                    else None
                ),
                "twilio_carousel": (
                    self.twilio_carousel.to_dict()
                    if self.twilio_carousel is not None
                    else None
                ),
                "twilio_flows": (
                    self.twilio_flows.to_dict()
                    if self.twilio_flows is not None
                    else None
                ),
                "twilio_schedule": (
                    self.twilio_schedule.to_dict()
                    if self.twilio_schedule is not None
                    else None
                ),
                "whatsapp_card": (
                    self.whatsapp_card.to_dict()
                    if self.whatsapp_card is not None
                    else None
                ),
                "whatsapp_authentication": (
                    self.whatsapp_authentication.to_dict()
                    if self.whatsapp_authentication is not None
                    else None
                ),
                "whatsapp_flows": (
                    self.whatsapp_flows.to_dict()
                    if self.whatsapp_flows is not None
                    else None
                ),
            }

    class WhatsappAuthentication(object):
        """
        :ivar add_security_recommendation:
        :ivar code_expiration_minutes:
        :ivar actions:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.add_security_recommendation: Optional[bool] = payload.get(
                "add_security_recommendation"
            )
            self.code_expiration_minutes: Optional[float] = payload.get(
                "code_expiration_minutes"
            )
            self.actions: Optional[List[ContentList.AuthenticationAction]] = (
                payload.get("actions")
            )

        def to_dict(self):
            return {
                "add_security_recommendation": self.add_security_recommendation,
                "code_expiration_minutes": self.code_expiration_minutes,
                "actions": (
                    [actions.to_dict() for actions in self.actions]
                    if self.actions is not None
                    else None
                ),
            }

    class WhatsappCard(object):
        """
        :ivar body:
        :ivar footer:
        :ivar media:
        :ivar header_text:
        :ivar actions:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.footer: Optional[str] = payload.get("footer")
            self.media: Optional[List[str]] = payload.get("media")
            self.header_text: Optional[str] = payload.get("header_text")
            self.actions: Optional[List[ContentList.CardAction]] = payload.get(
                "actions"
            )

        def to_dict(self):
            return {
                "body": self.body,
                "footer": self.footer,
                "media": self.media,
                "header_text": self.header_text,
                "actions": (
                    [actions.to_dict() for actions in self.actions]
                    if self.actions is not None
                    else None
                ),
            }

    class WhatsappFlows(object):
        """
        :ivar body:
        :ivar button_text:
        :ivar subtitle:
        :ivar media_url:
        :ivar flow_id:
        :ivar flow_token:
        :ivar flow_first_page_id:
        :ivar is_flow_first_page_endpoint:
        """

        def __init__(self, payload: Dict[str, Any]):

            self.body: Optional[str] = payload.get("body")
            self.button_text: Optional[str] = payload.get("button_text")
            self.subtitle: Optional[str] = payload.get("subtitle")
            self.media_url: Optional[str] = payload.get("media_url")
            self.flow_id: Optional[str] = payload.get("flow_id")
            self.flow_token: Optional[str] = payload.get("flow_token")
            self.flow_first_page_id: Optional[str] = payload.get("flow_first_page_id")
            self.is_flow_first_page_endpoint: Optional[bool] = payload.get(
                "is_flow_first_page_endpoint"
            )

        def to_dict(self):
            return {
                "body": self.body,
                "button_text": self.button_text,
                "subtitle": self.subtitle,
                "media_url": self.media_url,
                "flow_id": self.flow_id,
                "flow_token": self.flow_token,
                "flow_first_page_id": self.flow_first_page_id,
                "is_flow_first_page_endpoint": self.is_flow_first_page_endpoint,
            }

    def __init__(self, version: Version):
        """
        Initialize the ContentList

        :param version: Version that contains the resource

        """
        super().__init__(version)

        self._uri = "/Content"

    def _create(self, content_create_request: ContentCreateRequest) -> tuple:
        """
        Internal helper for create operation

        Returns:
            tuple: (payload, status_code, headers)
        """
        data = content_create_request.to_dict()

        headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

        headers["Content-Type"] = "application/json"

        headers["Accept"] = "application/json"

        return self._version.create_with_response_info(
            method="POST", uri=self._uri, data=data, headers=headers
        )

    def create(self, content_create_request: ContentCreateRequest) -> ContentInstance:
        """
        Create the ContentInstance

        :param content_create_request:

        :returns: The created ContentInstance
        """
        payload, _, _ = self._create(content_create_request=content_create_request)
        return ContentInstance(self._version, payload)

    def create_with_http_info(
        self, content_create_request: ContentCreateRequest
    ) -> ApiResponse:
        """
        Create the ContentInstance and return response metadata

        :param content_create_request:

        :returns: ApiResponse with instance, status code, and headers
        """
        payload, status_code, headers = self._create(
            content_create_request=content_create_request
        )
        instance = ContentInstance(self._version, payload)
        return ApiResponse(data=instance, status_code=status_code, headers=headers)

    async def _create_async(
        self, content_create_request: ContentCreateRequest
    ) -> tuple:
        """
        Internal async helper for create operation

        Returns:
            tuple: (payload, status_code, headers)
        """
        data = content_create_request.to_dict()

        headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

        headers["Content-Type"] = "application/json"

        headers["Accept"] = "application/json"

        return await self._version.create_with_response_info_async(
            method="POST", uri=self._uri, data=data, headers=headers
        )

    async def create_async(
        self, content_create_request: ContentCreateRequest
    ) -> ContentInstance:
        """
        Asynchronously create the ContentInstance

        :param content_create_request:

        :returns: The created ContentInstance
        """
        payload, _, _ = await self._create_async(
            content_create_request=content_create_request
        )
        return ContentInstance(self._version, payload)

    async def create_with_http_info_async(
        self, content_create_request: ContentCreateRequest
    ) -> ApiResponse:
        """
        Asynchronously create the ContentInstance and return response metadata

        :param content_create_request:

        :returns: ApiResponse with instance, status code, and headers
        """
        payload, status_code, headers = await self._create_async(
            content_create_request=content_create_request
        )
        instance = ContentInstance(self._version, payload)
        return ApiResponse(data=instance, status_code=status_code, headers=headers)

    def stream(
        self,
        limit: Optional[int] = None,
        page_size: Optional[int] = None,
    ) -> Iterator[ContentInstance]:
        """
        Streams ContentInstance records from the API as a generator stream.
        This operation lazily loads records as efficiently as possible until the limit
        is reached.
        The results are returned as a generator, so this operation is memory efficient.

        :param limit: Upper limit for the number of records to return. stream()
                      guarantees to never return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, stream() will attempt to read the
                          limit with the most efficient page size, i.e. min(limit, 1000)

        :returns: Generator that will yield up to limit results
        """
        limits = self._version.read_limits(limit, page_size)
        page = self.page(page_size=limits["page_size"])

        return self._version.stream(page, limits["limit"])

    async def stream_async(
        self,
        limit: Optional[int] = None,
        page_size: Optional[int] = None,
    ) -> AsyncIterator[ContentInstance]:
        """
        Asynchronously streams ContentInstance records from the API as a generator stream.
        This operation lazily loads records as efficiently as possible until the limit
        is reached.
        The results are returned as a generator, so this operation is memory efficient.

        :param limit: Upper limit for the number of records to return. stream()
                      guarantees to never return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, stream() will attempt to read the
                          limit with the most efficient page size, i.e. min(limit, 1000)

        :returns: Generator that will yield up to limit results
        """
        limits = self._version.read_limits(limit, page_size)
        page = await self.page_async(page_size=limits["page_size"])

        return self._version.stream_async(page, limits["limit"])

    def stream_with_http_info(
        self,
        limit: Optional[int] = None,
        page_size: Optional[int] = None,
    ) -> tuple:
        """
        Streams ContentInstance and returns headers from first page


        :param limit: Upper limit for the number of records to return. stream()
                      guarantees to never return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, stream() will attempt to read the
                          limit with the most efficient page size, i.e. min(limit, 1000)

        :returns: tuple of (generator, status_code, headers) where generator yields instances
        """
        limits = self._version.read_limits(limit, page_size)
        page_response = self.page_with_http_info(page_size=limits["page_size"])

        generator = self._version.stream(page_response.data, limits["limit"])
        return (generator, page_response.status_code, page_response.headers)

    async def stream_with_http_info_async(
        self,
        limit: Optional[int] = None,
        page_size: Optional[int] = None,
    ) -> tuple:
        """
        Asynchronously streams ContentInstance and returns headers from first page


        :param limit: Upper limit for the number of records to return. stream()
                      guarantees to never return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, stream() will attempt to read the
                          limit with the most efficient page size, i.e. min(limit, 1000)

        :returns: tuple of (generator, status_code, headers) where generator yields instances
        """
        limits = self._version.read_limits(limit, page_size)
        page_response = await self.page_with_http_info_async(
            page_size=limits["page_size"]
        )

        generator = self._version.stream_async(page_response.data, limits["limit"])
        return (generator, page_response.status_code, page_response.headers)

    def list(
        self,
        limit: Optional[int] = None,
        page_size: Optional[int] = None,
    ) -> List[ContentInstance]:
        """
        Lists ContentInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param limit: Upper limit for the number of records to return. list() guarantees
                      never to return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, list() will attempt to read the limit
                          with the most efficient page size, i.e. min(limit, 1000)

        :returns: list that will contain up to limit results
        """
        return list(
            self.stream(
                limit=limit,
                page_size=page_size,
            )
        )

    async def list_async(
        self,
        limit: Optional[int] = None,
        page_size: Optional[int] = None,
    ) -> List[ContentInstance]:
        """
        Asynchronously lists ContentInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param limit: Upper limit for the number of records to return. list() guarantees
                      never to return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, list() will attempt to read the limit
                          with the most efficient page size, i.e. min(limit, 1000)

        :returns: list that will contain up to limit results
        """
        return [
            record
            async for record in await self.stream_async(
                limit=limit,
                page_size=page_size,
            )
        ]

    def list_with_http_info(
        self,
        limit: Optional[int] = None,
        page_size: Optional[int] = None,
    ) -> ApiResponse:
        """
        Lists ContentInstance and returns headers from first page


        :param limit: Upper limit for the number of records to return. list() guarantees
                      never to return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, list() will attempt to read the limit
                          with the most efficient page size, i.e. min(limit, 1000)

        :returns: ApiResponse with list of instances, status code, and headers
        """
        generator, status_code, headers = self.stream_with_http_info(
            limit=limit,
            page_size=page_size,
        )
        items = list(generator)
        return ApiResponse(data=items, status_code=status_code, headers=headers)

    async def list_with_http_info_async(
        self,
        limit: Optional[int] = None,
        page_size: Optional[int] = None,
    ) -> ApiResponse:
        """
        Asynchronously lists ContentInstance and returns headers from first page


        :param limit: Upper limit for the number of records to return. list() guarantees
                      never to return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, list() will attempt to read the limit
                          with the most efficient page size, i.e. min(limit, 1000)

        :returns: ApiResponse with list of instances, status code, and headers
        """
        generator, status_code, headers = await self.stream_with_http_info_async(
            limit=limit,
            page_size=page_size,
        )
        items = [record async for record in generator]
        return ApiResponse(data=items, status_code=status_code, headers=headers)

    def page(
        self,
        page_token: Union[str, object] = values.unset,
        page_number: Union[int, object] = values.unset,
        page_size: Union[int, object] = values.unset,
    ) -> ContentPage:
        """
        Retrieve a single page of ContentInstance records from the API.
        Request is executed immediately

        :param page_token: PageToken provided by the API
        :param page_number: Page Number, this value is simply for client state
        :param page_size: Number of records to return, defaults to 50

        :returns: Page of ContentInstance
        """
        data = values.of(
            {
                "PageToken": page_token,
                "Page": page_number,
                "PageSize": page_size,
            }
        )

        headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

        headers["Accept"] = "application/json"

        response = self._version.page(
            method="GET", uri=self._uri, params=data, headers=headers
        )
        return ContentPage(self._version, response)

    async def page_async(
        self,
        page_token: Union[str, object] = values.unset,
        page_number: Union[int, object] = values.unset,
        page_size: Union[int, object] = values.unset,
    ) -> ContentPage:
        """
        Asynchronously retrieve a single page of ContentInstance records from the API.
        Request is executed immediately

        :param page_token: PageToken provided by the API
        :param page_number: Page Number, this value is simply for client state
        :param page_size: Number of records to return, defaults to 50

        :returns: Page of ContentInstance
        """
        data = values.of(
            {
                "PageToken": page_token,
                "Page": page_number,
                "PageSize": page_size,
            }
        )

        headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

        headers["Accept"] = "application/json"

        response = await self._version.page_async(
            method="GET", uri=self._uri, params=data, headers=headers
        )
        return ContentPage(self._version, response)

    def page_with_http_info(
        self,
        page_token: Union[str, object] = values.unset,
        page_number: Union[int, object] = values.unset,
        page_size: Union[int, object] = values.unset,
    ) -> ApiResponse:
        """
        Retrieve a single page with response metadata


        :param page_token: PageToken provided by the API
        :param page_number: Page Number, this value is simply for client state
        :param page_size: Number of records to return, defaults to 50

        :returns: ApiResponse with ContentPage, status code, and headers
        """
        data = values.of(
            {
                "PageToken": page_token,
                "Page": page_number,
                "PageSize": page_size,
            }
        )

        headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

        headers["Accept"] = "application/json"

        response, status_code, response_headers = self._version.page_with_response_info(
            method="GET", uri=self._uri, params=data, headers=headers
        )
        page = ContentPage(self._version, response)
        return ApiResponse(data=page, status_code=status_code, headers=response_headers)

    async def page_with_http_info_async(
        self,
        page_token: Union[str, object] = values.unset,
        page_number: Union[int, object] = values.unset,
        page_size: Union[int, object] = values.unset,
    ) -> ApiResponse:
        """
        Asynchronously retrieve a single page with response metadata


        :param page_token: PageToken provided by the API
        :param page_number: Page Number, this value is simply for client state
        :param page_size: Number of records to return, defaults to 50

        :returns: ApiResponse with ContentPage, status code, and headers
        """
        data = values.of(
            {
                "PageToken": page_token,
                "Page": page_number,
                "PageSize": page_size,
            }
        )

        headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})

        headers["Accept"] = "application/json"

        response, status_code, response_headers = (
            await self._version.page_with_response_info_async(
                method="GET", uri=self._uri, params=data, headers=headers
            )
        )
        page = ContentPage(self._version, response)
        return ApiResponse(data=page, status_code=status_code, headers=response_headers)

    def get_page(self, target_url: str) -> ContentPage:
        """
        Retrieve a specific page of ContentInstance records from the API.
        Request is executed immediately

        :param target_url: API-generated URL for the requested results page

        :returns: Page of ContentInstance
        """
        response = self._version.domain.twilio.request("GET", target_url)
        return ContentPage(self._version, response)

    async def get_page_async(self, target_url: str) -> ContentPage:
        """
        Asynchronously retrieve a specific page of ContentInstance records from the API.
        Request is executed immediately

        :param target_url: API-generated URL for the requested results page

        :returns: Page of ContentInstance
        """
        response = await self._version.domain.twilio.request_async("GET", target_url)
        return ContentPage(self._version, response)

    def get(self, sid: str) -> ContentContext:
        """
        Constructs a ContentContext

        :param sid: The Twilio-provided string that uniquely identifies the Content resource to update.
        """
        return ContentContext(self._version, sid=sid)

    def __call__(self, sid: str) -> ContentContext:
        """
        Constructs a ContentContext

        :param sid: The Twilio-provided string that uniquely identifies the Content resource to update.
        """
        return ContentContext(self._version, sid=sid)

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

        :returns: Machine friendly representation
        """
        return "<Twilio.Content.V1.ContentList>"
