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

    Twilio - Iam
    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
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


class OAuthAppInstance(InstanceResource):

    class IamV1AccountVendorOauthAppCreateRequest(object):
        """
        :ivar type:
        :ivar friendly_name:
        :ivar owner_sid:
        :ivar description:
        :ivar client_sid:
        :ivar policy:
        :ivar access_token_ttl:
        """

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

            self.type: Optional[str] = payload.get("type")
            self.friendly_name: Optional[str] = payload.get("friendly_name")
            self.owner_sid: Optional[str] = payload.get("owner_sid")
            self.description: Optional[str] = payload.get("description")
            self.client_sid: Optional[str] = payload.get("client_sid")
            self.policy: Optional[
                OAuthAppList.IamV1OrganizationVendoroauthappPolicy
            ] = payload.get("policy")
            self.access_token_ttl: Optional[int] = payload.get("access_token_ttl")

        def to_dict(self):
            return {
                "type": self.type,
                "friendly_name": self.friendly_name,
                "owner_sid": self.owner_sid,
                "description": self.description,
                "client_sid": self.client_sid,
                "policy": self.policy.to_dict() if self.policy is not None else None,
                "access_token_ttl": self.access_token_ttl,
            }

    class IamV1AccountVendorOauthAppUpdateRequest(object):
        """
        :ivar type:
        :ivar friendly_name:
        :ivar description:
        :ivar policy:
        :ivar access_token_ttl:
        """

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

            self.type: Optional[str] = payload.get("type")
            self.friendly_name: Optional[str] = payload.get("friendly_name")
            self.description: Optional[str] = payload.get("description")
            self.policy: Optional[
                OAuthAppList.IamV1OrganizationVendorOauthAppUpdateRequestPolicy
            ] = payload.get("policy")
            self.access_token_ttl: Optional[int] = payload.get("access_token_ttl")

        def to_dict(self):
            return {
                "type": self.type,
                "friendly_name": self.friendly_name,
                "description": self.description,
                "policy": self.policy.to_dict() if self.policy is not None else None,
                "access_token_ttl": self.access_token_ttl,
            }

    class IamV1OrganizationVendorOauthAppUpdateRequestPolicy(object):
        """
        :ivar allow: Set of permissions explicitly allowed
        :ivar deny: Set of permissions explicitly denied
        """

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

            self.allow: Optional[List[str]] = payload.get("allow")
            self.deny: Optional[List[str]] = payload.get("deny")

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

    class IamV1OrganizationVendoroauthappPolicy(object):
        """
        :ivar allow: Set of permissions explicitly allowed
        :ivar deny: Set of permissions explicitly denied
        """

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

            self.allow: Optional[List[str]] = payload.get("allow")
            self.deny: Optional[List[str]] = payload.get("deny")

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

    """
    :ivar type: 
    :ivar sid: 
    :ivar friendly_name: 
    :ivar description: 
    :ivar date_created: 
    :ivar created_by: 
    :ivar secret: 
    :ivar status: 
    :ivar policy: 
    :ivar access_token_ttl: 
    :ivar code: Twilio-specific error code
    :ivar message: Error message
    :ivar more_info: Link to Error Code References
    """

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

        self.type: Optional[str] = payload.get("type")
        self.sid: Optional[str] = payload.get("sid")
        self.friendly_name: Optional[str] = payload.get("friendly_name")
        self.description: Optional[str] = payload.get("description")
        self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
            payload.get("date_created")
        )
        self.created_by: Optional[str] = payload.get("created_by")
        self.secret: Optional[str] = payload.get("secret")
        self.status: Optional[str] = payload.get("status")
        self.policy: Optional[str] = payload.get("policy")
        self.access_token_ttl: Optional[int] = deserialize.integer(
            payload.get("access_token_ttl")
        )
        self.code: Optional[int] = payload.get("code")
        self.message: Optional[str] = payload.get("message")
        self.more_info: Optional[str] = payload.get("more_info")

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

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

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

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


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

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


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

    def delete_with_http_info(self) -> ApiResponse:
        """
        Deletes the OAuthAppInstance 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 OAuthAppInstance with HTTP info


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

    def update(
        self,
        iam_v1_account_vendor_oauth_app_update_request: IamV1AccountVendorOauthAppUpdateRequest,
    ) -> "OAuthAppInstance":
        """
        Update the OAuthAppInstance

        :param iam_v1_account_vendor_oauth_app_update_request:

        :returns: The updated OAuthAppInstance
        """
        return self._proxy.update(
            iam_v1_account_vendor_oauth_app_update_request=iam_v1_account_vendor_oauth_app_update_request,
        )

    async def update_async(
        self,
        iam_v1_account_vendor_oauth_app_update_request: IamV1AccountVendorOauthAppUpdateRequest,
    ) -> "OAuthAppInstance":
        """
        Asynchronous coroutine to update the OAuthAppInstance

        :param iam_v1_account_vendor_oauth_app_update_request:

        :returns: The updated OAuthAppInstance
        """
        return await self._proxy.update_async(
            iam_v1_account_vendor_oauth_app_update_request=iam_v1_account_vendor_oauth_app_update_request,
        )

    def update_with_http_info(
        self,
        iam_v1_account_vendor_oauth_app_update_request: IamV1AccountVendorOauthAppUpdateRequest,
    ) -> ApiResponse:
        """
        Update the OAuthAppInstance with HTTP info

        :param iam_v1_account_vendor_oauth_app_update_request:

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

    async def update_with_http_info_async(
        self,
        iam_v1_account_vendor_oauth_app_update_request: IamV1AccountVendorOauthAppUpdateRequest,
    ) -> ApiResponse:
        """
        Asynchronous coroutine to update the OAuthAppInstance with HTTP info

        :param iam_v1_account_vendor_oauth_app_update_request:

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

    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.Iam.V1.OAuthAppInstance {}>".format(context)


class OAuthAppContext(InstanceContext):

    class IamV1AccountVendorOauthAppCreateRequest(object):
        """
        :ivar type:
        :ivar friendly_name:
        :ivar owner_sid:
        :ivar description:
        :ivar client_sid:
        :ivar policy:
        :ivar access_token_ttl:
        """

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

            self.type: Optional[str] = payload.get("type")
            self.friendly_name: Optional[str] = payload.get("friendly_name")
            self.owner_sid: Optional[str] = payload.get("owner_sid")
            self.description: Optional[str] = payload.get("description")
            self.client_sid: Optional[str] = payload.get("client_sid")
            self.policy: Optional[
                OAuthAppList.IamV1OrganizationVendoroauthappPolicy
            ] = payload.get("policy")
            self.access_token_ttl: Optional[int] = payload.get("access_token_ttl")

        def to_dict(self):
            return {
                "type": self.type,
                "friendly_name": self.friendly_name,
                "owner_sid": self.owner_sid,
                "description": self.description,
                "client_sid": self.client_sid,
                "policy": self.policy.to_dict() if self.policy is not None else None,
                "access_token_ttl": self.access_token_ttl,
            }

    class IamV1AccountVendorOauthAppUpdateRequest(object):
        """
        :ivar type:
        :ivar friendly_name:
        :ivar description:
        :ivar policy:
        :ivar access_token_ttl:
        """

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

            self.type: Optional[str] = payload.get("type")
            self.friendly_name: Optional[str] = payload.get("friendly_name")
            self.description: Optional[str] = payload.get("description")
            self.policy: Optional[
                OAuthAppList.IamV1OrganizationVendorOauthAppUpdateRequestPolicy
            ] = payload.get("policy")
            self.access_token_ttl: Optional[int] = payload.get("access_token_ttl")

        def to_dict(self):
            return {
                "type": self.type,
                "friendly_name": self.friendly_name,
                "description": self.description,
                "policy": self.policy.to_dict() if self.policy is not None else None,
                "access_token_ttl": self.access_token_ttl,
            }

    class IamV1OrganizationVendorOauthAppUpdateRequestPolicy(object):
        """
        :ivar allow: Set of permissions explicitly allowed
        :ivar deny: Set of permissions explicitly denied
        """

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

            self.allow: Optional[List[str]] = payload.get("allow")
            self.deny: Optional[List[str]] = payload.get("deny")

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

    class IamV1OrganizationVendoroauthappPolicy(object):
        """
        :ivar allow: Set of permissions explicitly allowed
        :ivar deny: Set of permissions explicitly denied
        """

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

            self.allow: Optional[List[str]] = payload.get("allow")
            self.deny: Optional[List[str]] = payload.get("deny")

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

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

        :param version: Version that contains the resource
        :param sid: Unique ID (sid) of the OAuth app
        """
        super().__init__(version)

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

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

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

        headers = values.of({})

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

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

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


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

    def delete_with_http_info(self) -> ApiResponse:
        """
        Deletes the OAuthAppInstance 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({})

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

        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 OAuthAppInstance


        :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 OAuthAppInstance 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 _update(
        self,
        iam_v1_account_vendor_oauth_app_update_request: IamV1AccountVendorOauthAppUpdateRequest,
    ) -> tuple:
        """
        Internal helper for update operation

        Returns:
            tuple: (payload, status_code, headers)
        """
        data = iam_v1_account_vendor_oauth_app_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,
        iam_v1_account_vendor_oauth_app_update_request: IamV1AccountVendorOauthAppUpdateRequest,
    ) -> OAuthAppInstance:
        """
        Update the OAuthAppInstance

        :param iam_v1_account_vendor_oauth_app_update_request:

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

    def update_with_http_info(
        self,
        iam_v1_account_vendor_oauth_app_update_request: IamV1AccountVendorOauthAppUpdateRequest,
    ) -> ApiResponse:
        """
        Update the OAuthAppInstance and return response metadata

        :param iam_v1_account_vendor_oauth_app_update_request:

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

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

        Returns:
            tuple: (payload, status_code, headers)
        """
        data = iam_v1_account_vendor_oauth_app_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,
        iam_v1_account_vendor_oauth_app_update_request: IamV1AccountVendorOauthAppUpdateRequest,
    ) -> OAuthAppInstance:
        """
        Asynchronous coroutine to update the OAuthAppInstance

        :param iam_v1_account_vendor_oauth_app_update_request:

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

    async def update_with_http_info_async(
        self,
        iam_v1_account_vendor_oauth_app_update_request: IamV1AccountVendorOauthAppUpdateRequest,
    ) -> ApiResponse:
        """
        Asynchronous coroutine to update the OAuthAppInstance and return response metadata

        :param iam_v1_account_vendor_oauth_app_update_request:

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

    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.Iam.V1.OAuthAppContext {}>".format(context)


class OAuthAppList(ListResource):

    class IamV1AccountVendorOauthAppCreateRequest(object):
        """
        :ivar type:
        :ivar friendly_name:
        :ivar owner_sid:
        :ivar description:
        :ivar client_sid:
        :ivar policy:
        :ivar access_token_ttl:
        """

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

            self.type: Optional[str] = payload.get("type")
            self.friendly_name: Optional[str] = payload.get("friendly_name")
            self.owner_sid: Optional[str] = payload.get("owner_sid")
            self.description: Optional[str] = payload.get("description")
            self.client_sid: Optional[str] = payload.get("client_sid")
            self.policy: Optional[
                OAuthAppList.IamV1OrganizationVendoroauthappPolicy
            ] = payload.get("policy")
            self.access_token_ttl: Optional[int] = payload.get("access_token_ttl")

        def to_dict(self):
            return {
                "type": self.type,
                "friendly_name": self.friendly_name,
                "owner_sid": self.owner_sid,
                "description": self.description,
                "client_sid": self.client_sid,
                "policy": self.policy.to_dict() if self.policy is not None else None,
                "access_token_ttl": self.access_token_ttl,
            }

    class IamV1AccountVendorOauthAppUpdateRequest(object):
        """
        :ivar type:
        :ivar friendly_name:
        :ivar description:
        :ivar policy:
        :ivar access_token_ttl:
        """

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

            self.type: Optional[str] = payload.get("type")
            self.friendly_name: Optional[str] = payload.get("friendly_name")
            self.description: Optional[str] = payload.get("description")
            self.policy: Optional[
                OAuthAppList.IamV1OrganizationVendorOauthAppUpdateRequestPolicy
            ] = payload.get("policy")
            self.access_token_ttl: Optional[int] = payload.get("access_token_ttl")

        def to_dict(self):
            return {
                "type": self.type,
                "friendly_name": self.friendly_name,
                "description": self.description,
                "policy": self.policy.to_dict() if self.policy is not None else None,
                "access_token_ttl": self.access_token_ttl,
            }

    class IamV1OrganizationVendorOauthAppUpdateRequestPolicy(object):
        """
        :ivar allow: Set of permissions explicitly allowed
        :ivar deny: Set of permissions explicitly denied
        """

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

            self.allow: Optional[List[str]] = payload.get("allow")
            self.deny: Optional[List[str]] = payload.get("deny")

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

    class IamV1OrganizationVendoroauthappPolicy(object):
        """
        :ivar allow: Set of permissions explicitly allowed
        :ivar deny: Set of permissions explicitly denied
        """

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

            self.allow: Optional[List[str]] = payload.get("allow")
            self.deny: Optional[List[str]] = payload.get("deny")

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

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

        :param version: Version that contains the resource

        """
        super().__init__(version)

        self._uri = "/Account/OAuthApps"

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

        Returns:
            tuple: (payload, status_code, headers)
        """
        data = iam_v1_account_vendor_oauth_app_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,
        iam_v1_account_vendor_oauth_app_create_request: IamV1AccountVendorOauthAppCreateRequest,
    ) -> OAuthAppInstance:
        """
        Create the OAuthAppInstance

        :param iam_v1_account_vendor_oauth_app_create_request:

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

    def create_with_http_info(
        self,
        iam_v1_account_vendor_oauth_app_create_request: IamV1AccountVendorOauthAppCreateRequest,
    ) -> ApiResponse:
        """
        Create the OAuthAppInstance and return response metadata

        :param iam_v1_account_vendor_oauth_app_create_request:

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

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

        Returns:
            tuple: (payload, status_code, headers)
        """
        data = iam_v1_account_vendor_oauth_app_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,
        iam_v1_account_vendor_oauth_app_create_request: IamV1AccountVendorOauthAppCreateRequest,
    ) -> OAuthAppInstance:
        """
        Asynchronously create the OAuthAppInstance

        :param iam_v1_account_vendor_oauth_app_create_request:

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

    async def create_with_http_info_async(
        self,
        iam_v1_account_vendor_oauth_app_create_request: IamV1AccountVendorOauthAppCreateRequest,
    ) -> ApiResponse:
        """
        Asynchronously create the OAuthAppInstance and return response metadata

        :param iam_v1_account_vendor_oauth_app_create_request:

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

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

        :param sid: Unique ID (sid) of the OAuth app
        """
        return OAuthAppContext(self._version, sid=sid)

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

        :param sid: Unique ID (sid) of the OAuth app
        """
        return OAuthAppContext(self._version, sid=sid)

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

        :returns: Machine friendly representation
        """
        return "<Twilio.Iam.V1.OAuthAppList>"
