diff --git a/twilio/rest/accounts/v1/credential.py b/twilio/rest/accounts/v1/credential.py deleted file mode 100644 index 05a1a14459..0000000000 --- a/twilio/rest/accounts/v1/credential.py +++ /dev/null @@ -1,49 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Accounts - This is the public Twilio REST API. - - NOTE: This class is auto generated by OpenAPI Generator. - https://openapi-generator.tech - Do not edit the class manually. -""" - - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.rest.credential.aws import AwsListInstancefrom twilio.rest.credential.public_key import PublicKeyListInstance - - - - -class CredentialListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Credentials' - - self._aws = None - self._public_key = None - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/accounts/v1/credential/__init__.py b/twilio/rest/accounts/v1/credential/__init__.py index 9a1e99a13c..05a1a14459 100644 --- a/twilio/rest/accounts/v1/credential/__init__.py +++ b/twilio/rest/accounts/v1/credential/__init__.py @@ -1,130 +1,49 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.accounts.v1.credential.aws import AwsList -from twilio.rest.accounts.v1.credential.public_key import PublicKeyList - - -class CredentialList(ListResource): - - def __init__(self, version): - """ - Initialize the CredentialList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.accounts.v1.credential.CredentialList - :rtype: twilio.rest.accounts.v1.credential.CredentialList - """ - super(CredentialList, self).__init__(version) - - # Path Solution - self._solution = {} - - # Components - self._public_key = None - self._aws = None + Twilio - Accounts + This is the public Twilio REST API. - @property - def public_key(self): - """ - Access the public_key - - :returns: twilio.rest.accounts.v1.credential.public_key.PublicKeyList - :rtype: twilio.rest.accounts.v1.credential.public_key.PublicKeyList - """ - if self._public_key is None: - self._public_key = PublicKeyList(self._version, ) - return self._public_key - - @property - def aws(self): - """ - Access the aws - - :returns: twilio.rest.accounts.v1.credential.aws.AwsList - :rtype: twilio.rest.accounts.v1.credential.aws.AwsList - """ - if self._aws is None: - self._aws = AwsList(self._version, ) - return self._aws + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +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.rest.credential.aws import AwsListInstancefrom twilio.rest.credential.public_key import PublicKeyListInstance -class CredentialPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the CredentialPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.accounts.v1.credential.CredentialPage - :rtype: twilio.rest.accounts.v1.credential.CredentialPage - """ - super(CredentialPage, self).__init__(version, response) +class CredentialListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CredentialInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.accounts.v1.credential.CredentialInstance - :rtype: twilio.rest.accounts.v1.credential.CredentialInstance - """ - return CredentialInstance(self._version, payload, ) + self._solution = { } + self._uri = '/Credentials' + + self._aws = None + self._public_key = None + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - + return '' -class CredentialInstance(InstanceResource): - - def __init__(self, version, payload): - """ - Initialize the CredentialInstance - - :returns: twilio.rest.accounts.v1.credential.CredentialInstance - :rtype: twilio.rest.accounts.v1.credential.CredentialInstance - """ - super(CredentialInstance, self).__init__(version) - - # Context - self._context = None - self._solution = {} - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account.py b/twilio/rest/api/v2010/account.py deleted file mode 100644 index ade826da53..0000000000 --- a/twilio/rest/api/v2010/account.py +++ /dev/null @@ -1,259 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Api - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.account.address import AddressListInstancefrom twilio.rest.account.application import ApplicationListInstancefrom twilio.rest.account.authorized_connect_app import AuthorizedConnectAppListInstancefrom twilio.rest.account.available_phone_number_country import AvailablePhoneNumberCountryListInstancefrom twilio.rest.account.balance import BalanceListInstancefrom twilio.rest.account.call import CallListInstancefrom twilio.rest.account.conference import ConferenceListInstancefrom twilio.rest.account.connect_app import ConnectAppListInstancefrom twilio.rest.account.incoming_phone_number import IncomingPhoneNumberListInstancefrom twilio.rest.account.key import KeyListInstancefrom twilio.rest.account.message import MessageListInstancefrom twilio.rest.account.new_key import NewKeyListInstancefrom twilio.rest.account.new_signing_key import NewSigningKeyListInstancefrom twilio.rest.account.notification import NotificationListInstancefrom twilio.rest.account.outgoing_caller_id import OutgoingCallerIdListInstancefrom twilio.rest.account.queue import QueueListInstancefrom twilio.rest.account.recording import RecordingListInstancefrom twilio.rest.account.short_code import ShortCodeListInstancefrom twilio.rest.account.signing_key import SigningKeyListInstancefrom twilio.rest.account.sip import SipListInstancefrom twilio.rest.account.token import TokenListInstancefrom twilio.rest.account.transcription import TranscriptionListInstancefrom twilio.rest.account.usage import UsageListInstancefrom twilio.rest.account.validation_request import ValidationRequestListInstance - - -class AccountContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Accounts/${sid}.json' - - self._addresses = None - self._applications = None - self._authorized_connect_apps = None - self._available_phone_numbers = None - self._balance = None - self._calls = None - self._conferences = None - self._connect_apps = None - self._incoming_phone_numbers = None - self._keys = None - self._messages = None - self._new_keys = None - self._new_signing_keys = None - self._notifications = None - self._outgoing_caller_ids = None - self._queues = None - self._recordings = None - self._short_codes = None - self._signing_keys = None - self._sip = None - self._tokens = None - self._transcriptions = None - self._usage = None - self._validation_requests = None - - def fetch(self): - - """ - Fetch the AccountInstance - - :returns: The fetched AccountInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AccountInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return AccountInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class AccountInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'auth_token' : payload.get('auth_token'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'friendly_name' : payload.get('friendly_name'), - 'owner_account_sid' : payload.get('owner_account_sid'), - 'sid' : payload.get('sid'), - 'status' : payload.get('status'), - 'subresource_uris' : payload.get('subresource_uris'), - 'type' : payload.get('type'), - 'uri' : payload.get('uri'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = AccountContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def addresses(self): - return self._proxy.addresses - @property - def applications(self): - return self._proxy.applications - @property - def authorized_connect_apps(self): - return self._proxy.authorized_connect_apps - @property - def available_phone_numbers(self): - return self._proxy.available_phone_numbers - @property - def balance(self): - return self._proxy.balance - @property - def calls(self): - return self._proxy.calls - @property - def conferences(self): - return self._proxy.conferences - @property - def connect_apps(self): - return self._proxy.connect_apps - @property - def incoming_phone_numbers(self): - return self._proxy.incoming_phone_numbers - @property - def keys(self): - return self._proxy.keys - @property - def messages(self): - return self._proxy.messages - @property - def new_keys(self): - return self._proxy.new_keys - @property - def new_signing_keys(self): - return self._proxy.new_signing_keys - @property - def notifications(self): - return self._proxy.notifications - @property - def outgoing_caller_ids(self): - return self._proxy.outgoing_caller_ids - @property - def queues(self): - return self._proxy.queues - @property - def recordings(self): - return self._proxy.recordings - @property - def short_codes(self): - return self._proxy.short_codes - @property - def signing_keys(self): - return self._proxy.signing_keys - @property - def sip(self): - return self._proxy.sip - @property - def tokens(self): - return self._proxy.tokens - @property - def transcriptions(self): - return self._proxy.transcriptions - @property - def usage(self): - return self._proxy.usage - @property - def validation_requests(self): - return self._proxy.validation_requests - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class AccountListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Accounts.json' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return AccountInstance(self._version, payload, ) - - """ - - """ - def page(self, friendly_name, status, page_size): - - data = values.of({ - 'friendly_name': friendly_name,'status': status,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return AccountPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/api/v2010/account/__init__.py b/twilio/rest/api/v2010/account/__init__.py index 84eeab6e5b..ade826da53 100644 --- a/twilio/rest/api/v2010/account/__init__.py +++ b/twilio/rest/api/v2010/account/__init__.py @@ -1,261 +1,40 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.address import AddressList -from twilio.rest.api.v2010.account.application import ApplicationList -from twilio.rest.api.v2010.account.authorized_connect_app import AuthorizedConnectAppList -from twilio.rest.api.v2010.account.available_phone_number import AvailablePhoneNumberCountryList -from twilio.rest.api.v2010.account.balance import BalanceList -from twilio.rest.api.v2010.account.call import CallList -from twilio.rest.api.v2010.account.conference import ConferenceList -from twilio.rest.api.v2010.account.connect_app import ConnectAppList -from twilio.rest.api.v2010.account.incoming_phone_number import IncomingPhoneNumberList -from twilio.rest.api.v2010.account.key import KeyList -from twilio.rest.api.v2010.account.message import MessageList -from twilio.rest.api.v2010.account.new_key import NewKeyList -from twilio.rest.api.v2010.account.new_signing_key import NewSigningKeyList -from twilio.rest.api.v2010.account.notification import NotificationList -from twilio.rest.api.v2010.account.outgoing_caller_id import OutgoingCallerIdList -from twilio.rest.api.v2010.account.queue import QueueList -from twilio.rest.api.v2010.account.recording import RecordingList -from twilio.rest.api.v2010.account.short_code import ShortCodeList -from twilio.rest.api.v2010.account.signing_key import SigningKeyList -from twilio.rest.api.v2010.account.sip import SipList -from twilio.rest.api.v2010.account.token import TokenList -from twilio.rest.api.v2010.account.transcription import TranscriptionList -from twilio.rest.api.v2010.account.usage import UsageList -from twilio.rest.api.v2010.account.validation_request import ValidationRequestList - - -class AccountList(ListResource): - - def __init__(self, version): - """ - Initialize the AccountList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.api.v2010.account.AccountList - :rtype: twilio.rest.api.v2010.account.AccountList - """ - super(AccountList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Accounts.json'.format(**self._solution) - - def create(self, friendly_name=values.unset): - """ - Create the AccountInstance - - :param unicode friendly_name: A human readable description of the account - - :returns: The created AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return AccountInstance(self._version, payload, ) - - def stream(self, friendly_name=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Streams AccountInstance 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 unicode friendly_name: FriendlyName to filter on - :param AccountInstance.Status status: Status to filter on - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.AccountInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(friendly_name=friendly_name, status=status, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, friendly_name=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Lists AccountInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode friendly_name: FriendlyName to filter on - :param AccountInstance.Status status: Status to filter on - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.AccountInstance] - """ - return list(self.stream( - friendly_name=friendly_name, - status=status, - limit=limit, - page_size=page_size, - )) - - def page(self, friendly_name=values.unset, status=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AccountInstance records from the API. - Request is executed immediately - - :param unicode friendly_name: FriendlyName to filter on - :param AccountInstance.Status status: Status to filter on - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountPage - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Status': status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AccountPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AccountInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AccountPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AccountContext - - :param sid: Fetch by unique Account Sid - - :returns: twilio.rest.api.v2010.account.AccountContext - :rtype: twilio.rest.api.v2010.account.AccountContext - """ - return AccountContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a AccountContext - - :param sid: Fetch by unique Account Sid - - :returns: twilio.rest.api.v2010.account.AccountContext - :rtype: twilio.rest.api.v2010.account.AccountContext - """ - return AccountContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.version import Version - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AccountPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the AccountPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.api.v2010.account.AccountPage - :rtype: twilio.rest.api.v2010.account.AccountPage - """ - super(AccountPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AccountInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountInstance - """ - return AccountInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.account.address import AddressListInstancefrom twilio.rest.account.application import ApplicationListInstancefrom twilio.rest.account.authorized_connect_app import AuthorizedConnectAppListInstancefrom twilio.rest.account.available_phone_number_country import AvailablePhoneNumberCountryListInstancefrom twilio.rest.account.balance import BalanceListInstancefrom twilio.rest.account.call import CallListInstancefrom twilio.rest.account.conference import ConferenceListInstancefrom twilio.rest.account.connect_app import ConnectAppListInstancefrom twilio.rest.account.incoming_phone_number import IncomingPhoneNumberListInstancefrom twilio.rest.account.key import KeyListInstancefrom twilio.rest.account.message import MessageListInstancefrom twilio.rest.account.new_key import NewKeyListInstancefrom twilio.rest.account.new_signing_key import NewSigningKeyListInstancefrom twilio.rest.account.notification import NotificationListInstancefrom twilio.rest.account.outgoing_caller_id import OutgoingCallerIdListInstancefrom twilio.rest.account.queue import QueueListInstancefrom twilio.rest.account.recording import RecordingListInstancefrom twilio.rest.account.short_code import ShortCodeListInstancefrom twilio.rest.account.signing_key import SigningKeyListInstancefrom twilio.rest.account.sip import SipListInstancefrom twilio.rest.account.token import TokenListInstancefrom twilio.rest.account.transcription import TranscriptionListInstancefrom twilio.rest.account.usage import UsageListInstancefrom twilio.rest.account.validation_request import ValidationRequestListInstance class AccountContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the AccountContext - - :param Version version: Version that contains the resource - :param sid: Fetch by unique Account Sid - - :returns: twilio.rest.api.v2010.account.AccountContext - :rtype: twilio.rest.api.v2010.account.AccountContext - """ - super(AccountContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Accounts/{sid}.json'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Accounts/${sid}.json' + self._addresses = None self._applications = None self._authorized_connect_apps = None @@ -273,747 +52,208 @@ def __init__(self, version, sid): self._outgoing_caller_ids = None self._queues = None self._recordings = None + self._short_codes = None self._signing_keys = None self._sip = None - self._short_codes = None self._tokens = None self._transcriptions = None self._usage = None self._validation_requests = None - + def fetch(self): + """ Fetch the AccountInstance :returns: The fetched AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return AccountInstance(self._version, payload, sid=self._solution['sid'], ) + - def update(self, friendly_name=values.unset, status=values.unset): - """ - Update the AccountInstance - - :param unicode friendly_name: FriendlyName to update - :param AccountInstance.Status status: Status to update the Account with - - :returns: The updated AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountInstance - """ - data = values.of({'FriendlyName': friendly_name, 'Status': status, }) + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return AccountInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def addresses(self): - """ - Access the addresses - - :returns: twilio.rest.api.v2010.account.address.AddressList - :rtype: twilio.rest.api.v2010.account.address.AddressList - """ - if self._addresses is None: - self._addresses = AddressList(self._version, account_sid=self._solution['sid'], ) - return self._addresses - - @property - def applications(self): - """ - Access the applications - - :returns: twilio.rest.api.v2010.account.application.ApplicationList - :rtype: twilio.rest.api.v2010.account.application.ApplicationList - """ - if self._applications is None: - self._applications = ApplicationList(self._version, account_sid=self._solution['sid'], ) - return self._applications - - @property - def authorized_connect_apps(self): - """ - Access the authorized_connect_apps - - :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList - """ - if self._authorized_connect_apps is None: - self._authorized_connect_apps = AuthorizedConnectAppList( - self._version, - account_sid=self._solution['sid'], - ) - return self._authorized_connect_apps - - @property - def available_phone_numbers(self): - """ - Access the available_phone_numbers - - :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryList - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryList - """ - if self._available_phone_numbers is None: - self._available_phone_numbers = AvailablePhoneNumberCountryList( - self._version, - account_sid=self._solution['sid'], - ) - return self._available_phone_numbers - - @property - def balance(self): - """ - Access the balance - - :returns: twilio.rest.api.v2010.account.balance.BalanceList - :rtype: twilio.rest.api.v2010.account.balance.BalanceList - """ - if self._balance is None: - self._balance = BalanceList(self._version, account_sid=self._solution['sid'], ) - return self._balance - - @property - def calls(self): - """ - Access the calls - - :returns: twilio.rest.api.v2010.account.call.CallList - :rtype: twilio.rest.api.v2010.account.call.CallList - """ - if self._calls is None: - self._calls = CallList(self._version, account_sid=self._solution['sid'], ) - return self._calls - - @property - def conferences(self): - """ - Access the conferences - - :returns: twilio.rest.api.v2010.account.conference.ConferenceList - :rtype: twilio.rest.api.v2010.account.conference.ConferenceList - """ - if self._conferences is None: - self._conferences = ConferenceList(self._version, account_sid=self._solution['sid'], ) - return self._conferences - - @property - def connect_apps(self): - """ - Access the connect_apps - - :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppList - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppList - """ - if self._connect_apps is None: - self._connect_apps = ConnectAppList(self._version, account_sid=self._solution['sid'], ) - return self._connect_apps - - @property - def incoming_phone_numbers(self): - """ - Access the incoming_phone_numbers - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberList - """ - if self._incoming_phone_numbers is None: - self._incoming_phone_numbers = IncomingPhoneNumberList( - self._version, - account_sid=self._solution['sid'], - ) - return self._incoming_phone_numbers - - @property - def keys(self): - """ - Access the keys - - :returns: twilio.rest.api.v2010.account.key.KeyList - :rtype: twilio.rest.api.v2010.account.key.KeyList - """ - if self._keys is None: - self._keys = KeyList(self._version, account_sid=self._solution['sid'], ) - return self._keys - - @property - def messages(self): - """ - Access the messages - - :returns: twilio.rest.api.v2010.account.message.MessageList - :rtype: twilio.rest.api.v2010.account.message.MessageList - """ - if self._messages is None: - self._messages = MessageList(self._version, account_sid=self._solution['sid'], ) - return self._messages - - @property - def new_keys(self): - """ - Access the new_keys - - :returns: twilio.rest.api.v2010.account.new_key.NewKeyList - :rtype: twilio.rest.api.v2010.account.new_key.NewKeyList - """ - if self._new_keys is None: - self._new_keys = NewKeyList(self._version, account_sid=self._solution['sid'], ) - return self._new_keys - - @property - def new_signing_keys(self): - """ - Access the new_signing_keys - - :returns: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyList - :rtype: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyList - """ - if self._new_signing_keys is None: - self._new_signing_keys = NewSigningKeyList(self._version, account_sid=self._solution['sid'], ) - return self._new_signing_keys - - @property - def notifications(self): - """ - Access the notifications - - :returns: twilio.rest.api.v2010.account.notification.NotificationList - :rtype: twilio.rest.api.v2010.account.notification.NotificationList - """ - if self._notifications is None: - self._notifications = NotificationList(self._version, account_sid=self._solution['sid'], ) - return self._notifications - - @property - def outgoing_caller_ids(self): - """ - Access the outgoing_caller_ids - - :returns: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdList - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdList - """ - if self._outgoing_caller_ids is None: - self._outgoing_caller_ids = OutgoingCallerIdList(self._version, account_sid=self._solution['sid'], ) - return self._outgoing_caller_ids - - @property - def queues(self): - """ - Access the queues - - :returns: twilio.rest.api.v2010.account.queue.QueueList - :rtype: twilio.rest.api.v2010.account.queue.QueueList - """ - if self._queues is None: - self._queues = QueueList(self._version, account_sid=self._solution['sid'], ) - return self._queues - - @property - def recordings(self): - """ - Access the recordings - - :returns: twilio.rest.api.v2010.account.recording.RecordingList - :rtype: twilio.rest.api.v2010.account.recording.RecordingList - """ - if self._recordings is None: - self._recordings = RecordingList(self._version, account_sid=self._solution['sid'], ) - return self._recordings - - @property - def signing_keys(self): - """ - Access the signing_keys - - :returns: twilio.rest.api.v2010.account.signing_key.SigningKeyList - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyList - """ - if self._signing_keys is None: - self._signing_keys = SigningKeyList(self._version, account_sid=self._solution['sid'], ) - return self._signing_keys - - @property - def sip(self): - """ - Access the sip - - :returns: twilio.rest.api.v2010.account.sip.SipList - :rtype: twilio.rest.api.v2010.account.sip.SipList - """ - if self._sip is None: - self._sip = SipList(self._version, account_sid=self._solution['sid'], ) - return self._sip - - @property - def short_codes(self): - """ - Access the short_codes - - :returns: twilio.rest.api.v2010.account.short_code.ShortCodeList - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeList - """ - if self._short_codes is None: - self._short_codes = ShortCodeList(self._version, account_sid=self._solution['sid'], ) - return self._short_codes - - @property - def tokens(self): - """ - Access the tokens - - :returns: twilio.rest.api.v2010.account.token.TokenList - :rtype: twilio.rest.api.v2010.account.token.TokenList - """ - if self._tokens is None: - self._tokens = TokenList(self._version, account_sid=self._solution['sid'], ) - return self._tokens - - @property - def transcriptions(self): - """ - Access the transcriptions - - :returns: twilio.rest.api.v2010.account.transcription.TranscriptionList - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionList - """ - if self._transcriptions is None: - self._transcriptions = TranscriptionList(self._version, account_sid=self._solution['sid'], ) - return self._transcriptions - - @property - def usage(self): - """ - Access the usage - - :returns: twilio.rest.api.v2010.account.usage.UsageList - :rtype: twilio.rest.api.v2010.account.usage.UsageList - """ - if self._usage is None: - self._usage = UsageList(self._version, account_sid=self._solution['sid'], ) - return self._usage - - @property - def validation_requests(self): - """ - Access the validation_requests - - :returns: twilio.rest.api.v2010.account.validation_request.ValidationRequestList - :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestList - """ - if self._validation_requests is None: - self._validation_requests = ValidationRequestList(self._version, account_sid=self._solution['sid'], ) - return self._validation_requests + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class AccountInstance(InstanceResource): + return '' - class Status(object): - ACTIVE = "active" - SUSPENDED = "suspended" - CLOSED = "closed" - class Type(object): - TRIAL = "Trial" - FULL = "Full" - def __init__(self, version, payload, sid=None): - """ - Initialize the AccountInstance - - :returns: twilio.rest.api.v2010.account.AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountInstance - """ - super(AccountInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'auth_token': payload.get('auth_token'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'owner_account_sid': payload.get('owner_account_sid'), - 'sid': payload.get('sid'), - 'status': payload.get('status'), - 'subresource_uris': payload.get('subresource_uris'), - 'type': payload.get('type'), - 'uri': payload.get('uri'), +class AccountInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'auth_token' : payload.get('auth_token'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'friendly_name' : payload.get('friendly_name'), + 'owner_account_sid' : payload.get('owner_account_sid'), + 'sid' : payload.get('sid'), + 'status' : payload.get('status'), + 'subresource_uris' : payload.get('subresource_uris'), + 'type' : payload.get('type'), + 'uri' : payload.get('uri'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AccountContext for this AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountContext - """ if self._context is None: - self._context = AccountContext(self._version, sid=self._solution['sid'], ) + self._context = AccountContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def auth_token(self): - """ - :returns: The authorization token for this account - :rtype: unicode - """ - return self._properties['auth_token'] - - @property - def date_created(self): - """ - :returns: The date this account was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this account was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of this account - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def owner_account_sid(self): - """ - :returns: The unique 34 character id representing the parent of this account - :rtype: unicode - """ - return self._properties['owner_account_sid'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def status(self): - """ - :returns: The status of this account - :rtype: AccountInstance.Status - """ - return self._properties['status'] - - @property - def subresource_uris(self): - """ - :returns: Account Instance Subresources - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def type(self): - """ - :returns: The type of this account - :rtype: AccountInstance.Type - """ - return self._properties['type'] - - @property - def uri(self): - """ - :returns: The URI for this resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch the AccountInstance - - :returns: The fetched AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, status=values.unset): - """ - Update the AccountInstance - - :param unicode friendly_name: FriendlyName to update - :param AccountInstance.Status status: Status to update the Account with - - :returns: The updated AccountInstance - :rtype: twilio.rest.api.v2010.account.AccountInstance - """ - return self._proxy.update(friendly_name=friendly_name, status=status, ) - @property def addresses(self): - """ - Access the addresses - - :returns: twilio.rest.api.v2010.account.address.AddressList - :rtype: twilio.rest.api.v2010.account.address.AddressList - """ return self._proxy.addresses - @property def applications(self): - """ - Access the applications - - :returns: twilio.rest.api.v2010.account.application.ApplicationList - :rtype: twilio.rest.api.v2010.account.application.ApplicationList - """ return self._proxy.applications - @property def authorized_connect_apps(self): - """ - Access the authorized_connect_apps - - :returns: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList - :rtype: twilio.rest.api.v2010.account.authorized_connect_app.AuthorizedConnectAppList - """ return self._proxy.authorized_connect_apps - @property def available_phone_numbers(self): - """ - Access the available_phone_numbers - - :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryList - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryList - """ return self._proxy.available_phone_numbers - @property def balance(self): - """ - Access the balance - - :returns: twilio.rest.api.v2010.account.balance.BalanceList - :rtype: twilio.rest.api.v2010.account.balance.BalanceList - """ return self._proxy.balance - @property def calls(self): - """ - Access the calls - - :returns: twilio.rest.api.v2010.account.call.CallList - :rtype: twilio.rest.api.v2010.account.call.CallList - """ return self._proxy.calls - @property def conferences(self): - """ - Access the conferences - - :returns: twilio.rest.api.v2010.account.conference.ConferenceList - :rtype: twilio.rest.api.v2010.account.conference.ConferenceList - """ return self._proxy.conferences - @property def connect_apps(self): - """ - Access the connect_apps - - :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppList - :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppList - """ return self._proxy.connect_apps - @property def incoming_phone_numbers(self): - """ - Access the incoming_phone_numbers - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberList - """ return self._proxy.incoming_phone_numbers - @property def keys(self): - """ - Access the keys - - :returns: twilio.rest.api.v2010.account.key.KeyList - :rtype: twilio.rest.api.v2010.account.key.KeyList - """ return self._proxy.keys - @property def messages(self): - """ - Access the messages - - :returns: twilio.rest.api.v2010.account.message.MessageList - :rtype: twilio.rest.api.v2010.account.message.MessageList - """ return self._proxy.messages - @property def new_keys(self): - """ - Access the new_keys - - :returns: twilio.rest.api.v2010.account.new_key.NewKeyList - :rtype: twilio.rest.api.v2010.account.new_key.NewKeyList - """ return self._proxy.new_keys - @property def new_signing_keys(self): - """ - Access the new_signing_keys - - :returns: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyList - :rtype: twilio.rest.api.v2010.account.new_signing_key.NewSigningKeyList - """ return self._proxy.new_signing_keys - @property def notifications(self): - """ - Access the notifications - - :returns: twilio.rest.api.v2010.account.notification.NotificationList - :rtype: twilio.rest.api.v2010.account.notification.NotificationList - """ return self._proxy.notifications - @property def outgoing_caller_ids(self): - """ - Access the outgoing_caller_ids - - :returns: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdList - :rtype: twilio.rest.api.v2010.account.outgoing_caller_id.OutgoingCallerIdList - """ return self._proxy.outgoing_caller_ids - @property def queues(self): - """ - Access the queues - - :returns: twilio.rest.api.v2010.account.queue.QueueList - :rtype: twilio.rest.api.v2010.account.queue.QueueList - """ return self._proxy.queues - @property def recordings(self): - """ - Access the recordings - - :returns: twilio.rest.api.v2010.account.recording.RecordingList - :rtype: twilio.rest.api.v2010.account.recording.RecordingList - """ return self._proxy.recordings - + @property + def short_codes(self): + return self._proxy.short_codes @property def signing_keys(self): - """ - Access the signing_keys - - :returns: twilio.rest.api.v2010.account.signing_key.SigningKeyList - :rtype: twilio.rest.api.v2010.account.signing_key.SigningKeyList - """ return self._proxy.signing_keys - @property def sip(self): - """ - Access the sip - - :returns: twilio.rest.api.v2010.account.sip.SipList - :rtype: twilio.rest.api.v2010.account.sip.SipList - """ return self._proxy.sip - - @property - def short_codes(self): - """ - Access the short_codes - - :returns: twilio.rest.api.v2010.account.short_code.ShortCodeList - :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeList - """ - return self._proxy.short_codes - @property def tokens(self): - """ - Access the tokens - - :returns: twilio.rest.api.v2010.account.token.TokenList - :rtype: twilio.rest.api.v2010.account.token.TokenList - """ return self._proxy.tokens - @property def transcriptions(self): - """ - Access the transcriptions - - :returns: twilio.rest.api.v2010.account.transcription.TranscriptionList - :rtype: twilio.rest.api.v2010.account.transcription.TranscriptionList - """ return self._proxy.transcriptions - @property def usage(self): - """ - Access the usage - - :returns: twilio.rest.api.v2010.account.usage.UsageList - :rtype: twilio.rest.api.v2010.account.usage.UsageList - """ return self._proxy.usage - @property def validation_requests(self): - """ - Access the validation_requests - - :returns: twilio.rest.api.v2010.account.validation_request.ValidationRequestList - :rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestList - """ return self._proxy.validation_requests + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) return ''.format(context) + + + +class AccountListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Accounts.json' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return AccountInstance(self._version, payload, ) + + """ + + """ + def page(self, friendly_name, status, page_size): + + data = values.of({ + 'friendly_name': friendly_name,'status': status,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AccountPage(self._version, payload, ) + """ + + + def __repr__(self): + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' + diff --git a/twilio/rest/api/v2010/account/address.py b/twilio/rest/api/v2010/account/address.py deleted file mode 100644 index 60901fd3ad..0000000000 --- a/twilio/rest/api/v2010/account/address.py +++ /dev/null @@ -1,185 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Api - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.address.dependent_phone_number import DependentPhoneNumberListInstance - - -class AddressContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/${account_sid}/Addresses/${sid}.json' - - self._dependent_phone_numbers = None - - def delete(self): - - - - """ - Deletes the AddressInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the AddressInstance - - :returns: The fetched AddressInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AddressInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return AddressInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class AddressInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'city' : payload.get('city'), - 'customer_name' : payload.get('customer_name'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'friendly_name' : payload.get('friendly_name'), - 'iso_country' : payload.get('iso_country'), - 'postal_code' : payload.get('postal_code'), - 'region' : payload.get('region'), - 'sid' : payload.get('sid'), - 'street' : payload.get('street'), - 'uri' : payload.get('uri'), - 'emergency_enabled' : payload.get('emergency_enabled'), - 'validated' : payload.get('validated'), - 'verified' : payload.get('verified'), - 'street_secondary' : payload.get('street_secondary'), - } - - self._context = None - self._solution = { - 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = AddressContext( - self._version, - account_sid=self._solution['account_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def dependent_phone_numbers(self): - return self._proxy.dependent_phone_numbers - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class AddressListInstance(ListResource): - def __init__(self, version: Version, account_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, } - self._uri = '/Accounts/${account_sid}/Addresses.json' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return AddressInstance(self._version, payload, account_sid=self._solution['account_sid']) - - """ - - """ - def page(self, customer_name, friendly_name, iso_country, page_size): - - data = values.of({ - 'customer_name': customer_name,'friendly_name': friendly_name,'iso_country': iso_country,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return AddressPage(self._version, payload, account_sid=self._solution['account_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/api/v2010/account/address/__init__.py b/twilio/rest/api/v2010/account/address/__init__.py index 6f662e2372..60901fd3ad 100644 --- a/twilio/rest/api/v2010/account/address/__init__.py +++ b/twilio/rest/api/v2010/account/address/__init__.py @@ -1,276 +1,46 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.address.dependent_phone_number import DependentPhoneNumberList - - -class AddressList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the AddressList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that is responsible for the resource - - :returns: twilio.rest.api.v2010.account.address.AddressList - :rtype: twilio.rest.api.v2010.account.address.AddressList - """ - super(AddressList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Addresses.json'.format(**self._solution) - - def create(self, customer_name, street, city, region, postal_code, iso_country, - friendly_name=values.unset, emergency_enabled=values.unset, - auto_correct_address=values.unset, street_secondary=values.unset): - """ - Create the AddressInstance - - :param unicode customer_name: The name to associate with the new address - :param unicode street: The number and street address of the new address - :param unicode city: The city of the new address - :param unicode region: The state or region of the new address - :param unicode postal_code: The postal code of the new address - :param unicode iso_country: The ISO country code of the new address - :param unicode friendly_name: A string to describe the new resource - :param bool emergency_enabled: Whether to enable emergency calling on the new address - :param bool auto_correct_address: Whether we should automatically correct the address - :param unicode street_secondary: The additional number and street address of the address - - :returns: The created AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressInstance - """ - data = values.of({ - 'CustomerName': customer_name, - 'Street': street, - 'City': city, - 'Region': region, - 'PostalCode': postal_code, - 'IsoCountry': iso_country, - 'FriendlyName': friendly_name, - 'EmergencyEnabled': emergency_enabled, - 'AutoCorrectAddress': auto_correct_address, - 'StreetSecondary': street_secondary, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return AddressInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def stream(self, customer_name=values.unset, friendly_name=values.unset, - iso_country=values.unset, limit=None, page_size=None): - """ - Streams AddressInstance 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 unicode customer_name: The `customer_name` of the Address resources to read - :param unicode friendly_name: The string that identifies the Address resources to read - :param unicode iso_country: The ISO country code of the Address resources to read - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.address.AddressInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - customer_name=customer_name, - friendly_name=friendly_name, - iso_country=iso_country, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) +from twilio.base.version import Version - def list(self, customer_name=values.unset, friendly_name=values.unset, - iso_country=values.unset, limit=None, page_size=None): - """ - Lists AddressInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode customer_name: The `customer_name` of the Address resources to read - :param unicode friendly_name: The string that identifies the Address resources to read - :param unicode iso_country: The ISO country code of the Address resources to read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.address.AddressInstance] - """ - return list(self.stream( - customer_name=customer_name, - friendly_name=friendly_name, - iso_country=iso_country, - limit=limit, - page_size=page_size, - )) - - def page(self, customer_name=values.unset, friendly_name=values.unset, - iso_country=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of AddressInstance records from the API. - Request is executed immediately - - :param unicode customer_name: The `customer_name` of the Address resources to read - :param unicode friendly_name: The string that identifies the Address resources to read - :param unicode iso_country: The ISO country code of the Address resources to read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressPage - """ - data = values.of({ - 'CustomerName': customer_name, - 'FriendlyName': friendly_name, - 'IsoCountry': iso_country, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AddressPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AddressInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AddressPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AddressContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.address.AddressContext - :rtype: twilio.rest.api.v2010.account.address.AddressContext - """ - return AddressContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a AddressContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.address.AddressContext - :rtype: twilio.rest.api.v2010.account.address.AddressContext - """ - return AddressContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AddressPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the AddressPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that is responsible for the resource - - :returns: twilio.rest.api.v2010.account.address.AddressPage - :rtype: twilio.rest.api.v2010.account.address.AddressPage - """ - super(AddressPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AddressInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.address.AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressInstance - """ - return AddressInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.address.dependent_phone_number import DependentPhoneNumberListInstance class AddressContext(InstanceContext): - - def __init__(self, version, account_sid, sid): - """ - Initialize the AddressContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that is responsible for this address - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.address.AddressContext - :rtype: twilio.rest.api.v2010.account.address.AddressContext - """ - super(AddressContext, self).__init__(version) + def __init__(self, version: Version, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Addresses/{sid}.json'.format(**self._solution) - - # Dependents + self._solution = { 'account_sid': account_sid, 'sid': sid, } + self._uri = '/Accounts/${account_sid}/Addresses/${sid}.json' + self._dependent_phone_numbers = None - + def delete(self): + + + """ Deletes the AddressInstance @@ -278,337 +48,138 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - + def fetch(self): + """ Fetch the AddressInstance :returns: The fetched AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return AddressInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset, customer_name=values.unset, - street=values.unset, city=values.unset, region=values.unset, - postal_code=values.unset, emergency_enabled=values.unset, - auto_correct_address=values.unset, street_secondary=values.unset): - """ - Update the AddressInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode customer_name: The name to associate with the address - :param unicode street: The number and street address of the address - :param unicode city: The city of the address - :param unicode region: The state or region of the address - :param unicode postal_code: The postal code of the address - :param bool emergency_enabled: Whether to enable emergency calling on the address - :param bool auto_correct_address: Whether we should automatically correct the address - :param unicode street_secondary: The additional number and street address of the address - - :returns: The updated AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressInstance - """ + return AddressInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + + + + def update(self, body): data = values.of({ - 'FriendlyName': friendly_name, - 'CustomerName': customer_name, - 'Street': street, - 'City': city, - 'Region': region, - 'PostalCode': postal_code, - 'EmergencyEnabled': emergency_enabled, - 'AutoCorrectAddress': auto_correct_address, - 'StreetSecondary': street_secondary, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return AddressInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - @property - def dependent_phone_numbers(self): - """ - Access the dependent_phone_numbers + return AddressInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + - :returns: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberList - :rtype: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberList - """ - if self._dependent_phone_numbers is None: - self._dependent_phone_numbers = DependentPhoneNumberList( - self._version, - account_sid=self._solution['account_sid'], - address_sid=self._solution['sid'], - ) - return self._dependent_phone_numbers + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class AddressInstance(InstanceResource): - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the AddressInstance - :returns: twilio.rest.api.v2010.account.address.AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressInstance - """ - super(AddressInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'city': payload.get('city'), - 'customer_name': payload.get('customer_name'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'iso_country': payload.get('iso_country'), - 'postal_code': payload.get('postal_code'), - 'region': payload.get('region'), - 'sid': payload.get('sid'), - 'street': payload.get('street'), - 'uri': payload.get('uri'), - 'emergency_enabled': payload.get('emergency_enabled'), - 'validated': payload.get('validated'), - 'verified': payload.get('verified'), - 'street_secondary': payload.get('street_secondary'), +class AddressInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'city' : payload.get('city'), + 'customer_name' : payload.get('customer_name'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'friendly_name' : payload.get('friendly_name'), + 'iso_country' : payload.get('iso_country'), + 'postal_code' : payload.get('postal_code'), + 'region' : payload.get('region'), + 'sid' : payload.get('sid'), + 'street' : payload.get('street'), + 'uri' : payload.get('uri'), + 'emergency_enabled' : payload.get('emergency_enabled'), + 'validated' : payload.get('validated'), + 'verified' : payload.get('verified'), + 'street_secondary' : payload.get('street_secondary'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AddressContext for this AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressContext - """ if self._context is None: self._context = AddressContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context @property - def account_sid(self): - """ - :returns: The SID of the Account that is responsible for the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def city(self): - """ - :returns: The city in which the address is located - :rtype: unicode - """ - return self._properties['city'] - - @property - def customer_name(self): - """ - :returns: The name associated with the address - :rtype: unicode - """ - return self._properties['customer_name'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def iso_country(self): - """ - :returns: The ISO country code of the address - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def postal_code(self): - """ - :returns: The postal code of the address - :rtype: unicode - """ - return self._properties['postal_code'] - - @property - def region(self): - """ - :returns: The state or region of the address - :rtype: unicode - """ - return self._properties['region'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def street(self): - """ - :returns: The number and street address of the address - :rtype: unicode - """ - return self._properties['street'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def emergency_enabled(self): - """ - :returns: Whether emergency calling has been enabled on this number - :rtype: bool - """ - return self._properties['emergency_enabled'] + def dependent_phone_numbers(self): + return self._proxy.dependent_phone_numbers + - @property - def validated(self): + def __repr__(self): """ - :returns: Whether the address has been validated to comply with local regulation - :rtype: bool + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['validated'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def verified(self): - """ - :returns: Whether the address has been verified to comply with regulation - :rtype: bool - """ - return self._properties['verified'] - @property - def street_secondary(self): - """ - :returns: The additional number and street address of the address - :rtype: unicode - """ - return self._properties['street_secondary'] - def delete(self): - """ - Deletes the AddressInstance +class AddressListInstance(ListResource): + def __init__(self, version: Version, account_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch the AddressInstance + # Path Solution + self._solution = { 'account_sid': account_sid, } + self._uri = '/Accounts/${account_sid}/Addresses.json' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - :returns: The fetched AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressInstance - """ - return self._proxy.fetch() + payload = self._version.create(method='post', uri=self._uri, data=data, ) - def update(self, friendly_name=values.unset, customer_name=values.unset, - street=values.unset, city=values.unset, region=values.unset, - postal_code=values.unset, emergency_enabled=values.unset, - auto_correct_address=values.unset, street_secondary=values.unset): - """ - Update the AddressInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode customer_name: The name to associate with the address - :param unicode street: The number and street address of the address - :param unicode city: The city of the address - :param unicode region: The state or region of the address - :param unicode postal_code: The postal code of the address - :param bool emergency_enabled: Whether to enable emergency calling on the address - :param bool auto_correct_address: Whether we should automatically correct the address - :param unicode street_secondary: The additional number and street address of the address - - :returns: The updated AddressInstance - :rtype: twilio.rest.api.v2010.account.address.AddressInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - customer_name=customer_name, - street=street, - city=city, - region=region, - postal_code=postal_code, - emergency_enabled=emergency_enabled, - auto_correct_address=auto_correct_address, - street_secondary=street_secondary, - ) + return AddressInstance(self._version, payload, account_sid=self._solution['account_sid']) + + """ + + """ + def page(self, customer_name, friendly_name, iso_country, page_size): + + data = values.of({ + 'customer_name': customer_name,'friendly_name': friendly_name,'iso_country': iso_country,'page_size': page_size, + }) - @property - def dependent_phone_numbers(self): - """ - Access the dependent_phone_numbers + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberList - :rtype: twilio.rest.api.v2010.account.address.dependent_phone_number.DependentPhoneNumberList - """ - return self._proxy.dependent_phone_numbers + return AddressPage(self._version, payload, account_sid=self._solution['account_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/available_phone_number/__init__.py b/twilio/rest/api/v2010/account/available_phone_number/__init__.py deleted file mode 100644 index 08a84c20b6..0000000000 --- a/twilio/rest/api/v2010/account/available_phone_number/__init__.py +++ /dev/null @@ -1,539 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.available_phone_number.local import LocalList -from twilio.rest.api.v2010.account.available_phone_number.machine_to_machine import MachineToMachineList -from twilio.rest.api.v2010.account.available_phone_number.mobile import MobileList -from twilio.rest.api.v2010.account.available_phone_number.national import NationalList -from twilio.rest.api.v2010.account.available_phone_number.shared_cost import SharedCostList -from twilio.rest.api.v2010.account.available_phone_number.toll_free import TollFreeList -from twilio.rest.api.v2010.account.available_phone_number.voip import VoipList - - -class AvailablePhoneNumberCountryList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the AvailablePhoneNumberCountryList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryList - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryList - """ - super(AvailablePhoneNumberCountryList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/AvailablePhoneNumbers.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AvailablePhoneNumberCountryInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AvailablePhoneNumberCountryInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AvailablePhoneNumberCountryInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AvailablePhoneNumberCountryInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AvailablePhoneNumberCountryPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AvailablePhoneNumberCountryInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AvailablePhoneNumberCountryInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AvailablePhoneNumberCountryPage(self._version, response, self._solution) - - def get(self, country_code): - """ - Constructs a AvailablePhoneNumberCountryContext - - :param country_code: The ISO country code of the country to fetch available phone number information about - - :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryContext - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryContext - """ - return AvailablePhoneNumberCountryContext( - self._version, - account_sid=self._solution['account_sid'], - country_code=country_code, - ) - - def __call__(self, country_code): - """ - Constructs a AvailablePhoneNumberCountryContext - - :param country_code: The ISO country code of the country to fetch available phone number information about - - :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryContext - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryContext - """ - return AvailablePhoneNumberCountryContext( - self._version, - account_sid=self._solution['account_sid'], - country_code=country_code, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AvailablePhoneNumberCountryPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the AvailablePhoneNumberCountryPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryPage - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryPage - """ - super(AvailablePhoneNumberCountryPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AvailablePhoneNumberCountryInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryInstance - """ - return AvailablePhoneNumberCountryInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AvailablePhoneNumberCountryContext(InstanceContext): - - def __init__(self, version, account_sid, country_code): - """ - Initialize the AvailablePhoneNumberCountryContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account requesting the available phone number Country resource - :param country_code: The ISO country code of the country to fetch available phone number information about - - :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryContext - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryContext - """ - super(AvailablePhoneNumberCountryContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - self._uri = '/Accounts/{account_sid}/AvailablePhoneNumbers/{country_code}.json'.format(**self._solution) - - # Dependents - self._local = None - self._toll_free = None - self._mobile = None - self._national = None - self._voip = None - self._shared_cost = None - self._machine_to_machine = None - - def fetch(self): - """ - Fetch the AvailablePhoneNumberCountryInstance - - :returns: The fetched AvailablePhoneNumberCountryInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AvailablePhoneNumberCountryInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - - @property - def local(self): - """ - Access the local - - :returns: twilio.rest.api.v2010.account.available_phone_number.local.LocalList - :rtype: twilio.rest.api.v2010.account.available_phone_number.local.LocalList - """ - if self._local is None: - self._local = LocalList( - self._version, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - return self._local - - @property - def toll_free(self): - """ - Access the toll_free - - :returns: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeList - :rtype: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeList - """ - if self._toll_free is None: - self._toll_free = TollFreeList( - self._version, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - return self._toll_free - - @property - def mobile(self): - """ - Access the mobile - - :returns: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileList - :rtype: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileList - """ - if self._mobile is None: - self._mobile = MobileList( - self._version, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - return self._mobile - - @property - def national(self): - """ - Access the national - - :returns: twilio.rest.api.v2010.account.available_phone_number.national.NationalList - :rtype: twilio.rest.api.v2010.account.available_phone_number.national.NationalList - """ - if self._national is None: - self._national = NationalList( - self._version, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - return self._national - - @property - def voip(self): - """ - Access the voip - - :returns: twilio.rest.api.v2010.account.available_phone_number.voip.VoipList - :rtype: twilio.rest.api.v2010.account.available_phone_number.voip.VoipList - """ - if self._voip is None: - self._voip = VoipList( - self._version, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - return self._voip - - @property - def shared_cost(self): - """ - Access the shared_cost - - :returns: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostList - :rtype: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostList - """ - if self._shared_cost is None: - self._shared_cost = SharedCostList( - self._version, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - return self._shared_cost - - @property - def machine_to_machine(self): - """ - Access the machine_to_machine - - :returns: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineList - :rtype: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineList - """ - if self._machine_to_machine is None: - self._machine_to_machine = MachineToMachineList( - self._version, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - return self._machine_to_machine - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class AvailablePhoneNumberCountryInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, country_code=None): - """ - Initialize the AvailablePhoneNumberCountryInstance - - :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryInstance - """ - super(AvailablePhoneNumberCountryInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'country_code': payload.get('country_code'), - 'country': payload.get('country'), - 'uri': payload.get('uri'), - 'beta': payload.get('beta'), - 'subresource_uris': payload.get('subresource_uris'), - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'country_code': country_code or self._properties['country_code'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AvailablePhoneNumberCountryContext for this AvailablePhoneNumberCountryInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryContext - """ - if self._context is None: - self._context = AvailablePhoneNumberCountryContext( - self._version, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - return self._context - - @property - def country_code(self): - """ - :returns: The ISO-3166-1 country code of the country. - :rtype: unicode - """ - return self._properties['country_code'] - - @property - def country(self): - """ - :returns: The name of the country - :rtype: unicode - """ - return self._properties['country'] - - @property - def uri(self): - """ - :returns: The URI of the Country resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def beta(self): - """ - :returns: Whether all phone numbers available in the country are new to the Twilio platform. - :rtype: bool - """ - return self._properties['beta'] - - @property - def subresource_uris(self): - """ - :returns: A list of related resources identified by their relative URIs - :rtype: unicode - """ - return self._properties['subresource_uris'] - - def fetch(self): - """ - Fetch the AvailablePhoneNumberCountryInstance - - :returns: The fetched AvailablePhoneNumberCountryInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryInstance - """ - return self._proxy.fetch() - - @property - def local(self): - """ - Access the local - - :returns: twilio.rest.api.v2010.account.available_phone_number.local.LocalList - :rtype: twilio.rest.api.v2010.account.available_phone_number.local.LocalList - """ - return self._proxy.local - - @property - def toll_free(self): - """ - Access the toll_free - - :returns: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeList - :rtype: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeList - """ - return self._proxy.toll_free - - @property - def mobile(self): - """ - Access the mobile - - :returns: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileList - :rtype: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileList - """ - return self._proxy.mobile - - @property - def national(self): - """ - Access the national - - :returns: twilio.rest.api.v2010.account.available_phone_number.national.NationalList - :rtype: twilio.rest.api.v2010.account.available_phone_number.national.NationalList - """ - return self._proxy.national - - @property - def voip(self): - """ - Access the voip - - :returns: twilio.rest.api.v2010.account.available_phone_number.voip.VoipList - :rtype: twilio.rest.api.v2010.account.available_phone_number.voip.VoipList - """ - return self._proxy.voip - - @property - def shared_cost(self): - """ - Access the shared_cost - - :returns: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostList - :rtype: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostList - """ - return self._proxy.shared_cost - - @property - def machine_to_machine(self): - """ - Access the machine_to_machine - - :returns: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineList - :rtype: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineList - """ - return self._proxy.machine_to_machine - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) diff --git a/twilio/rest/api/v2010/account/available_phone_number/local.py b/twilio/rest/api/v2010/account/available_phone_number/local.py deleted file mode 100644 index 74e197d782..0000000000 --- a/twilio/rest/api/v2010/account/available_phone_number/local.py +++ /dev/null @@ -1,455 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class LocalList(ListResource): - - def __init__(self, version, account_sid, country_code): - """ - Initialize the LocalList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param country_code: The ISO-3166-1 country code of the country. - - :returns: twilio.rest.api.v2010.account.available_phone_number.local.LocalList - :rtype: twilio.rest.api.v2010.account.available_phone_number.local.LocalList - """ - super(LocalList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - self._uri = '/Accounts/{account_sid}/AvailablePhoneNumbers/{country_code}/Local.json'.format(**self._solution) - - def stream(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, - exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Streams LocalInstance 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 unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.local.LocalInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Lists LocalInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.local.LocalInstance] - """ - return list(self.stream( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - limit=limit, - page_size=page_size, - )) - - def page(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of LocalInstance records from the API. - Request is executed immediately - - :param unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of LocalInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.local.LocalPage - """ - data = values.of({ - 'AreaCode': area_code, - 'Contains': contains, - 'SmsEnabled': sms_enabled, - 'MmsEnabled': mms_enabled, - 'VoiceEnabled': voice_enabled, - 'ExcludeAllAddressRequired': exclude_all_address_required, - 'ExcludeLocalAddressRequired': exclude_local_address_required, - 'ExcludeForeignAddressRequired': exclude_foreign_address_required, - 'Beta': beta, - 'NearNumber': near_number, - 'NearLatLong': near_lat_long, - 'Distance': distance, - 'InPostalCode': in_postal_code, - 'InRegion': in_region, - 'InRateCenter': in_rate_center, - 'InLata': in_lata, - 'InLocality': in_locality, - 'FaxEnabled': fax_enabled, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return LocalPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of LocalInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of LocalInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.local.LocalPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return LocalPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class LocalPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the LocalPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - :param country_code: The ISO-3166-1 country code of the country. - - :returns: twilio.rest.api.v2010.account.available_phone_number.local.LocalPage - :rtype: twilio.rest.api.v2010.account.available_phone_number.local.LocalPage - """ - super(LocalPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of LocalInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.available_phone_number.local.LocalInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.local.LocalInstance - """ - return LocalInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class LocalInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, country_code): - """ - Initialize the LocalInstance - - :returns: twilio.rest.api.v2010.account.available_phone_number.local.LocalInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.local.LocalInstance - """ - super(LocalInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'friendly_name': payload.get('friendly_name'), - 'phone_number': payload.get('phone_number'), - 'lata': payload.get('lata'), - 'locality': payload.get('locality'), - 'rate_center': payload.get('rate_center'), - 'latitude': deserialize.decimal(payload.get('latitude')), - 'longitude': deserialize.decimal(payload.get('longitude')), - 'region': payload.get('region'), - 'postal_code': payload.get('postal_code'), - 'iso_country': payload.get('iso_country'), - 'address_requirements': payload.get('address_requirements'), - 'beta': payload.get('beta'), - 'capabilities': payload.get('capabilities'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - - @property - def friendly_name(self): - """ - :returns: A formatted version of the phone number - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def phone_number(self): - """ - :returns: The phone number in E.164 format - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def lata(self): - """ - :returns: The LATA of this phone number - :rtype: unicode - """ - return self._properties['lata'] - - @property - def locality(self): - """ - :returns: The locality or city of this phone number's location - :rtype: unicode - """ - return self._properties['locality'] - - @property - def rate_center(self): - """ - :returns: The rate center of this phone number - :rtype: unicode - """ - return self._properties['rate_center'] - - @property - def latitude(self): - """ - :returns: The latitude of this phone number's location - :rtype: unicode - """ - return self._properties['latitude'] - - @property - def longitude(self): - """ - :returns: The longitude of this phone number's location - :rtype: unicode - """ - return self._properties['longitude'] - - @property - def region(self): - """ - :returns: The two-letter state or province abbreviation of this phone number's location - :rtype: unicode - """ - return self._properties['region'] - - @property - def postal_code(self): - """ - :returns: The postal or ZIP code of this phone number's location - :rtype: unicode - """ - return self._properties['postal_code'] - - @property - def iso_country(self): - """ - :returns: The ISO country code of this phone number - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def address_requirements(self): - """ - :returns: The type of Address resource the phone number requires - :rtype: unicode - """ - return self._properties['address_requirements'] - - @property - def beta(self): - """ - :returns: Whether the phone number is new to the Twilio platform - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: Whether a phone number can receive calls or messages - :rtype: unicode - """ - return self._properties['capabilities'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/available_phone_number/machine_to_machine.py b/twilio/rest/api/v2010/account/available_phone_number/machine_to_machine.py deleted file mode 100644 index 3ee96cebff..0000000000 --- a/twilio/rest/api/v2010/account/available_phone_number/machine_to_machine.py +++ /dev/null @@ -1,455 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class MachineToMachineList(ListResource): - - def __init__(self, version, account_sid, country_code): - """ - Initialize the MachineToMachineList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param country_code: The ISO-3166-1 country code of the country. - - :returns: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineList - :rtype: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineList - """ - super(MachineToMachineList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - self._uri = '/Accounts/{account_sid}/AvailablePhoneNumbers/{country_code}/MachineToMachine.json'.format(**self._solution) - - def stream(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, - exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Streams MachineToMachineInstance 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 unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Lists MachineToMachineInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineInstance] - """ - return list(self.stream( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - limit=limit, - page_size=page_size, - )) - - def page(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MachineToMachineInstance records from the API. - Request is executed immediately - - :param unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MachineToMachineInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachinePage - """ - data = values.of({ - 'AreaCode': area_code, - 'Contains': contains, - 'SmsEnabled': sms_enabled, - 'MmsEnabled': mms_enabled, - 'VoiceEnabled': voice_enabled, - 'ExcludeAllAddressRequired': exclude_all_address_required, - 'ExcludeLocalAddressRequired': exclude_local_address_required, - 'ExcludeForeignAddressRequired': exclude_foreign_address_required, - 'Beta': beta, - 'NearNumber': near_number, - 'NearLatLong': near_lat_long, - 'Distance': distance, - 'InPostalCode': in_postal_code, - 'InRegion': in_region, - 'InRateCenter': in_rate_center, - 'InLata': in_lata, - 'InLocality': in_locality, - 'FaxEnabled': fax_enabled, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return MachineToMachinePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MachineToMachineInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MachineToMachineInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachinePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MachineToMachinePage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class MachineToMachinePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the MachineToMachinePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - :param country_code: The ISO-3166-1 country code of the country. - - :returns: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachinePage - :rtype: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachinePage - """ - super(MachineToMachinePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MachineToMachineInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineInstance - """ - return MachineToMachineInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class MachineToMachineInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, country_code): - """ - Initialize the MachineToMachineInstance - - :returns: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineInstance - """ - super(MachineToMachineInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'friendly_name': payload.get('friendly_name'), - 'phone_number': payload.get('phone_number'), - 'lata': payload.get('lata'), - 'locality': payload.get('locality'), - 'rate_center': payload.get('rate_center'), - 'latitude': deserialize.decimal(payload.get('latitude')), - 'longitude': deserialize.decimal(payload.get('longitude')), - 'region': payload.get('region'), - 'postal_code': payload.get('postal_code'), - 'iso_country': payload.get('iso_country'), - 'address_requirements': payload.get('address_requirements'), - 'beta': payload.get('beta'), - 'capabilities': payload.get('capabilities'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - - @property - def friendly_name(self): - """ - :returns: A formatted version of the phone number - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def phone_number(self): - """ - :returns: The phone number in E.164 format - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def lata(self): - """ - :returns: The LATA of this phone number - :rtype: unicode - """ - return self._properties['lata'] - - @property - def locality(self): - """ - :returns: The locality or city of this phone number's location - :rtype: unicode - """ - return self._properties['locality'] - - @property - def rate_center(self): - """ - :returns: The rate center of this phone number - :rtype: unicode - """ - return self._properties['rate_center'] - - @property - def latitude(self): - """ - :returns: The latitude of this phone number's location - :rtype: unicode - """ - return self._properties['latitude'] - - @property - def longitude(self): - """ - :returns: The longitude of this phone number's location - :rtype: unicode - """ - return self._properties['longitude'] - - @property - def region(self): - """ - :returns: The two-letter state or province abbreviation of this phone number's location - :rtype: unicode - """ - return self._properties['region'] - - @property - def postal_code(self): - """ - :returns: The postal or ZIP code of this phone number's location - :rtype: unicode - """ - return self._properties['postal_code'] - - @property - def iso_country(self): - """ - :returns: The ISO country code of this phone number - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def address_requirements(self): - """ - :returns: The type of Address resource the phone number requires - :rtype: unicode - """ - return self._properties['address_requirements'] - - @property - def beta(self): - """ - :returns: Whether the phone number is new to the Twilio platform - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: Whether a phone number can receive calls or messages - :rtype: unicode - """ - return self._properties['capabilities'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/available_phone_number/mobile.py b/twilio/rest/api/v2010/account/available_phone_number/mobile.py deleted file mode 100644 index 1d33657b94..0000000000 --- a/twilio/rest/api/v2010/account/available_phone_number/mobile.py +++ /dev/null @@ -1,455 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class MobileList(ListResource): - - def __init__(self, version, account_sid, country_code): - """ - Initialize the MobileList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param country_code: The ISO-3166-1 country code of the country. - - :returns: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileList - :rtype: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileList - """ - super(MobileList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - self._uri = '/Accounts/{account_sid}/AvailablePhoneNumbers/{country_code}/Mobile.json'.format(**self._solution) - - def stream(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, - exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Streams MobileInstance 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 unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.mobile.MobileInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Lists MobileInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.mobile.MobileInstance] - """ - return list(self.stream( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - limit=limit, - page_size=page_size, - )) - - def page(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MobileInstance records from the API. - Request is executed immediately - - :param unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MobileInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.mobile.MobilePage - """ - data = values.of({ - 'AreaCode': area_code, - 'Contains': contains, - 'SmsEnabled': sms_enabled, - 'MmsEnabled': mms_enabled, - 'VoiceEnabled': voice_enabled, - 'ExcludeAllAddressRequired': exclude_all_address_required, - 'ExcludeLocalAddressRequired': exclude_local_address_required, - 'ExcludeForeignAddressRequired': exclude_foreign_address_required, - 'Beta': beta, - 'NearNumber': near_number, - 'NearLatLong': near_lat_long, - 'Distance': distance, - 'InPostalCode': in_postal_code, - 'InRegion': in_region, - 'InRateCenter': in_rate_center, - 'InLata': in_lata, - 'InLocality': in_locality, - 'FaxEnabled': fax_enabled, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return MobilePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MobileInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MobileInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.mobile.MobilePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MobilePage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class MobilePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the MobilePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - :param country_code: The ISO-3166-1 country code of the country. - - :returns: twilio.rest.api.v2010.account.available_phone_number.mobile.MobilePage - :rtype: twilio.rest.api.v2010.account.available_phone_number.mobile.MobilePage - """ - super(MobilePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MobileInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileInstance - """ - return MobileInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class MobileInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, country_code): - """ - Initialize the MobileInstance - - :returns: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.mobile.MobileInstance - """ - super(MobileInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'friendly_name': payload.get('friendly_name'), - 'phone_number': payload.get('phone_number'), - 'lata': payload.get('lata'), - 'locality': payload.get('locality'), - 'rate_center': payload.get('rate_center'), - 'latitude': deserialize.decimal(payload.get('latitude')), - 'longitude': deserialize.decimal(payload.get('longitude')), - 'region': payload.get('region'), - 'postal_code': payload.get('postal_code'), - 'iso_country': payload.get('iso_country'), - 'address_requirements': payload.get('address_requirements'), - 'beta': payload.get('beta'), - 'capabilities': payload.get('capabilities'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - - @property - def friendly_name(self): - """ - :returns: A formatted version of the phone number - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def phone_number(self): - """ - :returns: The phone number in E.164 format - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def lata(self): - """ - :returns: The LATA of this phone number - :rtype: unicode - """ - return self._properties['lata'] - - @property - def locality(self): - """ - :returns: The locality or city of this phone number's location - :rtype: unicode - """ - return self._properties['locality'] - - @property - def rate_center(self): - """ - :returns: The rate center of this phone number - :rtype: unicode - """ - return self._properties['rate_center'] - - @property - def latitude(self): - """ - :returns: The latitude of this phone number's location - :rtype: unicode - """ - return self._properties['latitude'] - - @property - def longitude(self): - """ - :returns: The longitude of this phone number's location - :rtype: unicode - """ - return self._properties['longitude'] - - @property - def region(self): - """ - :returns: The two-letter state or province abbreviation of this phone number's location - :rtype: unicode - """ - return self._properties['region'] - - @property - def postal_code(self): - """ - :returns: The postal or ZIP code of this phone number's location - :rtype: unicode - """ - return self._properties['postal_code'] - - @property - def iso_country(self): - """ - :returns: The ISO country code of this phone number - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def address_requirements(self): - """ - :returns: The type of Address resource the phone number requires - :rtype: unicode - """ - return self._properties['address_requirements'] - - @property - def beta(self): - """ - :returns: Whether the phone number is new to the Twilio platform - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: Whether a phone number can receive calls or messages - :rtype: unicode - """ - return self._properties['capabilities'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/available_phone_number/national.py b/twilio/rest/api/v2010/account/available_phone_number/national.py deleted file mode 100644 index 0ce7835408..0000000000 --- a/twilio/rest/api/v2010/account/available_phone_number/national.py +++ /dev/null @@ -1,455 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class NationalList(ListResource): - - def __init__(self, version, account_sid, country_code): - """ - Initialize the NationalList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param country_code: The ISO-3166-1 country code of the country. - - :returns: twilio.rest.api.v2010.account.available_phone_number.national.NationalList - :rtype: twilio.rest.api.v2010.account.available_phone_number.national.NationalList - """ - super(NationalList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - self._uri = '/Accounts/{account_sid}/AvailablePhoneNumbers/{country_code}/National.json'.format(**self._solution) - - def stream(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, - exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Streams NationalInstance 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 unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.national.NationalInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Lists NationalInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.national.NationalInstance] - """ - return list(self.stream( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - limit=limit, - page_size=page_size, - )) - - def page(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of NationalInstance records from the API. - Request is executed immediately - - :param unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of NationalInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.national.NationalPage - """ - data = values.of({ - 'AreaCode': area_code, - 'Contains': contains, - 'SmsEnabled': sms_enabled, - 'MmsEnabled': mms_enabled, - 'VoiceEnabled': voice_enabled, - 'ExcludeAllAddressRequired': exclude_all_address_required, - 'ExcludeLocalAddressRequired': exclude_local_address_required, - 'ExcludeForeignAddressRequired': exclude_foreign_address_required, - 'Beta': beta, - 'NearNumber': near_number, - 'NearLatLong': near_lat_long, - 'Distance': distance, - 'InPostalCode': in_postal_code, - 'InRegion': in_region, - 'InRateCenter': in_rate_center, - 'InLata': in_lata, - 'InLocality': in_locality, - 'FaxEnabled': fax_enabled, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return NationalPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of NationalInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of NationalInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.national.NationalPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return NationalPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class NationalPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the NationalPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - :param country_code: The ISO-3166-1 country code of the country. - - :returns: twilio.rest.api.v2010.account.available_phone_number.national.NationalPage - :rtype: twilio.rest.api.v2010.account.available_phone_number.national.NationalPage - """ - super(NationalPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NationalInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.available_phone_number.national.NationalInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.national.NationalInstance - """ - return NationalInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class NationalInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, country_code): - """ - Initialize the NationalInstance - - :returns: twilio.rest.api.v2010.account.available_phone_number.national.NationalInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.national.NationalInstance - """ - super(NationalInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'friendly_name': payload.get('friendly_name'), - 'phone_number': payload.get('phone_number'), - 'lata': payload.get('lata'), - 'locality': payload.get('locality'), - 'rate_center': payload.get('rate_center'), - 'latitude': deserialize.decimal(payload.get('latitude')), - 'longitude': deserialize.decimal(payload.get('longitude')), - 'region': payload.get('region'), - 'postal_code': payload.get('postal_code'), - 'iso_country': payload.get('iso_country'), - 'address_requirements': payload.get('address_requirements'), - 'beta': payload.get('beta'), - 'capabilities': payload.get('capabilities'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - - @property - def friendly_name(self): - """ - :returns: A formatted version of the phone number - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def phone_number(self): - """ - :returns: The phone number in E.164 format - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def lata(self): - """ - :returns: The LATA of this phone number - :rtype: unicode - """ - return self._properties['lata'] - - @property - def locality(self): - """ - :returns: The locality or city of this phone number's location - :rtype: unicode - """ - return self._properties['locality'] - - @property - def rate_center(self): - """ - :returns: The rate center of this phone number - :rtype: unicode - """ - return self._properties['rate_center'] - - @property - def latitude(self): - """ - :returns: The latitude of this phone number's location - :rtype: unicode - """ - return self._properties['latitude'] - - @property - def longitude(self): - """ - :returns: The longitude of this phone number's location - :rtype: unicode - """ - return self._properties['longitude'] - - @property - def region(self): - """ - :returns: The two-letter state or province abbreviation of this phone number's location - :rtype: unicode - """ - return self._properties['region'] - - @property - def postal_code(self): - """ - :returns: The postal or ZIP code of this phone number's location - :rtype: unicode - """ - return self._properties['postal_code'] - - @property - def iso_country(self): - """ - :returns: The ISO country code of this phone number - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def address_requirements(self): - """ - :returns: The type of Address resource the phone number requires - :rtype: unicode - """ - return self._properties['address_requirements'] - - @property - def beta(self): - """ - :returns: Whether the phone number is new to the Twilio platform - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: Whether a phone number can receive calls or messages - :rtype: unicode - """ - return self._properties['capabilities'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/available_phone_number/shared_cost.py b/twilio/rest/api/v2010/account/available_phone_number/shared_cost.py deleted file mode 100644 index cd3a769165..0000000000 --- a/twilio/rest/api/v2010/account/available_phone_number/shared_cost.py +++ /dev/null @@ -1,455 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SharedCostList(ListResource): - - def __init__(self, version, account_sid, country_code): - """ - Initialize the SharedCostList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param country_code: The ISO-3166-1 country code of the country. - - :returns: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostList - :rtype: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostList - """ - super(SharedCostList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - self._uri = '/Accounts/{account_sid}/AvailablePhoneNumbers/{country_code}/SharedCost.json'.format(**self._solution) - - def stream(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, - exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Streams SharedCostInstance 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 unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Lists SharedCostInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostInstance] - """ - return list(self.stream( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - limit=limit, - page_size=page_size, - )) - - def page(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of SharedCostInstance records from the API. - Request is executed immediately - - :param unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SharedCostInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostPage - """ - data = values.of({ - 'AreaCode': area_code, - 'Contains': contains, - 'SmsEnabled': sms_enabled, - 'MmsEnabled': mms_enabled, - 'VoiceEnabled': voice_enabled, - 'ExcludeAllAddressRequired': exclude_all_address_required, - 'ExcludeLocalAddressRequired': exclude_local_address_required, - 'ExcludeForeignAddressRequired': exclude_foreign_address_required, - 'Beta': beta, - 'NearNumber': near_number, - 'NearLatLong': near_lat_long, - 'Distance': distance, - 'InPostalCode': in_postal_code, - 'InRegion': in_region, - 'InRateCenter': in_rate_center, - 'InLata': in_lata, - 'InLocality': in_locality, - 'FaxEnabled': fax_enabled, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SharedCostPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SharedCostInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SharedCostInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SharedCostPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SharedCostPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SharedCostPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - :param country_code: The ISO-3166-1 country code of the country. - - :returns: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostPage - :rtype: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostPage - """ - super(SharedCostPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SharedCostInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostInstance - """ - return SharedCostInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SharedCostInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, country_code): - """ - Initialize the SharedCostInstance - - :returns: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostInstance - """ - super(SharedCostInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'friendly_name': payload.get('friendly_name'), - 'phone_number': payload.get('phone_number'), - 'lata': payload.get('lata'), - 'locality': payload.get('locality'), - 'rate_center': payload.get('rate_center'), - 'latitude': deserialize.decimal(payload.get('latitude')), - 'longitude': deserialize.decimal(payload.get('longitude')), - 'region': payload.get('region'), - 'postal_code': payload.get('postal_code'), - 'iso_country': payload.get('iso_country'), - 'address_requirements': payload.get('address_requirements'), - 'beta': payload.get('beta'), - 'capabilities': payload.get('capabilities'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - - @property - def friendly_name(self): - """ - :returns: A formatted version of the phone number - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def phone_number(self): - """ - :returns: The phone number in E.164 format - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def lata(self): - """ - :returns: The LATA of this phone number - :rtype: unicode - """ - return self._properties['lata'] - - @property - def locality(self): - """ - :returns: The locality or city of this phone number's location - :rtype: unicode - """ - return self._properties['locality'] - - @property - def rate_center(self): - """ - :returns: The rate center of this phone number - :rtype: unicode - """ - return self._properties['rate_center'] - - @property - def latitude(self): - """ - :returns: The latitude of this phone number's location - :rtype: unicode - """ - return self._properties['latitude'] - - @property - def longitude(self): - """ - :returns: The longitude of this phone number's location - :rtype: unicode - """ - return self._properties['longitude'] - - @property - def region(self): - """ - :returns: The two-letter state or province abbreviation of this phone number's location - :rtype: unicode - """ - return self._properties['region'] - - @property - def postal_code(self): - """ - :returns: The postal or ZIP code of this phone number's location - :rtype: unicode - """ - return self._properties['postal_code'] - - @property - def iso_country(self): - """ - :returns: The ISO country code of this phone number - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def address_requirements(self): - """ - :returns: The type of Address resource the phone number requires - :rtype: unicode - """ - return self._properties['address_requirements'] - - @property - def beta(self): - """ - :returns: Whether the phone number is new to the Twilio platform - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: Whether a phone number can receive calls or messages - :rtype: unicode - """ - return self._properties['capabilities'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/available_phone_number/toll_free.py b/twilio/rest/api/v2010/account/available_phone_number/toll_free.py deleted file mode 100644 index cbdb45e6a6..0000000000 --- a/twilio/rest/api/v2010/account/available_phone_number/toll_free.py +++ /dev/null @@ -1,455 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class TollFreeList(ListResource): - - def __init__(self, version, account_sid, country_code): - """ - Initialize the TollFreeList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param country_code: The ISO-3166-1 country code of the country. - - :returns: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeList - :rtype: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeList - """ - super(TollFreeList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - self._uri = '/Accounts/{account_sid}/AvailablePhoneNumbers/{country_code}/TollFree.json'.format(**self._solution) - - def stream(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, - exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Streams TollFreeInstance 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 unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Lists TollFreeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeInstance] - """ - return list(self.stream( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - limit=limit, - page_size=page_size, - )) - - def page(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of TollFreeInstance records from the API. - Request is executed immediately - - :param unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of TollFreeInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreePage - """ - data = values.of({ - 'AreaCode': area_code, - 'Contains': contains, - 'SmsEnabled': sms_enabled, - 'MmsEnabled': mms_enabled, - 'VoiceEnabled': voice_enabled, - 'ExcludeAllAddressRequired': exclude_all_address_required, - 'ExcludeLocalAddressRequired': exclude_local_address_required, - 'ExcludeForeignAddressRequired': exclude_foreign_address_required, - 'Beta': beta, - 'NearNumber': near_number, - 'NearLatLong': near_lat_long, - 'Distance': distance, - 'InPostalCode': in_postal_code, - 'InRegion': in_region, - 'InRateCenter': in_rate_center, - 'InLata': in_lata, - 'InLocality': in_locality, - 'FaxEnabled': fax_enabled, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return TollFreePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TollFreeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TollFreeInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TollFreePage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TollFreePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the TollFreePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - :param country_code: The ISO-3166-1 country code of the country. - - :returns: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreePage - :rtype: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreePage - """ - super(TollFreePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TollFreeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeInstance - """ - return TollFreeInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TollFreeInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, country_code): - """ - Initialize the TollFreeInstance - - :returns: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.toll_free.TollFreeInstance - """ - super(TollFreeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'friendly_name': payload.get('friendly_name'), - 'phone_number': payload.get('phone_number'), - 'lata': payload.get('lata'), - 'locality': payload.get('locality'), - 'rate_center': payload.get('rate_center'), - 'latitude': deserialize.decimal(payload.get('latitude')), - 'longitude': deserialize.decimal(payload.get('longitude')), - 'region': payload.get('region'), - 'postal_code': payload.get('postal_code'), - 'iso_country': payload.get('iso_country'), - 'address_requirements': payload.get('address_requirements'), - 'beta': payload.get('beta'), - 'capabilities': payload.get('capabilities'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - - @property - def friendly_name(self): - """ - :returns: A formatted version of the phone number - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def phone_number(self): - """ - :returns: The phone number in E.164 format - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def lata(self): - """ - :returns: The LATA of this phone number - :rtype: unicode - """ - return self._properties['lata'] - - @property - def locality(self): - """ - :returns: The locality or city of this phone number's location - :rtype: unicode - """ - return self._properties['locality'] - - @property - def rate_center(self): - """ - :returns: The rate center of this phone number - :rtype: unicode - """ - return self._properties['rate_center'] - - @property - def latitude(self): - """ - :returns: The latitude of this phone number's location - :rtype: unicode - """ - return self._properties['latitude'] - - @property - def longitude(self): - """ - :returns: The longitude of this phone number's location - :rtype: unicode - """ - return self._properties['longitude'] - - @property - def region(self): - """ - :returns: The two-letter state or province abbreviation of this phone number's location - :rtype: unicode - """ - return self._properties['region'] - - @property - def postal_code(self): - """ - :returns: The postal or ZIP code of this phone number's location - :rtype: unicode - """ - return self._properties['postal_code'] - - @property - def iso_country(self): - """ - :returns: The ISO country code of this phone number - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def address_requirements(self): - """ - :returns: The type of Address resource the phone number requires - :rtype: unicode - """ - return self._properties['address_requirements'] - - @property - def beta(self): - """ - :returns: Whether the phone number is new to the Twilio platform - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: Whether a phone number can receive calls or messages - :rtype: unicode - """ - return self._properties['capabilities'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/available_phone_number/voip.py b/twilio/rest/api/v2010/account/available_phone_number/voip.py deleted file mode 100644 index bd28b4bf57..0000000000 --- a/twilio/rest/api/v2010/account/available_phone_number/voip.py +++ /dev/null @@ -1,455 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class VoipList(ListResource): - - def __init__(self, version, account_sid, country_code): - """ - Initialize the VoipList - - :param Version version: Version that contains the resource - :param account_sid: The account_sid - :param country_code: The ISO-3166-1 country code of the country. - - :returns: twilio.rest.api.v2010.account.available_phone_number.voip.VoipList - :rtype: twilio.rest.api.v2010.account.available_phone_number.voip.VoipList - """ - super(VoipList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - self._uri = '/Accounts/{account_sid}/AvailablePhoneNumbers/{country_code}/Voip.json'.format(**self._solution) - - def stream(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, - exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Streams VoipInstance 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 unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.voip.VoipInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, limit=None, page_size=None): - """ - Lists VoipInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.available_phone_number.voip.VoipInstance] - """ - return list(self.stream( - area_code=area_code, - contains=contains, - sms_enabled=sms_enabled, - mms_enabled=mms_enabled, - voice_enabled=voice_enabled, - exclude_all_address_required=exclude_all_address_required, - exclude_local_address_required=exclude_local_address_required, - exclude_foreign_address_required=exclude_foreign_address_required, - beta=beta, - near_number=near_number, - near_lat_long=near_lat_long, - distance=distance, - in_postal_code=in_postal_code, - in_region=in_region, - in_rate_center=in_rate_center, - in_lata=in_lata, - in_locality=in_locality, - fax_enabled=fax_enabled, - limit=limit, - page_size=page_size, - )) - - def page(self, area_code=values.unset, contains=values.unset, - sms_enabled=values.unset, mms_enabled=values.unset, - voice_enabled=values.unset, exclude_all_address_required=values.unset, - exclude_local_address_required=values.unset, - exclude_foreign_address_required=values.unset, beta=values.unset, - near_number=values.unset, near_lat_long=values.unset, - distance=values.unset, in_postal_code=values.unset, - in_region=values.unset, in_rate_center=values.unset, - in_lata=values.unset, in_locality=values.unset, - fax_enabled=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of VoipInstance records from the API. - Request is executed immediately - - :param unicode area_code: The area code of the phone numbers to read - :param unicode contains: The pattern on which to match phone numbers - :param bool sms_enabled: Whether the phone numbers can receive text messages - :param bool mms_enabled: Whether the phone numbers can receive MMS messages - :param bool voice_enabled: Whether the phone numbers can receive calls. - :param bool exclude_all_address_required: Whether to exclude phone numbers that require an Address - :param bool exclude_local_address_required: Whether to exclude phone numbers that require a local address - :param bool exclude_foreign_address_required: Whether to exclude phone numbers that require a foreign address - :param bool beta: Whether to read phone numbers new to the Twilio platform - :param unicode near_number: Given a phone number, find a geographically close number within distance miles. (US/Canada only) - :param unicode near_lat_long: Given a latitude/longitude pair lat,long find geographically close numbers within distance miles. (US/Canada only) - :param unicode distance: The search radius, in miles, for a near_ query. (US/Canada only) - :param unicode in_postal_code: Limit results to a particular postal code. (US/Canada only) - :param unicode in_region: Limit results to a particular region. (US/Canada only) - :param unicode in_rate_center: Limit results to a specific rate center, or given a phone number search within the same rate center as that number. (US/Canada only) - :param unicode in_lata: Limit results to a specific local access and transport area. (US/Canada only) - :param unicode in_locality: Limit results to a particular locality - :param bool fax_enabled: Whether the phone numbers can receive faxes - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of VoipInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.voip.VoipPage - """ - data = values.of({ - 'AreaCode': area_code, - 'Contains': contains, - 'SmsEnabled': sms_enabled, - 'MmsEnabled': mms_enabled, - 'VoiceEnabled': voice_enabled, - 'ExcludeAllAddressRequired': exclude_all_address_required, - 'ExcludeLocalAddressRequired': exclude_local_address_required, - 'ExcludeForeignAddressRequired': exclude_foreign_address_required, - 'Beta': beta, - 'NearNumber': near_number, - 'NearLatLong': near_lat_long, - 'Distance': distance, - 'InPostalCode': in_postal_code, - 'InRegion': in_region, - 'InRateCenter': in_rate_center, - 'InLata': in_lata, - 'InLocality': in_locality, - 'FaxEnabled': fax_enabled, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return VoipPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of VoipInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of VoipInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.voip.VoipPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return VoipPage(self._version, response, self._solution) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class VoipPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the VoipPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The account_sid - :param country_code: The ISO-3166-1 country code of the country. - - :returns: twilio.rest.api.v2010.account.available_phone_number.voip.VoipPage - :rtype: twilio.rest.api.v2010.account.available_phone_number.voip.VoipPage - """ - super(VoipPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of VoipInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.available_phone_number.voip.VoipInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.voip.VoipInstance - """ - return VoipInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - country_code=self._solution['country_code'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class VoipInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, country_code): - """ - Initialize the VoipInstance - - :returns: twilio.rest.api.v2010.account.available_phone_number.voip.VoipInstance - :rtype: twilio.rest.api.v2010.account.available_phone_number.voip.VoipInstance - """ - super(VoipInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'friendly_name': payload.get('friendly_name'), - 'phone_number': payload.get('phone_number'), - 'lata': payload.get('lata'), - 'locality': payload.get('locality'), - 'rate_center': payload.get('rate_center'), - 'latitude': deserialize.decimal(payload.get('latitude')), - 'longitude': deserialize.decimal(payload.get('longitude')), - 'region': payload.get('region'), - 'postal_code': payload.get('postal_code'), - 'iso_country': payload.get('iso_country'), - 'address_requirements': payload.get('address_requirements'), - 'beta': payload.get('beta'), - 'capabilities': payload.get('capabilities'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'country_code': country_code, } - - @property - def friendly_name(self): - """ - :returns: A formatted version of the phone number - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def phone_number(self): - """ - :returns: The phone number in E.164 format - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def lata(self): - """ - :returns: The LATA of this phone number - :rtype: unicode - """ - return self._properties['lata'] - - @property - def locality(self): - """ - :returns: The locality or city of this phone number's location - :rtype: unicode - """ - return self._properties['locality'] - - @property - def rate_center(self): - """ - :returns: The rate center of this phone number - :rtype: unicode - """ - return self._properties['rate_center'] - - @property - def latitude(self): - """ - :returns: The latitude of this phone number's location - :rtype: unicode - """ - return self._properties['latitude'] - - @property - def longitude(self): - """ - :returns: The longitude of this phone number's location - :rtype: unicode - """ - return self._properties['longitude'] - - @property - def region(self): - """ - :returns: The two-letter state or province abbreviation of this phone number's location - :rtype: unicode - """ - return self._properties['region'] - - @property - def postal_code(self): - """ - :returns: The postal or ZIP code of this phone number's location - :rtype: unicode - """ - return self._properties['postal_code'] - - @property - def iso_country(self): - """ - :returns: The ISO country code of this phone number - :rtype: unicode - """ - return self._properties['iso_country'] - - @property - def address_requirements(self): - """ - :returns: The type of Address resource the phone number requires - :rtype: unicode - """ - return self._properties['address_requirements'] - - @property - def beta(self): - """ - :returns: Whether the phone number is new to the Twilio platform - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: Whether a phone number can receive calls or messages - :rtype: unicode - """ - return self._properties['capabilities'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/available_phone_number_country.py b/twilio/rest/api/v2010/account/available_phone_number_country/__init__.py similarity index 100% rename from twilio/rest/api/v2010/account/available_phone_number_country.py rename to twilio/rest/api/v2010/account/available_phone_number_country/__init__.py diff --git a/twilio/rest/api/v2010/account/call.py b/twilio/rest/api/v2010/account/call.py deleted file mode 100644 index 22d5d98db7..0000000000 --- a/twilio/rest/api/v2010/account/call.py +++ /dev/null @@ -1,228 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Api - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.call.event import EventListInstancefrom twilio.rest.call.feedback import FeedbackListInstancefrom twilio.rest.call.feedback_summary import FeedbackSummaryListInstancefrom twilio.rest.call.notification import NotificationListInstancefrom twilio.rest.call.payment import PaymentListInstancefrom twilio.rest.call.recording import RecordingListInstancefrom twilio.rest.call.siprec import SiprecListInstancefrom twilio.rest.call.stream import StreamListInstancefrom twilio.rest.call.user_defined_message import UserDefinedMessageListInstancefrom twilio.rest.call.user_defined_message_subscription import UserDefinedMessageSubscriptionListInstance - - -class CallContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/${account_sid}/Calls/${sid}.json' - - self._events = None - self._feedback = None - self._notifications = None - self._payments = None - self._recordings = None - self._siprec = None - self._streams = None - self._user_defined_messages = None - self._user_defined_message_subscriptions = None - - def delete(self): - - - - """ - Deletes the CallInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the CallInstance - - :returns: The fetched CallInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CallInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return CallInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class CallInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'parent_call_sid' : payload.get('parent_call_sid'), - 'account_sid' : payload.get('account_sid'), - 'to' : payload.get('to'), - 'to_formatted' : payload.get('to_formatted'), - '_from' : payload.get('from'), - 'from_formatted' : payload.get('from_formatted'), - 'phone_number_sid' : payload.get('phone_number_sid'), - 'status' : payload.get('status'), - 'start_time' : payload.get('start_time'), - 'end_time' : payload.get('end_time'), - 'duration' : payload.get('duration'), - 'price' : payload.get('price'), - 'price_unit' : payload.get('price_unit'), - 'direction' : payload.get('direction'), - 'answered_by' : payload.get('answered_by'), - 'api_version' : payload.get('api_version'), - 'forwarded_from' : payload.get('forwarded_from'), - 'group_sid' : payload.get('group_sid'), - 'caller_name' : payload.get('caller_name'), - 'queue_time' : payload.get('queue_time'), - 'trunk_sid' : payload.get('trunk_sid'), - 'uri' : payload.get('uri'), - 'subresource_uris' : payload.get('subresource_uris'), - } - - self._context = None - self._solution = { - 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = CallContext( - self._version, - account_sid=self._solution['account_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def events(self): - return self._proxy.events - @property - def feedback(self): - return self._proxy.feedback - @property - def notifications(self): - return self._proxy.notifications - @property - def payments(self): - return self._proxy.payments - @property - def recordings(self): - return self._proxy.recordings - @property - def siprec(self): - return self._proxy.siprec - @property - def streams(self): - return self._proxy.streams - @property - def user_defined_messages(self): - return self._proxy.user_defined_messages - @property - def user_defined_message_subscriptions(self): - return self._proxy.user_defined_message_subscriptions - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class CallListInstance(ListResource): - def __init__(self, version: Version, account_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, } - self._uri = '/Accounts/${account_sid}/Calls.json' - - self._feedback_summaries = None - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return CallInstance(self._version, payload, account_sid=self._solution['account_sid']) - - """ - - """ - def page(self, to, _from, parent_call_sid, status, start_time, start_time, start_time, end_time, end_time, end_time, page_size): - - data = values.of({ - 'to': to,'_from': _from,'parent_call_sid': parent_call_sid,'status': status,'start_time': start_time,'start_time': start_time,'start_time': start_time,'end_time': end_time,'end_time': end_time,'end_time': end_time,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return CallPage(self._version, payload, account_sid=self._solution['account_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/api/v2010/account/call/__init__.py b/twilio/rest/api/v2010/account/call/__init__.py index fbffa71d8b..22d5d98db7 100644 --- a/twilio/rest/api/v2010/account/call/__init__.py +++ b/twilio/rest/api/v2010/account/call/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,423 +19,36 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.call.event import EventList -from twilio.rest.api.v2010.account.call.feedback import FeedbackList -from twilio.rest.api.v2010.account.call.feedback_summary import FeedbackSummaryList -from twilio.rest.api.v2010.account.call.notification import NotificationList -from twilio.rest.api.v2010.account.call.payment import PaymentList -from twilio.rest.api.v2010.account.call.recording import RecordingList -from twilio.rest.api.v2010.account.call.siprec import SiprecList -from twilio.rest.api.v2010.account.call.stream import StreamList -from twilio.rest.api.v2010.account.call.user_defined_message import UserDefinedMessageList -from twilio.rest.api.v2010.account.call.user_defined_message_subscription import UserDefinedMessageSubscriptionList - - -class CallList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the CallList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created this resource - - :returns: twilio.rest.api.v2010.account.call.CallList - :rtype: twilio.rest.api.v2010.account.call.CallList - """ - super(CallList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Calls.json'.format(**self._solution) - - # Components - self._feedback_summaries = None - - def create(self, to, from_, method=values.unset, fallback_url=values.unset, - fallback_method=values.unset, status_callback=values.unset, - status_callback_event=values.unset, - status_callback_method=values.unset, send_digits=values.unset, - timeout=values.unset, record=values.unset, - recording_channels=values.unset, - recording_status_callback=values.unset, - recording_status_callback_method=values.unset, - sip_auth_username=values.unset, sip_auth_password=values.unset, - machine_detection=values.unset, - machine_detection_timeout=values.unset, - recording_status_callback_event=values.unset, trim=values.unset, - caller_id=values.unset, - machine_detection_speech_threshold=values.unset, - machine_detection_speech_end_threshold=values.unset, - machine_detection_silence_timeout=values.unset, - async_amd=values.unset, async_amd_status_callback=values.unset, - async_amd_status_callback_method=values.unset, byoc=values.unset, - call_reason=values.unset, call_token=values.unset, - recording_track=values.unset, time_limit=values.unset, - url=values.unset, twiml=values.unset, application_sid=values.unset): - """ - Create the CallInstance - - :param unicode to: Phone number, SIP address, or client identifier to call - :param unicode from_: Twilio number from which to originate the call - :param unicode method: HTTP method to use to fetch TwiML - :param unicode fallback_url: Fallback URL in case of error - :param unicode fallback_method: HTTP Method to use with fallback_url - :param unicode status_callback: The URL we should call to send status information to your application - :param list[unicode] status_callback_event: The call progress events that we send to the `status_callback` URL. - :param unicode status_callback_method: HTTP Method to use with status_callback - :param unicode send_digits: The digits to dial after connecting to the number - :param unicode timeout: Number of seconds to wait for an answer - :param bool record: Whether to record the call - :param unicode recording_channels: The number of channels in the final recording - :param unicode recording_status_callback: The URL that we call when the recording is available to be accessed - :param unicode recording_status_callback_method: The HTTP method we should use when calling the `recording_status_callback` URL - :param unicode sip_auth_username: The username used to authenticate the caller making a SIP call - :param unicode sip_auth_password: The password required to authenticate the user account specified in `sip_auth_username`. - :param unicode machine_detection: Enable machine detection or end of greeting detection - :param unicode machine_detection_timeout: Number of seconds to wait for machine detection - :param list[unicode] recording_status_callback_event: The recording status events that will trigger calls to the URL specified in `recording_status_callback` - :param unicode trim: Set this parameter to control trimming of silence on the recording. - :param unicode caller_id: The phone number, SIP address, or Client identifier that made this call. Phone numbers are in E.164 format (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. - :param unicode machine_detection_speech_threshold: Number of milliseconds for measuring stick for the length of the speech activity - :param unicode machine_detection_speech_end_threshold: Number of milliseconds of silence after speech activity - :param unicode machine_detection_silence_timeout: Number of milliseconds of initial silence - :param unicode async_amd: Enable asynchronous AMD - :param unicode async_amd_status_callback: The URL we should call to send amd status information to your application - :param unicode async_amd_status_callback_method: HTTP Method to use with async_amd_status_callback - :param unicode byoc: BYOC trunk SID (Beta) - :param unicode call_reason: Reason for the call (Branded Calls Beta) - :param unicode call_token: A token string needed to invoke a forwarded call with a CallerId recieved on a previous incoming call - :param unicode recording_track: Which track(s) to record - :param unicode time_limit: The maximum duration of the call in seconds. - :param unicode url: The absolute URL that returns TwiML for this call - :param unicode twiml: TwiML instructions for the call - :param unicode application_sid: The SID of the Application resource that will handle the call - - :returns: The created CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallInstance - """ - data = values.of({ - 'To': to, - 'From': from_, - 'Url': url, - 'Twiml': twiml, - 'ApplicationSid': application_sid, - 'Method': method, - 'FallbackUrl': fallback_url, - 'FallbackMethod': fallback_method, - 'StatusCallback': status_callback, - 'StatusCallbackEvent': serialize.map(status_callback_event, lambda e: e), - 'StatusCallbackMethod': status_callback_method, - 'SendDigits': send_digits, - 'Timeout': timeout, - 'Record': record, - 'RecordingChannels': recording_channels, - 'RecordingStatusCallback': recording_status_callback, - 'RecordingStatusCallbackMethod': recording_status_callback_method, - 'SipAuthUsername': sip_auth_username, - 'SipAuthPassword': sip_auth_password, - 'MachineDetection': machine_detection, - 'MachineDetectionTimeout': machine_detection_timeout, - 'RecordingStatusCallbackEvent': serialize.map(recording_status_callback_event, lambda e: e), - 'Trim': trim, - 'CallerId': caller_id, - 'MachineDetectionSpeechThreshold': machine_detection_speech_threshold, - 'MachineDetectionSpeechEndThreshold': machine_detection_speech_end_threshold, - 'MachineDetectionSilenceTimeout': machine_detection_silence_timeout, - 'AsyncAmd': async_amd, - 'AsyncAmdStatusCallback': async_amd_status_callback, - 'AsyncAmdStatusCallbackMethod': async_amd_status_callback_method, - 'Byoc': byoc, - 'CallReason': call_reason, - 'CallToken': call_token, - 'RecordingTrack': recording_track, - 'TimeLimit': time_limit, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return CallInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def stream(self, to=values.unset, from_=values.unset, - parent_call_sid=values.unset, status=values.unset, - start_time_before=values.unset, start_time=values.unset, - start_time_after=values.unset, end_time_before=values.unset, - end_time=values.unset, end_time_after=values.unset, limit=None, - page_size=None): - """ - Streams CallInstance 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 unicode to: Phone number or Client identifier of calls to include - :param unicode from_: Phone number or Client identifier to filter `from` on - :param unicode parent_call_sid: Parent call SID to filter on - :param CallInstance.Status status: The status of the resources to read - :param datetime start_time_before: Only include calls that started on this date - :param datetime start_time: Only include calls that started on this date - :param datetime start_time_after: Only include calls that started on this date - :param datetime end_time_before: Only include calls that ended on this date - :param datetime end_time: Only include calls that ended on this date - :param datetime end_time_after: Only include calls that ended on this date - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.call.CallInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - to=to, - from_=from_, - parent_call_sid=parent_call_sid, - status=status, - start_time_before=start_time_before, - start_time=start_time, - start_time_after=start_time_after, - end_time_before=end_time_before, - end_time=end_time, - end_time_after=end_time_after, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, to=values.unset, from_=values.unset, - parent_call_sid=values.unset, status=values.unset, - start_time_before=values.unset, start_time=values.unset, - start_time_after=values.unset, end_time_before=values.unset, - end_time=values.unset, end_time_after=values.unset, limit=None, - page_size=None): - """ - Lists CallInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode to: Phone number or Client identifier of calls to include - :param unicode from_: Phone number or Client identifier to filter `from` on - :param unicode parent_call_sid: Parent call SID to filter on - :param CallInstance.Status status: The status of the resources to read - :param datetime start_time_before: Only include calls that started on this date - :param datetime start_time: Only include calls that started on this date - :param datetime start_time_after: Only include calls that started on this date - :param datetime end_time_before: Only include calls that ended on this date - :param datetime end_time: Only include calls that ended on this date - :param datetime end_time_after: Only include calls that ended on this date - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.call.CallInstance] - """ - return list(self.stream( - to=to, - from_=from_, - parent_call_sid=parent_call_sid, - status=status, - start_time_before=start_time_before, - start_time=start_time, - start_time_after=start_time_after, - end_time_before=end_time_before, - end_time=end_time, - end_time_after=end_time_after, - limit=limit, - page_size=page_size, - )) - - def page(self, to=values.unset, from_=values.unset, - parent_call_sid=values.unset, status=values.unset, - start_time_before=values.unset, start_time=values.unset, - start_time_after=values.unset, end_time_before=values.unset, - end_time=values.unset, end_time_after=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CallInstance records from the API. - Request is executed immediately - - :param unicode to: Phone number or Client identifier of calls to include - :param unicode from_: Phone number or Client identifier to filter `from` on - :param unicode parent_call_sid: Parent call SID to filter on - :param CallInstance.Status status: The status of the resources to read - :param datetime start_time_before: Only include calls that started on this date - :param datetime start_time: Only include calls that started on this date - :param datetime start_time_after: Only include calls that started on this date - :param datetime end_time_before: Only include calls that ended on this date - :param datetime end_time: Only include calls that ended on this date - :param datetime end_time_after: Only include calls that ended on this date - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallPage - """ - data = values.of({ - 'To': to, - 'From': from_, - 'ParentCallSid': parent_call_sid, - 'Status': status, - 'StartTime<': serialize.iso8601_datetime(start_time_before), - 'StartTime': serialize.iso8601_datetime(start_time), - 'StartTime>': serialize.iso8601_datetime(start_time_after), - 'EndTime<': serialize.iso8601_datetime(end_time_before), - 'EndTime': serialize.iso8601_datetime(end_time), - 'EndTime>': serialize.iso8601_datetime(end_time_after), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CallPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CallInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) +from twilio.base.version import Version - return CallPage(self._version, response, self._solution) - - @property - def feedback_summaries(self): - """ - Access the feedback_summaries - - :returns: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryList - :rtype: twilio.rest.api.v2010.account.call.feedback_summary.FeedbackSummaryList - """ - if self._feedback_summaries is None: - self._feedback_summaries = FeedbackSummaryList( - self._version, - account_sid=self._solution['account_sid'], - ) - return self._feedback_summaries - - def get(self, sid): - """ - Constructs a CallContext - - :param sid: The SID of the Call resource to fetch - - :returns: twilio.rest.api.v2010.account.call.CallContext - :rtype: twilio.rest.api.v2010.account.call.CallContext - """ - return CallContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CallContext - - :param sid: The SID of the Call resource to fetch - - :returns: twilio.rest.api.v2010.account.call.CallContext - :rtype: twilio.rest.api.v2010.account.call.CallContext - """ - return CallContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CallPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CallPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created this resource - - :returns: twilio.rest.api.v2010.account.call.CallPage - :rtype: twilio.rest.api.v2010.account.call.CallPage - """ - super(CallPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CallInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.call.CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallInstance - """ - return CallInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.call.event import EventListInstancefrom twilio.rest.call.feedback import FeedbackListInstancefrom twilio.rest.call.feedback_summary import FeedbackSummaryListInstancefrom twilio.rest.call.notification import NotificationListInstancefrom twilio.rest.call.payment import PaymentListInstancefrom twilio.rest.call.recording import RecordingListInstancefrom twilio.rest.call.siprec import SiprecListInstancefrom twilio.rest.call.stream import StreamListInstancefrom twilio.rest.call.user_defined_message import UserDefinedMessageListInstancefrom twilio.rest.call.user_defined_message_subscription import UserDefinedMessageSubscriptionListInstance class CallContext(InstanceContext): - - def __init__(self, version, account_sid, sid): - """ - Initialize the CallContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource(s) to fetch - :param sid: The SID of the Call resource to fetch - - :returns: twilio.rest.api.v2010.account.call.CallContext - :rtype: twilio.rest.api.v2010.account.call.CallContext - """ - super(CallContext, self).__init__(version) + def __init__(self, version: Version, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Calls/{sid}.json'.format(**self._solution) - - # Dependents - self._recordings = None - self._notifications = None - self._feedback = None + self._solution = { 'account_sid': account_sid, 'sid': sid, } + self._uri = '/Accounts/${account_sid}/Calls/${sid}.json' + self._events = None + self._feedback = None + self._notifications = None self._payments = None + self._recordings = None self._siprec = None self._streams = None - self._user_defined_message_subscriptions = None self._user_defined_messages = None - + self._user_defined_message_subscriptions = None + def delete(self): + + + """ Deletes the CallInstance @@ -436,655 +56,173 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - + def fetch(self): + """ Fetch the CallInstance :returns: The fetched CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return CallInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, url=values.unset, method=values.unset, status=values.unset, - fallback_url=values.unset, fallback_method=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - twiml=values.unset, time_limit=values.unset): - """ - Update the CallInstance - - :param unicode url: The absolute URL that returns TwiML for this call - :param unicode method: HTTP method to use to fetch TwiML - :param CallInstance.UpdateStatus status: The new status to update the call with. - :param unicode fallback_url: Fallback URL in case of error - :param unicode fallback_method: HTTP Method to use with fallback_url - :param unicode status_callback: The URL we should call to send status information to your application - :param unicode status_callback_method: HTTP Method to use to call status_callback - :param unicode twiml: TwiML instructions for the call - :param unicode time_limit: The maximum duration of the call in seconds. + return CallInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + - :returns: The updated CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallInstance - """ + + + def update(self, body): data = values.of({ - 'Url': url, - 'Method': method, - 'Status': status, - 'FallbackUrl': fallback_url, - 'FallbackMethod': fallback_method, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'Twiml': twiml, - 'TimeLimit': time_limit, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return CallInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) + return CallInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + - @property - def recordings(self): - """ - Access the recordings - - :returns: twilio.rest.api.v2010.account.call.recording.RecordingList - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingList - """ - if self._recordings is None: - self._recordings = RecordingList( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['sid'], - ) - return self._recordings - - @property - def notifications(self): - """ - Access the notifications - - :returns: twilio.rest.api.v2010.account.call.notification.NotificationList - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationList - """ - if self._notifications is None: - self._notifications = NotificationList( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['sid'], - ) - return self._notifications - - @property - def feedback(self): - """ - Access the feedback - - :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackList - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackList - """ - if self._feedback is None: - self._feedback = FeedbackList( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['sid'], - ) - return self._feedback - - @property - def events(self): - """ - Access the events - - :returns: twilio.rest.api.v2010.account.call.event.EventList - :rtype: twilio.rest.api.v2010.account.call.event.EventList - """ - if self._events is None: - self._events = EventList( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['sid'], - ) - return self._events - - @property - def payments(self): - """ - Access the payments - - :returns: twilio.rest.api.v2010.account.call.payment.PaymentList - :rtype: twilio.rest.api.v2010.account.call.payment.PaymentList - """ - if self._payments is None: - self._payments = PaymentList( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['sid'], - ) - return self._payments - - @property - def siprec(self): - """ - Access the siprec - - :returns: twilio.rest.api.v2010.account.call.siprec.SiprecList - :rtype: twilio.rest.api.v2010.account.call.siprec.SiprecList - """ - if self._siprec is None: - self._siprec = SiprecList( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['sid'], - ) - return self._siprec - - @property - def streams(self): - """ - Access the streams - - :returns: twilio.rest.api.v2010.account.call.stream.StreamList - :rtype: twilio.rest.api.v2010.account.call.stream.StreamList - """ - if self._streams is None: - self._streams = StreamList( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['sid'], - ) - return self._streams - - @property - def user_defined_message_subscriptions(self): - """ - Access the user_defined_message_subscriptions - - :returns: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionList - :rtype: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionList - """ - if self._user_defined_message_subscriptions is None: - self._user_defined_message_subscriptions = UserDefinedMessageSubscriptionList( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['sid'], - ) - return self._user_defined_message_subscriptions - - @property - def user_defined_messages(self): - """ - Access the user_defined_messages - - :returns: twilio.rest.api.v2010.account.call.user_defined_message.UserDefinedMessageList - :rtype: twilio.rest.api.v2010.account.call.user_defined_message.UserDefinedMessageList - """ - if self._user_defined_messages is None: - self._user_defined_messages = UserDefinedMessageList( - self._version, - account_sid=self._solution['account_sid'], - call_sid=self._solution['sid'], - ) - return self._user_defined_messages + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class CallInstance(InstanceResource): - - class Event(object): - INITIATED = "initiated" - RINGING = "ringing" - ANSWERED = "answered" - COMPLETED = "completed" + return '' - class Status(object): - QUEUED = "queued" - RINGING = "ringing" - IN_PROGRESS = "in-progress" - COMPLETED = "completed" - BUSY = "busy" - FAILED = "failed" - NO_ANSWER = "no-answer" - CANCELED = "canceled" - class UpdateStatus(object): - CANCELED = "canceled" - COMPLETED = "completed" - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the CallInstance - - :returns: twilio.rest.api.v2010.account.call.CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallInstance - """ - super(CallInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'parent_call_sid': payload.get('parent_call_sid'), - 'account_sid': payload.get('account_sid'), - 'to': payload.get('to'), - 'to_formatted': payload.get('to_formatted'), - 'from_': payload.get('from'), - 'from_formatted': payload.get('from_formatted'), - 'phone_number_sid': payload.get('phone_number_sid'), - 'status': payload.get('status'), - 'start_time': deserialize.rfc2822_datetime(payload.get('start_time')), - 'end_time': deserialize.rfc2822_datetime(payload.get('end_time')), - 'duration': payload.get('duration'), - 'price': payload.get('price'), - 'price_unit': payload.get('price_unit'), - 'direction': payload.get('direction'), - 'answered_by': payload.get('answered_by'), - 'api_version': payload.get('api_version'), - 'forwarded_from': payload.get('forwarded_from'), - 'group_sid': payload.get('group_sid'), - 'caller_name': payload.get('caller_name'), - 'queue_time': payload.get('queue_time'), - 'trunk_sid': payload.get('trunk_sid'), - 'uri': payload.get('uri'), - 'subresource_uris': payload.get('subresource_uris'), +class CallInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'parent_call_sid' : payload.get('parent_call_sid'), + 'account_sid' : payload.get('account_sid'), + 'to' : payload.get('to'), + 'to_formatted' : payload.get('to_formatted'), + '_from' : payload.get('from'), + 'from_formatted' : payload.get('from_formatted'), + 'phone_number_sid' : payload.get('phone_number_sid'), + 'status' : payload.get('status'), + 'start_time' : payload.get('start_time'), + 'end_time' : payload.get('end_time'), + 'duration' : payload.get('duration'), + 'price' : payload.get('price'), + 'price_unit' : payload.get('price_unit'), + 'direction' : payload.get('direction'), + 'answered_by' : payload.get('answered_by'), + 'api_version' : payload.get('api_version'), + 'forwarded_from' : payload.get('forwarded_from'), + 'group_sid' : payload.get('group_sid'), + 'caller_name' : payload.get('caller_name'), + 'queue_time' : payload.get('queue_time'), + 'trunk_sid' : payload.get('trunk_sid'), + 'uri' : payload.get('uri'), + 'subresource_uris' : payload.get('subresource_uris'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CallContext for this CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallContext - """ if self._context is None: self._context = CallContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies this resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def parent_call_sid(self): - """ - :returns: The SID that identifies the call that created this leg. - :rtype: unicode - """ - return self._properties['parent_call_sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created this resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def to(self): - """ - :returns: The phone number, SIP address or Client identifier that received this call. Phone numbers are in E.164 format (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. - :rtype: unicode - """ - return self._properties['to'] - - @property - def to_formatted(self): - """ - :returns: The phone number, SIP address or Client identifier that received this call. Formatted for display. - :rtype: unicode - """ - return self._properties['to_formatted'] - - @property - def from_(self): - """ - :returns: The phone number, SIP address or Client identifier that made this call. Phone numbers are in E.164 format (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. - :rtype: unicode - """ - return self._properties['from_'] - - @property - def from_formatted(self): - """ - :returns: The calling phone number, SIP address, or Client identifier formatted for display. - :rtype: unicode - """ - return self._properties['from_formatted'] - - @property - def phone_number_sid(self): - """ - :returns: If the call was inbound, this is the SID of the IncomingPhoneNumber resource that received the call. If the call was outbound, it is the SID of the OutgoingCallerId resource from which the call was placed. - :rtype: unicode - """ - return self._properties['phone_number_sid'] - - @property - def status(self): - """ - :returns: The status of this call. - :rtype: CallInstance.Status - """ - return self._properties['status'] - - @property - def start_time(self): - """ - :returns: The start time of the call. Null if the call has not yet been dialed. - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def end_time(self): - """ - :returns: The end time of the call. Null if the call did not complete successfully. - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def duration(self): - """ - :returns: The length of the call in seconds. - :rtype: unicode - """ - return self._properties['duration'] - - @property - def price(self): - """ - :returns: The charge for this call, in the currency associated with the account. Populated after the call is completed. May not be immediately available. - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The currency in which `Price` is measured. - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def direction(self): - """ - :returns: A string describing the direction of the call. `inbound` for inbound calls, `outbound-api` for calls initiated via the REST API or `outbound-dial` for calls initiated by a `Dial` verb. - :rtype: unicode - """ - return self._properties['direction'] - - @property - def answered_by(self): - """ - :returns: Either `human` or `machine` if this call was initiated with answering machine detection. Empty otherwise. - :rtype: unicode - """ - return self._properties['answered_by'] - - @property - def api_version(self): - """ - :returns: The API Version used to create the call - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def forwarded_from(self): - """ - :returns: The forwarding phone number if this call was an incoming call forwarded from another number (depends on carrier supporting forwarding). Otherwise, empty. - :rtype: unicode - """ - return self._properties['forwarded_from'] - - @property - def group_sid(self): - """ - :returns: The Group SID associated with this call. If no Group is associated with the call, the field is empty. - :rtype: unicode - """ - return self._properties['group_sid'] - - @property - def caller_name(self): - """ - :returns: The caller's name if this call was an incoming call to a phone number with caller ID Lookup enabled. Otherwise, empty. - :rtype: unicode - """ - return self._properties['caller_name'] - - @property - def queue_time(self): - """ - :returns: The wait time in milliseconds before the call is placed. - :rtype: unicode - """ - return self._properties['queue_time'] - + def events(self): + return self._proxy.events @property - def trunk_sid(self): - """ - :returns: The (optional) unique identifier of the trunk resource that was used for this call. - :rtype: unicode - """ - return self._properties['trunk_sid'] - + def feedback(self): + return self._proxy.feedback @property - def uri(self): - """ - :returns: The URI of this resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - + def notifications(self): + return self._proxy.notifications @property - def subresource_uris(self): - """ - :returns: A list of related subresources identified by their relative URIs - :rtype: unicode - """ - return self._properties['subresource_uris'] - - def delete(self): - """ - Deletes the CallInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch the CallInstance - - :returns: The fetched CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallInstance - """ - return self._proxy.fetch() - - def update(self, url=values.unset, method=values.unset, status=values.unset, - fallback_url=values.unset, fallback_method=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - twiml=values.unset, time_limit=values.unset): - """ - Update the CallInstance - - :param unicode url: The absolute URL that returns TwiML for this call - :param unicode method: HTTP method to use to fetch TwiML - :param CallInstance.UpdateStatus status: The new status to update the call with. - :param unicode fallback_url: Fallback URL in case of error - :param unicode fallback_method: HTTP Method to use with fallback_url - :param unicode status_callback: The URL we should call to send status information to your application - :param unicode status_callback_method: HTTP Method to use to call status_callback - :param unicode twiml: TwiML instructions for the call - :param unicode time_limit: The maximum duration of the call in seconds. - - :returns: The updated CallInstance - :rtype: twilio.rest.api.v2010.account.call.CallInstance - """ - return self._proxy.update( - url=url, - method=method, - status=status, - fallback_url=fallback_url, - fallback_method=fallback_method, - status_callback=status_callback, - status_callback_method=status_callback_method, - twiml=twiml, - time_limit=time_limit, - ) - + def payments(self): + return self._proxy.payments @property def recordings(self): - """ - Access the recordings - - :returns: twilio.rest.api.v2010.account.call.recording.RecordingList - :rtype: twilio.rest.api.v2010.account.call.recording.RecordingList - """ return self._proxy.recordings - @property - def notifications(self): - """ - Access the notifications - - :returns: twilio.rest.api.v2010.account.call.notification.NotificationList - :rtype: twilio.rest.api.v2010.account.call.notification.NotificationList - """ - return self._proxy.notifications - + def siprec(self): + return self._proxy.siprec @property - def feedback(self): - """ - Access the feedback - - :returns: twilio.rest.api.v2010.account.call.feedback.FeedbackList - :rtype: twilio.rest.api.v2010.account.call.feedback.FeedbackList - """ - return self._proxy.feedback - + def streams(self): + return self._proxy.streams @property - def events(self): - """ - Access the events - - :returns: twilio.rest.api.v2010.account.call.event.EventList - :rtype: twilio.rest.api.v2010.account.call.event.EventList - """ - return self._proxy.events - + def user_defined_messages(self): + return self._proxy.user_defined_messages @property - def payments(self): - """ - Access the payments + def user_defined_message_subscriptions(self): + return self._proxy.user_defined_message_subscriptions + - :returns: twilio.rest.api.v2010.account.call.payment.PaymentList - :rtype: twilio.rest.api.v2010.account.call.payment.PaymentList + def __repr__(self): """ - return self._proxy.payments - - @property - def siprec(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Access the siprec + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: twilio.rest.api.v2010.account.call.siprec.SiprecList - :rtype: twilio.rest.api.v2010.account.call.siprec.SiprecList - """ - return self._proxy.siprec - @property - def streams(self): - """ - Access the streams - :returns: twilio.rest.api.v2010.account.call.stream.StreamList - :rtype: twilio.rest.api.v2010.account.call.stream.StreamList - """ - return self._proxy.streams +class CallListInstance(ListResource): + def __init__(self, version: Version, account_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - @property - def user_defined_message_subscriptions(self): - """ - Access the user_defined_message_subscriptions + # Path Solution + self._solution = { 'account_sid': account_sid, } + self._uri = '/Accounts/${account_sid}/Calls.json' + + self._feedback_summaries = None + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - :returns: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionList - :rtype: twilio.rest.api.v2010.account.call.user_defined_message_subscription.UserDefinedMessageSubscriptionList - """ - return self._proxy.user_defined_message_subscriptions + payload = self._version.create(method='post', uri=self._uri, data=data, ) - @property - def user_defined_messages(self): - """ - Access the user_defined_messages + return CallInstance(self._version, payload, account_sid=self._solution['account_sid']) + + """ + + """ + def page(self, to, _from, parent_call_sid, status, start_time, start_time, start_time, end_time, end_time, end_time, page_size): + + data = values.of({ + 'to': to,'_from': _from,'parent_call_sid': parent_call_sid,'status': status,'start_time': start_time,'start_time': start_time,'start_time': start_time,'end_time': end_time,'end_time': end_time,'end_time': end_time,'page_size': page_size, + }) - :returns: twilio.rest.api.v2010.account.call.user_defined_message.UserDefinedMessageList - :rtype: twilio.rest.api.v2010.account.call.user_defined_message.UserDefinedMessageList - """ - return self._proxy.user_defined_messages + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CallPage(self._version, payload, account_sid=self._solution['account_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/conference.py b/twilio/rest/api/v2010/account/conference.py deleted file mode 100644 index 2b70885adc..0000000000 --- a/twilio/rest/api/v2010/account/conference.py +++ /dev/null @@ -1,161 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Api - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.conference.participant import ParticipantListInstancefrom twilio.rest.conference.recording import RecordingListInstance - - -class ConferenceContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/${account_sid}/Conferences/${sid}.json' - - self._participants = None - self._recordings = None - - def fetch(self): - - """ - Fetch the ConferenceInstance - - :returns: The fetched ConferenceInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ConferenceInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ConferenceInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ConferenceInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'api_version' : payload.get('api_version'), - 'friendly_name' : payload.get('friendly_name'), - 'region' : payload.get('region'), - 'sid' : payload.get('sid'), - 'status' : payload.get('status'), - 'uri' : payload.get('uri'), - 'subresource_uris' : payload.get('subresource_uris'), - 'reason_conference_ended' : payload.get('reason_conference_ended'), - 'call_sid_ending_conference' : payload.get('call_sid_ending_conference'), - } - - self._context = None - self._solution = { - 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ConferenceContext( - self._version, - account_sid=self._solution['account_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def participants(self): - return self._proxy.participants - @property - def recordings(self): - return self._proxy.recordings - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ConferenceListInstance(ListResource): - def __init__(self, version: Version, account_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, } - self._uri = '/Accounts/${account_sid}/Conferences.json' - - - """ - def page(self, date_created, date_created, date_created, date_updated, date_updated, date_updated, friendly_name, status, page_size): - - data = values.of({ - 'date_created': date_created,'date_created': date_created,'date_created': date_created,'date_updated': date_updated,'date_updated': date_updated,'date_updated': date_updated,'friendly_name': friendly_name,'status': status,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ConferencePage(self._version, payload, account_sid=self._solution['account_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/api/v2010/account/conference/__init__.py b/twilio/rest/api/v2010/account/conference/__init__.py index ee9a856385..2b70885adc 100644 --- a/twilio/rest/api/v2010/account/conference/__init__.py +++ b/twilio/rest/api/v2010/account/conference/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,559 +19,143 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.conference.participant import ParticipantList -from twilio.rest.api.v2010.account.conference.recording import RecordingList - - -class ConferenceList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the ConferenceList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created this resource - - :returns: twilio.rest.api.v2010.account.conference.ConferenceList - :rtype: twilio.rest.api.v2010.account.conference.ConferenceList - """ - super(ConferenceList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Conferences.json'.format(**self._solution) - - def stream(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, date_updated_before=values.unset, - date_updated=values.unset, date_updated_after=values.unset, - friendly_name=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Streams ConferenceInstance 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 date date_created_before: The `YYYY-MM-DD` value of the resources to read - :param date date_created: The `YYYY-MM-DD` value of the resources to read - :param date date_created_after: The `YYYY-MM-DD` value of the resources to read - :param date date_updated_before: The `YYYY-MM-DD` value of the resources to read - :param date date_updated: The `YYYY-MM-DD` value of the resources to read - :param date date_updated_after: The `YYYY-MM-DD` value of the resources to read - :param unicode friendly_name: The string that identifies the Conference resources to read - :param ConferenceInstance.Status status: The status of the resources to read - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.conference.ConferenceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - date_created_before=date_created_before, - date_created=date_created, - date_created_after=date_created_after, - date_updated_before=date_updated_before, - date_updated=date_updated, - date_updated_after=date_updated_after, - friendly_name=friendly_name, - status=status, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, date_updated_before=values.unset, - date_updated=values.unset, date_updated_after=values.unset, - friendly_name=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Lists ConferenceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param date date_created_before: The `YYYY-MM-DD` value of the resources to read - :param date date_created: The `YYYY-MM-DD` value of the resources to read - :param date date_created_after: The `YYYY-MM-DD` value of the resources to read - :param date date_updated_before: The `YYYY-MM-DD` value of the resources to read - :param date date_updated: The `YYYY-MM-DD` value of the resources to read - :param date date_updated_after: The `YYYY-MM-DD` value of the resources to read - :param unicode friendly_name: The string that identifies the Conference resources to read - :param ConferenceInstance.Status status: The status of the resources to read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.conference.ConferenceInstance] - """ - return list(self.stream( - date_created_before=date_created_before, - date_created=date_created, - date_created_after=date_created_after, - date_updated_before=date_updated_before, - date_updated=date_updated, - date_updated_after=date_updated_after, - friendly_name=friendly_name, - status=status, - limit=limit, - page_size=page_size, - )) - - def page(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, date_updated_before=values.unset, - date_updated=values.unset, date_updated_after=values.unset, - friendly_name=values.unset, status=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ConferenceInstance records from the API. - Request is executed immediately - - :param date date_created_before: The `YYYY-MM-DD` value of the resources to read - :param date date_created: The `YYYY-MM-DD` value of the resources to read - :param date date_created_after: The `YYYY-MM-DD` value of the resources to read - :param date date_updated_before: The `YYYY-MM-DD` value of the resources to read - :param date date_updated: The `YYYY-MM-DD` value of the resources to read - :param date date_updated_after: The `YYYY-MM-DD` value of the resources to read - :param unicode friendly_name: The string that identifies the Conference resources to read - :param ConferenceInstance.Status status: The status of the resources to read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ConferenceInstance - :rtype: twilio.rest.api.v2010.account.conference.ConferencePage - """ - data = values.of({ - 'DateCreated<': serialize.iso8601_date(date_created_before), - 'DateCreated': serialize.iso8601_date(date_created), - 'DateCreated>': serialize.iso8601_date(date_created_after), - 'DateUpdated<': serialize.iso8601_date(date_updated_before), - 'DateUpdated': serialize.iso8601_date(date_updated), - 'DateUpdated>': serialize.iso8601_date(date_updated_after), - 'FriendlyName': friendly_name, - 'Status': status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ConferencePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ConferenceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ConferenceInstance - :rtype: twilio.rest.api.v2010.account.conference.ConferencePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ConferencePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ConferenceContext - - :param sid: The unique string that identifies this resource - - :returns: twilio.rest.api.v2010.account.conference.ConferenceContext - :rtype: twilio.rest.api.v2010.account.conference.ConferenceContext - """ - return ConferenceContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ConferenceContext - - :param sid: The unique string that identifies this resource - - :returns: twilio.rest.api.v2010.account.conference.ConferenceContext - :rtype: twilio.rest.api.v2010.account.conference.ConferenceContext - """ - return ConferenceContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) +from twilio.base.version import Version - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ConferencePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ConferencePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created this resource - - :returns: twilio.rest.api.v2010.account.conference.ConferencePage - :rtype: twilio.rest.api.v2010.account.conference.ConferencePage - """ - super(ConferencePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ConferenceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.conference.ConferenceInstance - :rtype: twilio.rest.api.v2010.account.conference.ConferenceInstance - """ - return ConferenceInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.conference.participant import ParticipantListInstancefrom twilio.rest.conference.recording import RecordingListInstance class ConferenceContext(InstanceContext): - - def __init__(self, version, account_sid, sid): - """ - Initialize the ConferenceContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource(s) to fetch - :param sid: The unique string that identifies this resource - - :returns: twilio.rest.api.v2010.account.conference.ConferenceContext - :rtype: twilio.rest.api.v2010.account.conference.ConferenceContext - """ - super(ConferenceContext, self).__init__(version) + def __init__(self, version: Version, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Conferences/{sid}.json'.format(**self._solution) - - # Dependents + self._solution = { 'account_sid': account_sid, 'sid': sid, } + self._uri = '/Accounts/${account_sid}/Conferences/${sid}.json' + self._participants = None self._recordings = None - + def fetch(self): + """ Fetch the ConferenceInstance :returns: The fetched ConferenceInstance - :rtype: twilio.rest.api.v2010.account.conference.ConferenceInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return ConferenceInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, status=values.unset, announce_url=values.unset, - announce_method=values.unset): - """ - Update the ConferenceInstance + return ConferenceInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + - :param ConferenceInstance.UpdateStatus status: The new status of the resource - :param unicode announce_url: The URL we should call to announce something into the conference - :param unicode announce_method: he HTTP method used to call announce_url - - :returns: The updated ConferenceInstance - :rtype: twilio.rest.api.v2010.account.conference.ConferenceInstance - """ - data = values.of({'Status': status, 'AnnounceUrl': announce_url, 'AnnounceMethod': announce_method, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return ConferenceInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - @property - def participants(self): - """ - Access the participants + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: twilio.rest.api.v2010.account.conference.participant.ParticipantList - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantList - """ - if self._participants is None: - self._participants = ParticipantList( - self._version, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['sid'], - ) - return self._participants + payload = self._version.update(method='post', uri=self._uri, data=data, ) - @property - def recordings(self): - """ - Access the recordings + return ConferenceInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + - :returns: twilio.rest.api.v2010.account.conference.recording.RecordingList - :rtype: twilio.rest.api.v2010.account.conference.recording.RecordingList - """ - if self._recordings is None: - self._recordings = RecordingList( - self._version, - account_sid=self._solution['account_sid'], - conference_sid=self._solution['sid'], - ) - return self._recordings + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class ConferenceInstance(InstanceResource): - - class Status(object): - INIT = "init" - IN_PROGRESS = "in-progress" - COMPLETED = "completed" + return '' - class UpdateStatus(object): - COMPLETED = "completed" - class ReasonConferenceEnded(object): - CONFERENCE_ENDED_VIA_API = "conference-ended-via-api" - PARTICIPANT_WITH_END_CONFERENCE_ON_EXIT_LEFT = "participant-with-end-conference-on-exit-left" - PARTICIPANT_WITH_END_CONFERENCE_ON_EXIT_KICKED = "participant-with-end-conference-on-exit-kicked" - LAST_PARTICIPANT_KICKED = "last-participant-kicked" - LAST_PARTICIPANT_LEFT = "last-participant-left" - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the ConferenceInstance - - :returns: twilio.rest.api.v2010.account.conference.ConferenceInstance - :rtype: twilio.rest.api.v2010.account.conference.ConferenceInstance - """ - super(ConferenceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'api_version': payload.get('api_version'), - 'friendly_name': payload.get('friendly_name'), - 'region': payload.get('region'), - 'sid': payload.get('sid'), - 'status': payload.get('status'), - 'uri': payload.get('uri'), - 'subresource_uris': payload.get('subresource_uris'), - 'reason_conference_ended': payload.get('reason_conference_ended'), - 'call_sid_ending_conference': payload.get('call_sid_ending_conference'), +class ConferenceInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'api_version' : payload.get('api_version'), + 'friendly_name' : payload.get('friendly_name'), + 'region' : payload.get('region'), + 'sid' : payload.get('sid'), + 'status' : payload.get('status'), + 'uri' : payload.get('uri'), + 'subresource_uris' : payload.get('subresource_uris'), + 'reason_conference_ended' : payload.get('reason_conference_ended'), + 'call_sid_ending_conference' : payload.get('call_sid_ending_conference'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ConferenceContext for this ConferenceInstance - :rtype: twilio.rest.api.v2010.account.conference.ConferenceContext - """ if self._context is None: self._context = ConferenceContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context @property - def account_sid(self): - """ - :returns: The SID of the Account that created this resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def api_version(self): - """ - :returns: The API version used to create this conference - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def friendly_name(self): - """ - :returns: A string that you assigned to describe this conference room - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def region(self): - """ - :returns: A string that represents the Twilio Region where the conference was mixed - :rtype: unicode - """ - return self._properties['region'] - - @property - def sid(self): - """ - :returns: The unique string that identifies this resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def status(self): - """ - :returns: The status of this conference - :rtype: ConferenceInstance.Status - """ - return self._properties['status'] - - @property - def uri(self): - """ - :returns: The URI of this resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def subresource_uris(self): - """ - :returns: A list of related resources identified by their relative URIs - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def reason_conference_ended(self): - """ - :returns: The reason why a conference ended. - :rtype: ConferenceInstance.ReasonConferenceEnded - """ - return self._properties['reason_conference_ended'] - + def participants(self): + return self._proxy.participants @property - def call_sid_ending_conference(self): - """ - :returns: The call SID that caused the conference to end - :rtype: unicode - """ - return self._properties['call_sid_ending_conference'] - - def fetch(self): - """ - Fetch the ConferenceInstance + def recordings(self): + return self._proxy.recordings + - :returns: The fetched ConferenceInstance - :rtype: twilio.rest.api.v2010.account.conference.ConferenceInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, status=values.unset, announce_url=values.unset, - announce_method=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the ConferenceInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param ConferenceInstance.UpdateStatus status: The new status of the resource - :param unicode announce_url: The URL we should call to announce something into the conference - :param unicode announce_method: he HTTP method used to call announce_url - :returns: The updated ConferenceInstance - :rtype: twilio.rest.api.v2010.account.conference.ConferenceInstance - """ - return self._proxy.update(status=status, announce_url=announce_url, announce_method=announce_method, ) - @property - def participants(self): - """ - Access the participants +class ConferenceListInstance(ListResource): + def __init__(self, version: Version, account_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.api.v2010.account.conference.participant.ParticipantList - :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantList - """ - return self._proxy.participants + # Path Solution + self._solution = { 'account_sid': account_sid, } + self._uri = '/Accounts/${account_sid}/Conferences.json' + + + """ + def page(self, date_created, date_created, date_created, date_updated, date_updated, date_updated, friendly_name, status, page_size): + + data = values.of({ + 'date_created': date_created,'date_created': date_created,'date_created': date_created,'date_updated': date_updated,'date_updated': date_updated,'date_updated': date_updated,'friendly_name': friendly_name,'status': status,'page_size': page_size, + }) - @property - def recordings(self): - """ - Access the recordings + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.conference.recording.RecordingList - :rtype: twilio.rest.api.v2010.account.conference.recording.RecordingList - """ - return self._proxy.recordings + return ConferencePage(self._version, payload, account_sid=self._solution['account_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/incoming_phone_number.py b/twilio/rest/api/v2010/account/incoming_phone_number.py deleted file mode 100644 index 9b5f8ea89e..0000000000 --- a/twilio/rest/api/v2010/account/incoming_phone_number.py +++ /dev/null @@ -1,206 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Api - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.incoming_phone_number.assigned_add_on import AssignedAddOnListInstancefrom twilio.rest.incoming_phone_number.local import LocalListInstancefrom twilio.rest.incoming_phone_number.mobile import MobileListInstancefrom twilio.rest.incoming_phone_number.toll_free import TollFreeListInstance - - -class IncomingPhoneNumberContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/${account_sid}/IncomingPhoneNumbers/${sid}.json' - - self._assigned_add_ons = None - - def delete(self): - - - - """ - Deletes the IncomingPhoneNumberInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the IncomingPhoneNumberInstance - - :returns: The fetched IncomingPhoneNumberInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return IncomingPhoneNumberInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return IncomingPhoneNumberInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class IncomingPhoneNumberInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'address_sid' : payload.get('address_sid'), - 'address_requirements' : payload.get('address_requirements'), - 'api_version' : payload.get('api_version'), - 'beta' : payload.get('beta'), - 'capabilities' : payload.get('capabilities'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'friendly_name' : payload.get('friendly_name'), - 'identity_sid' : payload.get('identity_sid'), - 'phone_number' : payload.get('phone_number'), - 'origin' : payload.get('origin'), - 'sid' : payload.get('sid'), - 'sms_application_sid' : payload.get('sms_application_sid'), - 'sms_fallback_method' : payload.get('sms_fallback_method'), - 'sms_fallback_url' : payload.get('sms_fallback_url'), - 'sms_method' : payload.get('sms_method'), - 'sms_url' : payload.get('sms_url'), - 'status_callback' : payload.get('status_callback'), - 'status_callback_method' : payload.get('status_callback_method'), - 'trunk_sid' : payload.get('trunk_sid'), - 'uri' : payload.get('uri'), - 'voice_receive_mode' : payload.get('voice_receive_mode'), - 'voice_application_sid' : payload.get('voice_application_sid'), - 'voice_caller_id_lookup' : payload.get('voice_caller_id_lookup'), - 'voice_fallback_method' : payload.get('voice_fallback_method'), - 'voice_fallback_url' : payload.get('voice_fallback_url'), - 'voice_method' : payload.get('voice_method'), - 'voice_url' : payload.get('voice_url'), - 'emergency_status' : payload.get('emergency_status'), - 'emergency_address_sid' : payload.get('emergency_address_sid'), - 'emergency_address_status' : payload.get('emergency_address_status'), - 'bundle_sid' : payload.get('bundle_sid'), - 'status' : payload.get('status'), - } - - self._context = None - self._solution = { - 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = IncomingPhoneNumberContext( - self._version, - account_sid=self._solution['account_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def assigned_add_ons(self): - return self._proxy.assigned_add_ons - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class IncomingPhoneNumberListInstance(ListResource): - def __init__(self, version: Version, account_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, } - self._uri = '/Accounts/${account_sid}/IncomingPhoneNumbers.json' - - self._local = None - self._mobile = None - self._toll_free = None - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return IncomingPhoneNumberInstance(self._version, payload, account_sid=self._solution['account_sid']) - - """ - - """ - def page(self, beta, friendly_name, phone_number, origin, page_size): - - data = values.of({ - 'beta': beta,'friendly_name': friendly_name,'phone_number': phone_number,'origin': origin,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return IncomingPhoneNumberPage(self._version, payload, account_sid=self._solution['account_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py b/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py index 3d52b46cb4..9b5f8ea89e 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py @@ -1,972 +1,206 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on import AssignedAddOnList -from twilio.rest.api.v2010.account.incoming_phone_number.local import LocalList -from twilio.rest.api.v2010.account.incoming_phone_number.mobile import MobileList -from twilio.rest.api.v2010.account.incoming_phone_number.toll_free import TollFreeList - - -class IncomingPhoneNumberList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the IncomingPhoneNumberList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberList - """ - super(IncomingPhoneNumberList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/IncomingPhoneNumbers.json'.format(**self._solution) - - # Components - self._local = None - self._mobile = None - self._toll_free = None - - def stream(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, limit=None, - page_size=None): - """ - Streams IncomingPhoneNumberInstance 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 bool beta: Whether to include new phone numbers - :param unicode friendly_name: A string that identifies the IncomingPhoneNumber resources to read - :param unicode phone_number: The phone numbers of the IncomingPhoneNumber resources to read - :param unicode origin: Include phone numbers based on their origin. By default, phone numbers of all origin are included. - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - beta=beta, - friendly_name=friendly_name, - phone_number=phone_number, - origin=origin, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, limit=None, - page_size=None): - """ - Lists IncomingPhoneNumberInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param bool beta: Whether to include new phone numbers - :param unicode friendly_name: A string that identifies the IncomingPhoneNumber resources to read - :param unicode phone_number: The phone numbers of the IncomingPhoneNumber resources to read - :param unicode origin: Include phone numbers based on their origin. By default, phone numbers of all origin are included. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance] - """ - return list(self.stream( - beta=beta, - friendly_name=friendly_name, - phone_number=phone_number, - origin=origin, - limit=limit, - page_size=page_size, - )) - - def page(self, beta=values.unset, friendly_name=values.unset, - phone_number=values.unset, origin=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of IncomingPhoneNumberInstance records from the API. - Request is executed immediately - - :param bool beta: Whether to include new phone numbers - :param unicode friendly_name: A string that identifies the IncomingPhoneNumber resources to read - :param unicode phone_number: The phone numbers of the IncomingPhoneNumber resources to read - :param unicode origin: Include phone numbers based on their origin. By default, phone numbers of all origin are included. - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberPage - """ - data = values.of({ - 'Beta': beta, - 'FriendlyName': friendly_name, - 'PhoneNumber': phone_number, - 'Origin': origin, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return IncomingPhoneNumberPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of IncomingPhoneNumberInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return IncomingPhoneNumberPage(self._version, response, self._solution) - - def create(self, api_version=values.unset, friendly_name=values.unset, - sms_application_sid=values.unset, sms_fallback_method=values.unset, - sms_fallback_url=values.unset, sms_method=values.unset, - sms_url=values.unset, status_callback=values.unset, - status_callback_method=values.unset, - voice_application_sid=values.unset, - voice_caller_id_lookup=values.unset, - voice_fallback_method=values.unset, voice_fallback_url=values.unset, - voice_method=values.unset, voice_url=values.unset, - emergency_status=values.unset, emergency_address_sid=values.unset, - trunk_sid=values.unset, identity_sid=values.unset, - address_sid=values.unset, voice_receive_mode=values.unset, - bundle_sid=values.unset, phone_number=values.unset, - area_code=values.unset): - """ - Create the IncomingPhoneNumberInstance - - :param unicode api_version: The API version to use for incoming calls made to the new phone number - :param unicode friendly_name: A string to describe the new phone number - :param unicode sms_application_sid: The SID of the application to handle SMS messages - :param unicode sms_fallback_method: HTTP method used with sms_fallback_url - :param unicode sms_fallback_url: The URL we call when an error occurs while executing TwiML - :param unicode sms_method: The HTTP method to use with sms url - :param unicode sms_url: The URL we should call when the new phone number receives an incoming SMS message - :param unicode status_callback: The URL we should call to send status information to your application - :param unicode status_callback_method: HTTP method we should use to call status_callback - :param unicode voice_application_sid: The SID of the application to handle the new phone number - :param bool voice_caller_id_lookup: Whether to lookup the caller's name - :param unicode voice_fallback_method: The HTTP method used with voice_fallback_url - :param unicode voice_fallback_url: The URL we will call when an error occurs in TwiML - :param unicode voice_method: The HTTP method used with the voice_url - :param unicode voice_url: The URL we should call when the phone number receives a call - :param IncomingPhoneNumberInstance.EmergencyStatus emergency_status: Displays if emergency calling is enabled for this number. - :param unicode emergency_address_sid: The emergency address configuration to use for emergency calling - :param unicode trunk_sid: SID of the trunk to handle calls to the new phone number - :param unicode identity_sid: The SID of the Identity resource to associate with the new phone number - :param unicode address_sid: The SID of the Address resource associated with the phone number - :param IncomingPhoneNumberInstance.VoiceReceiveMode voice_receive_mode: Incoming call type: fax or voice - :param unicode bundle_sid: The SID of the Bundle resource associated with number - :param unicode phone_number: The phone number to purchase in E.164 format - :param unicode area_code: The desired area code for the new phone number - - :returns: The created IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance - """ - data = values.of({ - 'PhoneNumber': phone_number, - 'AreaCode': area_code, - 'ApiVersion': api_version, - 'FriendlyName': friendly_name, - 'SmsApplicationSid': sms_application_sid, - 'SmsFallbackMethod': sms_fallback_method, - 'SmsFallbackUrl': sms_fallback_url, - 'SmsMethod': sms_method, - 'SmsUrl': sms_url, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'VoiceApplicationSid': voice_application_sid, - 'VoiceCallerIdLookup': voice_caller_id_lookup, - 'VoiceFallbackMethod': voice_fallback_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceMethod': voice_method, - 'VoiceUrl': voice_url, - 'EmergencyStatus': emergency_status, - 'EmergencyAddressSid': emergency_address_sid, - 'TrunkSid': trunk_sid, - 'IdentitySid': identity_sid, - 'AddressSid': address_sid, - 'VoiceReceiveMode': voice_receive_mode, - 'BundleSid': bundle_sid, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return IncomingPhoneNumberInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ) - - @property - def local(self): - """ - Access the local - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.local.LocalList - """ - if self._local is None: - self._local = LocalList(self._version, account_sid=self._solution['account_sid'], ) - return self._local - - @property - def mobile(self): - """ - Access the mobile - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.mobile.MobileList - """ - if self._mobile is None: - self._mobile = MobileList(self._version, account_sid=self._solution['account_sid'], ) - return self._mobile - - @property - def toll_free(self): - """ - Access the toll_free - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.toll_free.TollFreeList - """ - if self._toll_free is None: - self._toll_free = TollFreeList(self._version, account_sid=self._solution['account_sid'], ) - return self._toll_free - - def get(self, sid): - """ - Constructs a IncomingPhoneNumberContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberContext - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberContext - """ - return IncomingPhoneNumberContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a IncomingPhoneNumberContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberContext - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberContext - """ - return IncomingPhoneNumberContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class IncomingPhoneNumberPage(Page): +from twilio.base.version import Version - def __init__(self, version, response, solution): - """ - Initialize the IncomingPhoneNumberPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberPage - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberPage - """ - super(IncomingPhoneNumberPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of IncomingPhoneNumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance - """ - return IncomingPhoneNumberInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.incoming_phone_number.assigned_add_on import AssignedAddOnListInstancefrom twilio.rest.incoming_phone_number.local import LocalListInstancefrom twilio.rest.incoming_phone_number.mobile import MobileListInstancefrom twilio.rest.incoming_phone_number.toll_free import TollFreeListInstance class IncomingPhoneNumberContext(InstanceContext): - - def __init__(self, version, account_sid, sid): - """ - Initialize the IncomingPhoneNumberContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberContext - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberContext - """ - super(IncomingPhoneNumberContext, self).__init__(version) + def __init__(self, version: Version, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/IncomingPhoneNumbers/{sid}.json'.format(**self._solution) - - # Dependents + self._solution = { 'account_sid': account_sid, 'sid': sid, } + self._uri = '/Accounts/${account_sid}/IncomingPhoneNumbers/${sid}.json' + self._assigned_add_ons = None + + def delete(self): + + - def update(self, account_sid=values.unset, api_version=values.unset, - friendly_name=values.unset, sms_application_sid=values.unset, - sms_fallback_method=values.unset, sms_fallback_url=values.unset, - sms_method=values.unset, sms_url=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - voice_application_sid=values.unset, - voice_caller_id_lookup=values.unset, - voice_fallback_method=values.unset, voice_fallback_url=values.unset, - voice_method=values.unset, voice_url=values.unset, - emergency_status=values.unset, emergency_address_sid=values.unset, - trunk_sid=values.unset, voice_receive_mode=values.unset, - identity_sid=values.unset, address_sid=values.unset, - bundle_sid=values.unset): - """ - Update the IncomingPhoneNumberInstance - - :param unicode account_sid: The SID of the Account that created the resource to update - :param unicode api_version: The API version to use for incoming calls made to the phone number - :param unicode friendly_name: A string to describe the resource - :param unicode sms_application_sid: Unique string that identifies the application - :param unicode sms_fallback_method: HTTP method used with sms_fallback_url - :param unicode sms_fallback_url: The URL we call when an error occurs while executing TwiML - :param unicode sms_method: The HTTP method to use with sms_url - :param unicode sms_url: The URL we should call when the phone number receives an incoming SMS message - :param unicode status_callback: The URL we should call to send status information to your application - :param unicode status_callback_method: The HTTP method we should use to call status_callback - :param unicode voice_application_sid: The SID of the application to handle the phone number - :param bool voice_caller_id_lookup: Whether to lookup the caller's name - :param unicode voice_fallback_method: The HTTP method used with fallback_url - :param unicode voice_fallback_url: The URL we will call when an error occurs in TwiML - :param unicode voice_method: The HTTP method used with the voice_url - :param unicode voice_url: The URL we should call when the phone number receives a call - :param IncomingPhoneNumberInstance.EmergencyStatus emergency_status: Displays if emergency calling is enabled for this number. - :param unicode emergency_address_sid: The emergency address configuration to use for emergency calling - :param unicode trunk_sid: SID of the trunk to handle phone calls to the phone number - :param IncomingPhoneNumberInstance.VoiceReceiveMode voice_receive_mode: Incoming call type: fax or voice - :param unicode identity_sid: Unique string that identifies the identity associated with number - :param unicode address_sid: The SID of the Address resource associated with the phone number - :param unicode bundle_sid: The SID of the Bundle resource associated with number - - :returns: The updated IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance """ - data = values.of({ - 'AccountSid': account_sid, - 'ApiVersion': api_version, - 'FriendlyName': friendly_name, - 'SmsApplicationSid': sms_application_sid, - 'SmsFallbackMethod': sms_fallback_method, - 'SmsFallbackUrl': sms_fallback_url, - 'SmsMethod': sms_method, - 'SmsUrl': sms_url, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'VoiceApplicationSid': voice_application_sid, - 'VoiceCallerIdLookup': voice_caller_id_lookup, - 'VoiceFallbackMethod': voice_fallback_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceMethod': voice_method, - 'VoiceUrl': voice_url, - 'EmergencyStatus': emergency_status, - 'EmergencyAddressSid': emergency_address_sid, - 'TrunkSid': trunk_sid, - 'VoiceReceiveMode': voice_receive_mode, - 'IdentitySid': identity_sid, - 'AddressSid': address_sid, - 'BundleSid': bundle_sid, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return IncomingPhoneNumberInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) + Deletes the IncomingPhoneNumberInstance + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the IncomingPhoneNumberInstance :returns: The fetched IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return IncomingPhoneNumberInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) + return IncomingPhoneNumberInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + - def delete(self): - """ - Deletes the IncomingPhoneNumberInstance + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - @property - def assigned_add_ons(self): - """ - Access the assigned_add_ons + return IncomingPhoneNumberInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnList - """ - if self._assigned_add_ons is None: - self._assigned_add_ons = AssignedAddOnList( - self._version, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['sid'], - ) - return self._assigned_add_ons + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class IncomingPhoneNumberInstance(InstanceResource): - class AddressRequirement(object): - NONE = "none" - ANY = "any" - LOCAL = "local" - FOREIGN = "foreign" - - class EmergencyStatus(object): - ACTIVE = "Active" - INACTIVE = "Inactive" - - class EmergencyAddressStatus(object): - REGISTERED = "registered" - UNREGISTERED = "unregistered" - PENDING_REGISTRATION = "pending-registration" - REGISTRATION_FAILURE = "registration-failure" - PENDING_UNREGISTRATION = "pending-unregistration" - UNREGISTRATION_FAILURE = "unregistration-failure" - - class VoiceReceiveMode(object): - VOICE = "voice" - FAX = "fax" - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the IncomingPhoneNumberInstance - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance - """ - super(IncomingPhoneNumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'address_sid': payload.get('address_sid'), - 'address_requirements': payload.get('address_requirements'), - 'api_version': payload.get('api_version'), - 'beta': payload.get('beta'), - 'capabilities': payload.get('capabilities'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'identity_sid': payload.get('identity_sid'), - 'phone_number': payload.get('phone_number'), - 'origin': payload.get('origin'), - 'sid': payload.get('sid'), - 'sms_application_sid': payload.get('sms_application_sid'), - 'sms_fallback_method': payload.get('sms_fallback_method'), - 'sms_fallback_url': payload.get('sms_fallback_url'), - 'sms_method': payload.get('sms_method'), - 'sms_url': payload.get('sms_url'), - 'status_callback': payload.get('status_callback'), - 'status_callback_method': payload.get('status_callback_method'), - 'trunk_sid': payload.get('trunk_sid'), - 'uri': payload.get('uri'), - 'voice_receive_mode': payload.get('voice_receive_mode'), - 'voice_application_sid': payload.get('voice_application_sid'), - 'voice_caller_id_lookup': payload.get('voice_caller_id_lookup'), - 'voice_fallback_method': payload.get('voice_fallback_method'), - 'voice_fallback_url': payload.get('voice_fallback_url'), - 'voice_method': payload.get('voice_method'), - 'voice_url': payload.get('voice_url'), - 'emergency_status': payload.get('emergency_status'), - 'emergency_address_sid': payload.get('emergency_address_sid'), - 'emergency_address_status': payload.get('emergency_address_status'), - 'bundle_sid': payload.get('bundle_sid'), - 'status': payload.get('status'), +class IncomingPhoneNumberInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'address_sid' : payload.get('address_sid'), + 'address_requirements' : payload.get('address_requirements'), + 'api_version' : payload.get('api_version'), + 'beta' : payload.get('beta'), + 'capabilities' : payload.get('capabilities'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'friendly_name' : payload.get('friendly_name'), + 'identity_sid' : payload.get('identity_sid'), + 'phone_number' : payload.get('phone_number'), + 'origin' : payload.get('origin'), + 'sid' : payload.get('sid'), + 'sms_application_sid' : payload.get('sms_application_sid'), + 'sms_fallback_method' : payload.get('sms_fallback_method'), + 'sms_fallback_url' : payload.get('sms_fallback_url'), + 'sms_method' : payload.get('sms_method'), + 'sms_url' : payload.get('sms_url'), + 'status_callback' : payload.get('status_callback'), + 'status_callback_method' : payload.get('status_callback_method'), + 'trunk_sid' : payload.get('trunk_sid'), + 'uri' : payload.get('uri'), + 'voice_receive_mode' : payload.get('voice_receive_mode'), + 'voice_application_sid' : payload.get('voice_application_sid'), + 'voice_caller_id_lookup' : payload.get('voice_caller_id_lookup'), + 'voice_fallback_method' : payload.get('voice_fallback_method'), + 'voice_fallback_url' : payload.get('voice_fallback_url'), + 'voice_method' : payload.get('voice_method'), + 'voice_url' : payload.get('voice_url'), + 'emergency_status' : payload.get('emergency_status'), + 'emergency_address_sid' : payload.get('emergency_address_sid'), + 'emergency_address_status' : payload.get('emergency_address_status'), + 'bundle_sid' : payload.get('bundle_sid'), + 'status' : payload.get('status'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: IncomingPhoneNumberContext for this IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberContext - """ if self._context is None: self._context = IncomingPhoneNumberContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def address_sid(self): - """ - :returns: The SID of the Address resource associated with the phone number - :rtype: unicode - """ - return self._properties['address_sid'] - - @property - def address_requirements(self): - """ - :returns: Whether the phone number requires an Address registered with Twilio. - :rtype: IncomingPhoneNumberInstance.AddressRequirement - """ - return self._properties['address_requirements'] - - @property - def api_version(self): - """ - :returns: The API version used to start a new TwiML session - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def beta(self): - """ - :returns: Whether the phone number is new to the Twilio platform - :rtype: bool - """ - return self._properties['beta'] - - @property - def capabilities(self): - """ - :returns: Indicate if a phone can receive calls or messages - :rtype: unicode - """ - return self._properties['capabilities'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def identity_sid(self): - """ - :returns: The SID of the Identity resource associated with number - :rtype: unicode - """ - return self._properties['identity_sid'] - - @property - def phone_number(self): - """ - :returns: The phone number in E.164 format - :rtype: unicode - """ - return self._properties['phone_number'] - - @property - def origin(self): - """ - :returns: The phone number's origin. Can be twilio or hosted. - :rtype: unicode - """ - return self._properties['origin'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def sms_application_sid(self): - """ - :returns: The SID of the application that handles SMS messages sent to the phone number - :rtype: unicode - """ - return self._properties['sms_application_sid'] - - @property - def sms_fallback_method(self): - """ - :returns: The HTTP method used with sms_fallback_url - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: The URL that we call when an error occurs while retrieving or executing the TwiML - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: The HTTP method to use with sms_url - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_url(self): - """ - :returns: The URL we call when the phone number receives an incoming SMS message - :rtype: unicode - """ - return self._properties['sms_url'] - - @property - def status_callback(self): - """ - :returns: The URL to send status information to your application - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: The HTTP method we use to call status_callback - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def trunk_sid(self): - """ - :returns: The SID of the Trunk that handles calls to the phone number - :rtype: unicode - """ - return self._properties['trunk_sid'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def voice_receive_mode(self): - """ - :returns: The voice_receive_mode - :rtype: IncomingPhoneNumberInstance.VoiceReceiveMode - """ - return self._properties['voice_receive_mode'] - - @property - def voice_application_sid(self): - """ - :returns: The SID of the application that handles calls to the phone number - :rtype: unicode - """ - return self._properties['voice_application_sid'] - - @property - def voice_caller_id_lookup(self): - """ - :returns: Whether to lookup the caller's name - :rtype: bool - """ - return self._properties['voice_caller_id_lookup'] - - @property - def voice_fallback_method(self): - """ - :returns: The HTTP method used with voice_fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: The URL we call when an error occurs in TwiML - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_method(self): - """ - :returns: The HTTP method used with the voice_url - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_url(self): - """ - :returns: The URL we call when the phone number receives a call - :rtype: unicode - """ - return self._properties['voice_url'] - - @property - def emergency_status(self): - """ - :returns: Displays if emergency calling is enabled for this number. - :rtype: IncomingPhoneNumberInstance.EmergencyStatus - """ - return self._properties['emergency_status'] - - @property - def emergency_address_sid(self): - """ - :returns: The emergency address configuration to use for emergency calling - :rtype: unicode - """ - return self._properties['emergency_address_sid'] + def assigned_add_ons(self): + return self._proxy.assigned_add_ons + - @property - def emergency_address_status(self): + def __repr__(self): """ - :returns: State of the emergency address configuration for the phone number - :rtype: IncomingPhoneNumberInstance.EmergencyAddressStatus + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['emergency_address_status'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def bundle_sid(self): - """ - :returns: The SID of the Bundle resource associated with number - :rtype: unicode - """ - return self._properties['bundle_sid'] - @property - def status(self): - """ - :returns: The status - :rtype: unicode - """ - return self._properties['status'] - - def update(self, account_sid=values.unset, api_version=values.unset, - friendly_name=values.unset, sms_application_sid=values.unset, - sms_fallback_method=values.unset, sms_fallback_url=values.unset, - sms_method=values.unset, sms_url=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - voice_application_sid=values.unset, - voice_caller_id_lookup=values.unset, - voice_fallback_method=values.unset, voice_fallback_url=values.unset, - voice_method=values.unset, voice_url=values.unset, - emergency_status=values.unset, emergency_address_sid=values.unset, - trunk_sid=values.unset, voice_receive_mode=values.unset, - identity_sid=values.unset, address_sid=values.unset, - bundle_sid=values.unset): - """ - Update the IncomingPhoneNumberInstance - - :param unicode account_sid: The SID of the Account that created the resource to update - :param unicode api_version: The API version to use for incoming calls made to the phone number - :param unicode friendly_name: A string to describe the resource - :param unicode sms_application_sid: Unique string that identifies the application - :param unicode sms_fallback_method: HTTP method used with sms_fallback_url - :param unicode sms_fallback_url: The URL we call when an error occurs while executing TwiML - :param unicode sms_method: The HTTP method to use with sms_url - :param unicode sms_url: The URL we should call when the phone number receives an incoming SMS message - :param unicode status_callback: The URL we should call to send status information to your application - :param unicode status_callback_method: The HTTP method we should use to call status_callback - :param unicode voice_application_sid: The SID of the application to handle the phone number - :param bool voice_caller_id_lookup: Whether to lookup the caller's name - :param unicode voice_fallback_method: The HTTP method used with fallback_url - :param unicode voice_fallback_url: The URL we will call when an error occurs in TwiML - :param unicode voice_method: The HTTP method used with the voice_url - :param unicode voice_url: The URL we should call when the phone number receives a call - :param IncomingPhoneNumberInstance.EmergencyStatus emergency_status: Displays if emergency calling is enabled for this number. - :param unicode emergency_address_sid: The emergency address configuration to use for emergency calling - :param unicode trunk_sid: SID of the trunk to handle phone calls to the phone number - :param IncomingPhoneNumberInstance.VoiceReceiveMode voice_receive_mode: Incoming call type: fax or voice - :param unicode identity_sid: Unique string that identifies the identity associated with number - :param unicode address_sid: The SID of the Address resource associated with the phone number - :param unicode bundle_sid: The SID of the Bundle resource associated with number - - :returns: The updated IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance - """ - return self._proxy.update( - account_sid=account_sid, - api_version=api_version, - friendly_name=friendly_name, - sms_application_sid=sms_application_sid, - sms_fallback_method=sms_fallback_method, - sms_fallback_url=sms_fallback_url, - sms_method=sms_method, - sms_url=sms_url, - status_callback=status_callback, - status_callback_method=status_callback_method, - voice_application_sid=voice_application_sid, - voice_caller_id_lookup=voice_caller_id_lookup, - voice_fallback_method=voice_fallback_method, - voice_fallback_url=voice_fallback_url, - voice_method=voice_method, - voice_url=voice_url, - emergency_status=emergency_status, - emergency_address_sid=emergency_address_sid, - trunk_sid=trunk_sid, - voice_receive_mode=voice_receive_mode, - identity_sid=identity_sid, - address_sid=address_sid, - bundle_sid=bundle_sid, - ) - def fetch(self): - """ - Fetch the IncomingPhoneNumberInstance +class IncomingPhoneNumberListInstance(ListResource): + def __init__(self, version: Version, account_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The fetched IncomingPhoneNumberInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { 'account_sid': account_sid, } + self._uri = '/Accounts/${account_sid}/IncomingPhoneNumbers.json' + + self._local = None + self._mobile = None + self._toll_free = None + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - def delete(self): - """ - Deletes the IncomingPhoneNumberInstance + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + return IncomingPhoneNumberInstance(self._version, payload, account_sid=self._solution['account_sid']) + + """ + + """ + def page(self, beta, friendly_name, phone_number, origin, page_size): + + data = values.of({ + 'beta': beta,'friendly_name': friendly_name,'phone_number': phone_number,'origin': origin,'page_size': page_size, + }) - @property - def assigned_add_ons(self): - """ - Access the assigned_add_ons + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnList - """ - return self._proxy.assigned_add_ons + return IncomingPhoneNumberPage(self._version, payload, account_sid=self._solution['account_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on.py b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on.py deleted file mode 100644 index 264c79f590..0000000000 --- a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on.py +++ /dev/null @@ -1,167 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Api - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.assigned_add_on.assigned_add_on_extension import AssignedAddOnExtensionListInstance - - -class AssignedAddOnContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, resource_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, 'resource_sid': resource_sid, 'sid': sid, } - self._uri = '/Accounts/${account_sid}/IncomingPhoneNumbers/${resource_sid}/AssignedAddOns/${sid}.json' - - self._extensions = None - - def delete(self): - - - - """ - Deletes the AssignedAddOnInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the AssignedAddOnInstance - - :returns: The fetched AssignedAddOnInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AssignedAddOnInstance(self._version, payload, account_sid=self._solution['account_sid'], resource_sid=self._solution['resource_sid'], sid=self._solution['sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class AssignedAddOnInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, resource_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'resource_sid' : payload.get('resource_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'description' : payload.get('description'), - 'configuration' : payload.get('configuration'), - 'unique_name' : payload.get('unique_name'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'uri' : payload.get('uri'), - 'subresource_uris' : payload.get('subresource_uris'), - } - - self._context = None - self._solution = { - 'account_sid': account_sid or self._properties['account_sid'],'resource_sid': resource_sid or self._properties['resource_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = AssignedAddOnContext( - self._version, - account_sid=self._solution['account_sid'],resource_sid=self._solution['resource_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def extensions(self): - return self._proxy.extensions - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class AssignedAddOnListInstance(ListResource): - def __init__(self, version: Version, account_sid: str, resource_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, 'resource_sid': resource_sid, } - self._uri = '/Accounts/${account_sid}/IncomingPhoneNumbers/${resource_sid}/AssignedAddOns.json' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return AssignedAddOnInstance(self._version, payload, account_sid=self._solution['account_sid']resource_sid=self._solution['resource_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return AssignedAddOnPage(self._version, payload, account_sid=self._solution['account_sid'], resource_sid=self._solution['resource_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py index d5e66e4f73..264c79f590 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py @@ -1,270 +1,46 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension import AssignedAddOnExtensionList - - -class AssignedAddOnList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, account_sid, resource_sid): - """ - Initialize the AssignedAddOnList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - :param resource_sid: The SID of the Phone Number that installed this Add-on - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnList - """ - super(AssignedAddOnList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'resource_sid': resource_sid, } - self._uri = '/Accounts/{account_sid}/IncomingPhoneNumbers/{resource_sid}/AssignedAddOns.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AssignedAddOnInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AssignedAddOnInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AssignedAddOnInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AssignedAddOnInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AssignedAddOnPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AssignedAddOnInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AssignedAddOnInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AssignedAddOnPage(self._version, response, self._solution) - - def create(self, installed_add_on_sid): - """ - Create the AssignedAddOnInstance - - :param unicode installed_add_on_sid: The SID that identifies the Add-on installation - - :returns: The created AssignedAddOnInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnInstance - """ - data = values.of({'InstalledAddOnSid': installed_add_on_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return AssignedAddOnInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - ) - - def get(self, sid): - """ - Constructs a AssignedAddOnContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnContext - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnContext - """ - return AssignedAddOnContext( - self._version, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a AssignedAddOnContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnContext - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnContext - """ - return AssignedAddOnContext( - self._version, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AssignedAddOnPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the AssignedAddOnPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - :param resource_sid: The SID of the Phone Number that installed this Add-on - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnPage - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnPage - """ - super(AssignedAddOnPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AssignedAddOnInstance - - :param dict payload: Payload response from the API +from twilio.base.version import Version - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnInstance - """ - return AssignedAddOnInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.assigned_add_on.assigned_add_on_extension import AssignedAddOnExtensionListInstance class AssignedAddOnContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, account_sid, resource_sid, sid): - """ - Initialize the AssignedAddOnContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param resource_sid: The SID of the Phone Number that installed this Add-on - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnContext - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnContext - """ - super(AssignedAddOnContext, self).__init__(version) + def __init__(self, version: Version, account_sid: str, resource_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'resource_sid': resource_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/IncomingPhoneNumbers/{resource_sid}/AssignedAddOns/{sid}.json'.format(**self._solution) - - # Dependents + self._solution = { 'account_sid': account_sid, 'resource_sid': resource_sid, 'sid': sid, } + self._uri = '/Accounts/${account_sid}/IncomingPhoneNumbers/${resource_sid}/AssignedAddOns/${sid}.json' + self._extensions = None - - def fetch(self): - """ - Fetch the AssignedAddOnInstance - - :returns: The fetched AssignedAddOnInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AssignedAddOnInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the AssignedAddOnInstance @@ -272,211 +48,120 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def extensions(self): + + def fetch(self): + """ - Access the extensions + Fetch the AssignedAddOnInstance - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionList + :returns: The fetched AssignedAddOnInstance + #TODO: add rtype docs """ - if self._extensions is None: - self._extensions = AssignedAddOnExtensionList( - self._version, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - assigned_add_on_sid=self._solution['sid'], - ) - return self._extensions + payload = self._version.fetch(method='GET', uri=self._uri, ) + + return AssignedAddOnInstance(self._version, payload, account_sid=self._solution['account_sid'], resource_sid=self._solution['resource_sid'], sid=self._solution['sid'], ) + + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class AssignedAddOnInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, payload, account_sid, resource_sid, sid=None): - """ - Initialize the AssignedAddOnInstance - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnInstance - """ - super(AssignedAddOnInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'resource_sid': payload.get('resource_sid'), - 'friendly_name': payload.get('friendly_name'), - 'description': payload.get('description'), - 'configuration': payload.get('configuration'), - 'unique_name': payload.get('unique_name'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'uri': payload.get('uri'), - 'subresource_uris': payload.get('subresource_uris'), +class AssignedAddOnInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, resource_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'resource_sid' : payload.get('resource_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'description' : payload.get('description'), + 'configuration' : payload.get('configuration'), + 'unique_name' : payload.get('unique_name'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'uri' : payload.get('uri'), + 'subresource_uris' : payload.get('subresource_uris'), } - # Context self._context = None self._solution = { - 'account_sid': account_sid, - 'resource_sid': resource_sid, - 'sid': sid or self._properties['sid'], + 'account_sid': account_sid or self._properties['account_sid'],'resource_sid': resource_sid or self._properties['resource_sid'],'sid': sid or self._properties['sid'], } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AssignedAddOnContext for this AssignedAddOnInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnContext - """ if self._context is None: self._context = AssignedAddOnContext( self._version, - account_sid=self._solution['account_sid'], - resource_sid=self._solution['resource_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],resource_sid=self._solution['resource_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def resource_sid(self): - """ - :returns: The SID of the Phone Number that installed this Add-on - :rtype: unicode - """ - return self._properties['resource_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def description(self): - """ - :returns: A short description of the Add-on functionality - :rtype: unicode - """ - return self._properties['description'] - - @property - def configuration(self): - """ - :returns: A JSON string that represents the current configuration - :rtype: dict - """ - return self._properties['configuration'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def subresource_uris(self): - """ - :returns: A list of related resources identified by their relative URIs - :rtype: unicode - """ - return self._properties['subresource_uris'] + def extensions(self): + return self._proxy.extensions + - def fetch(self): + def __repr__(self): """ - Fetch the AssignedAddOnInstance - - :returns: The fetched AssignedAddOnInstance - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.AssignedAddOnInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the AssignedAddOnInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - @property - def extensions(self): - """ - Access the extensions +class AssignedAddOnListInstance(ListResource): + def __init__(self, version: Version, account_sid: str, resource_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionList - :rtype: twilio.rest.api.v2010.account.incoming_phone_number.assigned_add_on.assigned_add_on_extension.AssignedAddOnExtensionList - """ - return self._proxy.extensions + # Path Solution + self._solution = { 'account_sid': account_sid, 'resource_sid': resource_sid, } + self._uri = '/Accounts/${account_sid}/IncomingPhoneNumbers/${resource_sid}/AssignedAddOns.json' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return AssignedAddOnInstance(self._version, payload, account_sid=self._solution['account_sid']resource_sid=self._solution['resource_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AssignedAddOnPage(self._version, payload, account_sid=self._solution['account_sid'], resource_sid=self._solution['resource_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/message.py b/twilio/rest/api/v2010/account/message.py deleted file mode 100644 index 68f95eee18..0000000000 --- a/twilio/rest/api/v2010/account/message.py +++ /dev/null @@ -1,193 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Api - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.message.feedback import FeedbackListInstancefrom twilio.rest.message.media import MediaListInstance - - -class MessageContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/${account_sid}/Messages/${sid}.json' - - self._feedback = None - self._media = None - - def delete(self): - - - - """ - Deletes the MessageInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the MessageInstance - - :returns: The fetched MessageInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return MessageInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return MessageInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class MessageInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'body' : payload.get('body'), - 'num_segments' : payload.get('num_segments'), - 'direction' : payload.get('direction'), - '_from' : payload.get('from'), - 'to' : payload.get('to'), - 'date_updated' : payload.get('date_updated'), - 'price' : payload.get('price'), - 'error_message' : payload.get('error_message'), - 'uri' : payload.get('uri'), - 'account_sid' : payload.get('account_sid'), - 'num_media' : payload.get('num_media'), - 'status' : payload.get('status'), - 'messaging_service_sid' : payload.get('messaging_service_sid'), - 'sid' : payload.get('sid'), - 'date_sent' : payload.get('date_sent'), - 'date_created' : payload.get('date_created'), - 'error_code' : payload.get('error_code'), - 'price_unit' : payload.get('price_unit'), - 'api_version' : payload.get('api_version'), - 'subresource_uris' : payload.get('subresource_uris'), - } - - self._context = None - self._solution = { - 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = MessageContext( - self._version, - account_sid=self._solution['account_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def feedback(self): - return self._proxy.feedback - @property - def media(self): - return self._proxy.media - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class MessageListInstance(ListResource): - def __init__(self, version: Version, account_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, } - self._uri = '/Accounts/${account_sid}/Messages.json' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return MessageInstance(self._version, payload, account_sid=self._solution['account_sid']) - - """ - - """ - def page(self, to, _from, date_sent, date_sent, date_sent, page_size): - - data = values.of({ - 'to': to,'_from': _from,'date_sent': date_sent,'date_sent': date_sent,'date_sent': date_sent,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return MessagePage(self._version, payload, account_sid=self._solution['account_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/api/v2010/account/message/__init__.py b/twilio/rest/api/v2010/account/message/__init__.py index b3100c44a6..68f95eee18 100644 --- a/twilio/rest/api/v2010/account/message/__init__.py +++ b/twilio/rest/api/v2010/account/message/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,315 +19,29 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.message.feedback import FeedbackList -from twilio.rest.api.v2010.account.message.media import MediaList - - -class MessageList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the MessageList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.message.MessageList - :rtype: twilio.rest.api.v2010.account.message.MessageList - """ - super(MessageList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Messages.json'.format(**self._solution) - - def create(self, to, status_callback=values.unset, application_sid=values.unset, - max_price=values.unset, provide_feedback=values.unset, - attempt=values.unset, validity_period=values.unset, - force_delivery=values.unset, content_retention=values.unset, - address_retention=values.unset, smart_encoded=values.unset, - persistent_action=values.unset, shorten_urls=values.unset, - schedule_type=values.unset, send_at=values.unset, - send_as_mms=values.unset, content_sid=values.unset, - content_variables=values.unset, from_=values.unset, - messaging_service_sid=values.unset, body=values.unset, - media_url=values.unset): - """ - Create the MessageInstance - - :param unicode to: The destination phone number - :param unicode status_callback: The URL we should call to send status information to your application - :param unicode application_sid: The application to use for callbacks - :param unicode max_price: The total maximum price up to 4 decimal places in US dollars acceptable for the message to be delivered. - :param bool provide_feedback: Whether to confirm delivery of the message - :param unicode attempt: Total numer of attempts made , this inclusive to send out the message - :param unicode validity_period: The number of seconds that the message can remain in our outgoing queue. - :param bool force_delivery: Reserved - :param MessageInstance.ContentRetention content_retention: Determines if the message content can be stored or redacted based on privacy settings - :param MessageInstance.AddressRetention address_retention: Determines if the address can be stored or obfuscated based on privacy settings - :param bool smart_encoded: Whether to detect Unicode characters that have a similar GSM-7 character and replace them - :param list[unicode] persistent_action: Rich actions for Channels Messages. - :param bool shorten_urls: Sets whether to shorten and track links included in the body of this message. - :param MessageInstance.ScheduleType schedule_type: Pass the value `fixed` to schedule a message at a fixed time. - :param datetime send_at: The time that Twilio will send the message. Must be in ISO 8601 format. - :param bool send_as_mms: If set to True, Twilio will deliver the message as a single MMS message, regardless of the presence of media. - :param unicode content_sid: The SID of the preconfigured Content object you want to associate with the message. - :param unicode content_variables: Key-value pairs of variable names to substitution values, used alongside a content_sid. - :param unicode from_: The phone number that initiated the message - :param unicode messaging_service_sid: The SID of the Messaging Service you want to associate with the message. - :param unicode body: The text of the message you want to send. Can be up to 1,600 characters in length. - :param list[unicode] media_url: The URL of the media to send with the message - - :returns: The created MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessageInstance - """ - data = values.of({ - 'To': to, - 'From': from_, - 'MessagingServiceSid': messaging_service_sid, - 'Body': body, - 'MediaUrl': serialize.map(media_url, lambda e: e), - 'StatusCallback': status_callback, - 'ApplicationSid': application_sid, - 'MaxPrice': max_price, - 'ProvideFeedback': provide_feedback, - 'Attempt': attempt, - 'ValidityPeriod': validity_period, - 'ForceDelivery': force_delivery, - 'ContentRetention': content_retention, - 'AddressRetention': address_retention, - 'SmartEncoded': smart_encoded, - 'PersistentAction': serialize.map(persistent_action, lambda e: e), - 'ShortenUrls': shorten_urls, - 'ScheduleType': schedule_type, - 'SendAt': serialize.iso8601_datetime(send_at), - 'SendAsMms': send_as_mms, - 'ContentSid': content_sid, - 'ContentVariables': content_variables, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return MessageInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def stream(self, to=values.unset, from_=values.unset, - date_sent_before=values.unset, date_sent=values.unset, - date_sent_after=values.unset, limit=None, page_size=None): - """ - Streams MessageInstance 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 unicode to: Filter by messages sent to this number - :param unicode from_: Filter by from number - :param datetime date_sent_before: Filter by date sent - :param datetime date_sent: Filter by date sent - :param datetime date_sent_after: Filter by date sent - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.message.MessageInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - to=to, - from_=from_, - date_sent_before=date_sent_before, - date_sent=date_sent, - date_sent_after=date_sent_after, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, to=values.unset, from_=values.unset, - date_sent_before=values.unset, date_sent=values.unset, - date_sent_after=values.unset, limit=None, page_size=None): - """ - Lists MessageInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode to: Filter by messages sent to this number - :param unicode from_: Filter by from number - :param datetime date_sent_before: Filter by date sent - :param datetime date_sent: Filter by date sent - :param datetime date_sent_after: Filter by date sent - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.message.MessageInstance] - """ - return list(self.stream( - to=to, - from_=from_, - date_sent_before=date_sent_before, - date_sent=date_sent, - date_sent_after=date_sent_after, - limit=limit, - page_size=page_size, - )) - - def page(self, to=values.unset, from_=values.unset, - date_sent_before=values.unset, date_sent=values.unset, - date_sent_after=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MessageInstance records from the API. - Request is executed immediately - - :param unicode to: Filter by messages sent to this number - :param unicode from_: Filter by from number - :param datetime date_sent_before: Filter by date sent - :param datetime date_sent: Filter by date sent - :param datetime date_sent_after: Filter by date sent - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessagePage - """ - data = values.of({ - 'To': to, - 'From': from_, - 'DateSent<': serialize.iso8601_datetime(date_sent_before), - 'DateSent': serialize.iso8601_datetime(date_sent), - 'DateSent>': serialize.iso8601_datetime(date_sent_after), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return MessagePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MessageInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessagePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MessagePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MessageContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.message.MessageContext - :rtype: twilio.rest.api.v2010.account.message.MessageContext - """ - return MessageContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a MessageContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.message.MessageContext - :rtype: twilio.rest.api.v2010.account.message.MessageContext - """ - return MessageContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class MessagePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the MessagePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource +from twilio.base.version import Version - :returns: twilio.rest.api.v2010.account.message.MessagePage - :rtype: twilio.rest.api.v2010.account.message.MessagePage - """ - super(MessagePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MessageInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.message.MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessageInstance - """ - return MessageInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.message.feedback import FeedbackListInstancefrom twilio.rest.message.media import MediaListInstance class MessageContext(InstanceContext): - - def __init__(self, version, account_sid, sid): - """ - Initialize the MessageContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.message.MessageContext - :rtype: twilio.rest.api.v2010.account.message.MessageContext - """ - super(MessageContext, self).__init__(version) + def __init__(self, version: Version, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Messages/{sid}.json'.format(**self._solution) - - # Dependents - self._media = None + self._solution = { 'account_sid': account_sid, 'sid': sid, } + self._uri = '/Accounts/${account_sid}/Messages/${sid}.json' + self._feedback = None - + self._media = None + def delete(self): + + + """ Deletes the MessageInstance @@ -328,395 +49,145 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - + def fetch(self): + """ Fetch the MessageInstance :returns: The fetched MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessageInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return MessageInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, body=values.unset, status=values.unset): - """ - Update the MessageInstance - - :param unicode body: The text of the message you want to send - :param MessageInstance.UpdateStatus status: Set as `canceled` to cancel a message from being sent. + return MessageInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + - :returns: The updated MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessageInstance - """ - data = values.of({'Body': body, 'Status': status, }) + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return MessageInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) + return MessageInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + - @property - def media(self): - """ - Access the media - - :returns: twilio.rest.api.v2010.account.message.media.MediaList - :rtype: twilio.rest.api.v2010.account.message.media.MediaList - """ - if self._media is None: - self._media = MediaList( - self._version, - account_sid=self._solution['account_sid'], - message_sid=self._solution['sid'], - ) - return self._media - - @property - def feedback(self): - """ - Access the feedback - - :returns: twilio.rest.api.v2010.account.message.feedback.FeedbackList - :rtype: twilio.rest.api.v2010.account.message.feedback.FeedbackList - """ - if self._feedback is None: - self._feedback = FeedbackList( - self._version, - account_sid=self._solution['account_sid'], - message_sid=self._solution['sid'], - ) - return self._feedback + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class MessageInstance(InstanceResource): - class Status(object): - QUEUED = "queued" - SENDING = "sending" - SENT = "sent" - FAILED = "failed" - DELIVERED = "delivered" - UNDELIVERED = "undelivered" - RECEIVING = "receiving" - RECEIVED = "received" - ACCEPTED = "accepted" - SCHEDULED = "scheduled" - READ = "read" - PARTIALLY_DELIVERED = "partially_delivered" - CANCELED = "canceled" - - class UpdateStatus(object): - CANCELED = "canceled" - - class Direction(object): - INBOUND = "inbound" - OUTBOUND_API = "outbound-api" - OUTBOUND_CALL = "outbound-call" - OUTBOUND_REPLY = "outbound-reply" - - class ContentRetention(object): - RETAIN = "retain" - - class AddressRetention(object): - RETAIN = "retain" - - class TrafficType(object): - FREE = "free" - - class ScheduleType(object): - FIXED = "fixed" - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the MessageInstance - :returns: twilio.rest.api.v2010.account.message.MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessageInstance - """ - super(MessageInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'body': payload.get('body'), - 'num_segments': payload.get('num_segments'), - 'direction': payload.get('direction'), - 'from_': payload.get('from'), - 'to': payload.get('to'), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'price': payload.get('price'), - 'error_message': payload.get('error_message'), - 'uri': payload.get('uri'), - 'account_sid': payload.get('account_sid'), - 'num_media': payload.get('num_media'), - 'status': payload.get('status'), - 'messaging_service_sid': payload.get('messaging_service_sid'), - 'sid': payload.get('sid'), - 'date_sent': deserialize.rfc2822_datetime(payload.get('date_sent')), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'error_code': deserialize.integer(payload.get('error_code')), - 'price_unit': payload.get('price_unit'), - 'api_version': payload.get('api_version'), - 'subresource_uris': payload.get('subresource_uris'), +class MessageInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'body' : payload.get('body'), + 'num_segments' : payload.get('num_segments'), + 'direction' : payload.get('direction'), + '_from' : payload.get('from'), + 'to' : payload.get('to'), + 'date_updated' : payload.get('date_updated'), + 'price' : payload.get('price'), + 'error_message' : payload.get('error_message'), + 'uri' : payload.get('uri'), + 'account_sid' : payload.get('account_sid'), + 'num_media' : payload.get('num_media'), + 'status' : payload.get('status'), + 'messaging_service_sid' : payload.get('messaging_service_sid'), + 'sid' : payload.get('sid'), + 'date_sent' : payload.get('date_sent'), + 'date_created' : payload.get('date_created'), + 'error_code' : payload.get('error_code'), + 'price_unit' : payload.get('price_unit'), + 'api_version' : payload.get('api_version'), + 'subresource_uris' : payload.get('subresource_uris'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MessageContext for this MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessageContext - """ if self._context is None: self._context = MessageContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context @property - def body(self): - """ - :returns: The message text - :rtype: unicode - """ - return self._properties['body'] - - @property - def num_segments(self): - """ - :returns: The number of messages used to deliver the message body - :rtype: unicode - """ - return self._properties['num_segments'] - - @property - def direction(self): - """ - :returns: The direction of the message - :rtype: MessageInstance.Direction - """ - return self._properties['direction'] - - @property - def from_(self): - """ - :returns: The phone number that initiated the message - :rtype: unicode - """ - return self._properties['from_'] - - @property - def to(self): - """ - :returns: The phone number that received the message - :rtype: unicode - """ - return self._properties['to'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def price(self): - """ - :returns: The amount billed for the message - :rtype: unicode - """ - return self._properties['price'] - - @property - def error_message(self): - """ - :returns: The description of the error_code - :rtype: unicode - """ - return self._properties['error_message'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def num_media(self): - """ - :returns: The number of media files associated with the message - :rtype: unicode - """ - return self._properties['num_media'] - - @property - def status(self): - """ - :returns: The status of the message - :rtype: MessageInstance.Status - """ - return self._properties['status'] - - @property - def messaging_service_sid(self): - """ - :returns: The SID of the Messaging Service used with the message. - :rtype: unicode - """ - return self._properties['messaging_service_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def date_sent(self): - """ - :returns: The RFC 2822 date and time in GMT when the message was sent - :rtype: datetime - """ - return self._properties['date_sent'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def error_code(self): - """ - :returns: The error code associated with the message - :rtype: unicode - """ - return self._properties['error_code'] - - @property - def price_unit(self): - """ - :returns: The currency in which price is measured - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def api_version(self): - """ - :returns: The API version used to process the message - :rtype: unicode - """ - return self._properties['api_version'] - + def feedback(self): + return self._proxy.feedback @property - def subresource_uris(self): - """ - :returns: A list of related resources identified by their relative URIs - :rtype: unicode - """ - return self._properties['subresource_uris'] - - def delete(self): - """ - Deletes the MessageInstance + def media(self): + return self._proxy.media + - :returns: True if delete succeeds, False otherwise - :rtype: bool + def __repr__(self): """ - return self._proxy.delete() - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the MessageInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessageInstance - """ - return self._proxy.fetch() - def update(self, body=values.unset, status=values.unset): - """ - Update the MessageInstance - :param unicode body: The text of the message you want to send - :param MessageInstance.UpdateStatus status: Set as `canceled` to cancel a message from being sent. +class MessageListInstance(ListResource): + def __init__(self, version: Version, account_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The updated MessageInstance - :rtype: twilio.rest.api.v2010.account.message.MessageInstance - """ - return self._proxy.update(body=body, status=status, ) + # Path Solution + self._solution = { 'account_sid': account_sid, } + self._uri = '/Accounts/${account_sid}/Messages.json' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def media(self): - """ - Access the media + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.message.media.MediaList - :rtype: twilio.rest.api.v2010.account.message.media.MediaList - """ - return self._proxy.media + return MessageInstance(self._version, payload, account_sid=self._solution['account_sid']) + + """ + + """ + def page(self, to, _from, date_sent, date_sent, date_sent, page_size): + + data = values.of({ + 'to': to,'_from': _from,'date_sent': date_sent,'date_sent': date_sent,'date_sent': date_sent,'page_size': page_size, + }) - @property - def feedback(self): - """ - Access the feedback + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.message.feedback.FeedbackList - :rtype: twilio.rest.api.v2010.account.message.feedback.FeedbackList - """ - return self._proxy.feedback + return MessagePage(self._version, payload, account_sid=self._solution['account_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/queue.py b/twilio/rest/api/v2010/account/queue.py deleted file mode 100644 index dfc4250b25..0000000000 --- a/twilio/rest/api/v2010/account/queue.py +++ /dev/null @@ -1,178 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Api - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.queue.member import MemberListInstance - - -class QueueContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/${account_sid}/Queues/${sid}.json' - - self._members = None - - def delete(self): - - - - """ - Deletes the QueueInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the QueueInstance - - :returns: The fetched QueueInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return QueueInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return QueueInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class QueueInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'date_updated' : payload.get('date_updated'), - 'current_size' : payload.get('current_size'), - 'friendly_name' : payload.get('friendly_name'), - 'uri' : payload.get('uri'), - 'account_sid' : payload.get('account_sid'), - 'average_wait_time' : payload.get('average_wait_time'), - 'sid' : payload.get('sid'), - 'date_created' : payload.get('date_created'), - 'max_size' : payload.get('max_size'), - } - - self._context = None - self._solution = { - 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = QueueContext( - self._version, - account_sid=self._solution['account_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def members(self): - return self._proxy.members - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class QueueListInstance(ListResource): - def __init__(self, version: Version, account_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, } - self._uri = '/Accounts/${account_sid}/Queues.json' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return QueueInstance(self._version, payload, account_sid=self._solution['account_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return QueuePage(self._version, payload, account_sid=self._solution['account_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/api/v2010/account/queue/__init__.py b/twilio/rest/api/v2010/account/queue/__init__.py index f78c7f146f..dfc4250b25 100644 --- a/twilio/rest/api/v2010/account/queue/__init__.py +++ b/twilio/rest/api/v2010/account/queue/__init__.py @@ -1,460 +1,178 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.queue.member import MemberList - - -class QueueList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the QueueList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created this resource - - :returns: twilio.rest.api.v2010.account.queue.QueueList - :rtype: twilio.rest.api.v2010.account.queue.QueueList - """ - super(QueueList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Queues.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams QueueInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.queue.QueueInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists QueueInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.queue.QueueInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of QueueInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueuePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return QueuePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of QueueInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueuePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return QueuePage(self._version, response, self._solution) - - def create(self, friendly_name, max_size=values.unset): - """ - Create the QueueInstance - - :param unicode friendly_name: A string to describe this resource - :param unicode max_size: The max number of calls allowed in the queue - - :returns: The created QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueueInstance - """ - data = values.of({'FriendlyName': friendly_name, 'MaxSize': max_size, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return QueueInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def get(self, sid): - """ - Constructs a QueueContext - - :param sid: The unique string that identifies this resource - - :returns: twilio.rest.api.v2010.account.queue.QueueContext - :rtype: twilio.rest.api.v2010.account.queue.QueueContext - """ - return QueueContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a QueueContext - - :param sid: The unique string that identifies this resource - - :returns: twilio.rest.api.v2010.account.queue.QueueContext - :rtype: twilio.rest.api.v2010.account.queue.QueueContext - """ - return QueueContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base.version import Version +from twilio.base.page import Page -class QueuePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the QueuePage +# from twilio.rest.queue.member import MemberListInstance - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created this resource - :returns: twilio.rest.api.v2010.account.queue.QueuePage - :rtype: twilio.rest.api.v2010.account.queue.QueuePage - """ - super(QueuePage, self).__init__(version, response) +class QueueContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of QueueInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.queue.QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueueInstance - """ - return QueueInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class QueueContext(InstanceContext): + self._solution = { 'account_sid': account_sid, 'sid': sid, } + self._uri = '/Accounts/${account_sid}/Queues/${sid}.json' + + self._members = None + + def delete(self): + + - def __init__(self, version, account_sid, sid): """ - Initialize the QueueContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource(s) to fetch - :param sid: The unique string that identifies this resource + Deletes the QueueInstance - :returns: twilio.rest.api.v2010.account.queue.QueueContext - :rtype: twilio.rest.api.v2010.account.queue.QueueContext + :returns: True if delete succeeds, False otherwise + :rtype: bool """ - super(QueueContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Queues/{sid}.json'.format(**self._solution) - - # Dependents - self._members = None - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the QueueInstance :returns: The fetched QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueueInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return QueueInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) + return QueueInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + - def update(self, friendly_name=values.unset, max_size=values.unset): - """ - Update the QueueInstance - - :param unicode friendly_name: A string to describe this resource - :param unicode max_size: The max number of calls allowed in the queue + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: The updated QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueueInstance - """ - data = values.of({'FriendlyName': friendly_name, 'MaxSize': max_size, }) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + return QueueInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + - return QueueInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the QueueInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def members(self): - """ - Access the members - - :returns: twilio.rest.api.v2010.account.queue.member.MemberList - :rtype: twilio.rest.api.v2010.account.queue.member.MemberList - """ - if self._members is None: - self._members = MemberList( - self._version, - account_sid=self._solution['account_sid'], - queue_sid=self._solution['sid'], - ) - return self._members + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class QueueInstance(InstanceResource): - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the QueueInstance - :returns: twilio.rest.api.v2010.account.queue.QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueueInstance - """ - super(QueueInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'current_size': deserialize.integer(payload.get('current_size')), - 'friendly_name': payload.get('friendly_name'), - 'uri': payload.get('uri'), - 'account_sid': payload.get('account_sid'), - 'average_wait_time': deserialize.integer(payload.get('average_wait_time')), - 'sid': payload.get('sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'max_size': deserialize.integer(payload.get('max_size')), +class QueueInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'date_updated' : payload.get('date_updated'), + 'current_size' : payload.get('current_size'), + 'friendly_name' : payload.get('friendly_name'), + 'uri' : payload.get('uri'), + 'account_sid' : payload.get('account_sid'), + 'average_wait_time' : payload.get('average_wait_time'), + 'sid' : payload.get('sid'), + 'date_created' : payload.get('date_created'), + 'max_size' : payload.get('max_size'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: QueueContext for this QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueueContext - """ if self._context is None: self._context = QueueContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def current_size(self): - """ - :returns: The number of calls currently in the queue. - :rtype: unicode - """ - return self._properties['current_size'] - - @property - def friendly_name(self): - """ - :returns: A string that you assigned to describe this resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def uri(self): - """ - :returns: The URI of this resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created this resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def average_wait_time(self): - """ - :returns: Average wait time of members in the queue - :rtype: unicode - """ - return self._properties['average_wait_time'] - - @property - def sid(self): - """ - :returns: The unique string that identifies this resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def max_size(self): - """ - :returns: The max number of calls allowed in the queue - :rtype: unicode - """ - return self._properties['max_size'] - - def fetch(self): - """ - Fetch the QueueInstance - - :returns: The fetched QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueueInstance - """ - return self._proxy.fetch() + def members(self): + return self._proxy.members + - def update(self, friendly_name=values.unset, max_size=values.unset): + def __repr__(self): """ - Update the QueueInstance - - :param unicode friendly_name: A string to describe this resource - :param unicode max_size: The max number of calls allowed in the queue - - :returns: The updated QueueInstance - :rtype: twilio.rest.api.v2010.account.queue.QueueInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update(friendly_name=friendly_name, max_size=max_size, ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the QueueInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - @property - def members(self): - """ - Access the members +class QueueListInstance(ListResource): + def __init__(self, version: Version, account_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.api.v2010.account.queue.member.MemberList - :rtype: twilio.rest.api.v2010.account.queue.member.MemberList - """ - return self._proxy.members + # Path Solution + self._solution = { 'account_sid': account_sid, } + self._uri = '/Accounts/${account_sid}/Queues.json' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return QueueInstance(self._version, payload, account_sid=self._solution['account_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return QueuePage(self._version, payload, account_sid=self._solution['account_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/recording.py b/twilio/rest/api/v2010/account/recording.py deleted file mode 100644 index 8da73ddf3b..0000000000 --- a/twilio/rest/api/v2010/account/recording.py +++ /dev/null @@ -1,167 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Api - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.recording.add_on_result import AddOnResultListInstancefrom twilio.rest.recording.transcription import TranscriptionListInstance - - -class RecordingContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/${account_sid}/Recordings/${sid}.json' - - self._add_on_results = None - self._transcriptions = None - - def delete(self): - - - - """ - Deletes the RecordingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self, include_soft_deleted): - - """ - Fetch the RecordingInstance - - :returns: The fetched RecordingInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return RecordingInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class RecordingInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'api_version' : payload.get('api_version'), - 'call_sid' : payload.get('call_sid'), - 'conference_sid' : payload.get('conference_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'start_time' : payload.get('start_time'), - 'duration' : payload.get('duration'), - 'sid' : payload.get('sid'), - 'price' : payload.get('price'), - 'price_unit' : payload.get('price_unit'), - 'status' : payload.get('status'), - 'channels' : payload.get('channels'), - 'source' : payload.get('source'), - 'error_code' : payload.get('error_code'), - 'uri' : payload.get('uri'), - 'encryption_details' : payload.get('encryption_details'), - 'subresource_uris' : payload.get('subresource_uris'), - 'media_url' : payload.get('media_url'), - } - - self._context = None - self._solution = { - 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = RecordingContext( - self._version, - account_sid=self._solution['account_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def add_on_results(self): - return self._proxy.add_on_results - @property - def transcriptions(self): - return self._proxy.transcriptions - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class RecordingListInstance(ListResource): - def __init__(self, version: Version, account_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, } - self._uri = '/Accounts/${account_sid}/Recordings.json' - - - """ - def page(self, date_created, date_created, date_created, call_sid, conference_sid, include_soft_deleted, page_size): - - data = values.of({ - 'date_created': date_created,'date_created': date_created,'date_created': date_created,'call_sid': call_sid,'conference_sid': conference_sid,'include_soft_deleted': include_soft_deleted,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return RecordingPage(self._version, payload, account_sid=self._solution['account_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/api/v2010/account/recording/__init__.py b/twilio/rest/api/v2010/account/recording/__init__.py index bb7b39d68f..8da73ddf3b 100644 --- a/twilio/rest/api/v2010/account/recording/__init__.py +++ b/twilio/rest/api/v2010/account/recording/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,275 +19,29 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.recording.add_on_result import AddOnResultList -from twilio.rest.api.v2010.account.recording.transcription import TranscriptionList - - -class RecordingList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the RecordingList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.recording.RecordingList - :rtype: twilio.rest.api.v2010.account.recording.RecordingList - """ - super(RecordingList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Recordings.json'.format(**self._solution) - - def stream(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, call_sid=values.unset, - conference_sid=values.unset, include_soft_deleted=values.unset, - limit=None, page_size=None): - """ - Streams RecordingInstance 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 datetime date_created_before: Only include recordings that were created on this date - :param datetime date_created: Only include recordings that were created on this date - :param datetime date_created_after: Only include recordings that were created on this date - :param unicode call_sid: The Call SID of the resources to read - :param unicode conference_sid: Read by unique Conference SID for the recording - :param bool include_soft_deleted: A boolean parameter indicating whether to retrieve soft deleted recordings or not. - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.recording.RecordingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - date_created_before=date_created_before, - date_created=date_created, - date_created_after=date_created_after, - call_sid=call_sid, - conference_sid=conference_sid, - include_soft_deleted=include_soft_deleted, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, call_sid=values.unset, - conference_sid=values.unset, include_soft_deleted=values.unset, - limit=None, page_size=None): - """ - Lists RecordingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param datetime date_created_before: Only include recordings that were created on this date - :param datetime date_created: Only include recordings that were created on this date - :param datetime date_created_after: Only include recordings that were created on this date - :param unicode call_sid: The Call SID of the resources to read - :param unicode conference_sid: Read by unique Conference SID for the recording - :param bool include_soft_deleted: A boolean parameter indicating whether to retrieve soft deleted recordings or not. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.recording.RecordingInstance] - """ - return list(self.stream( - date_created_before=date_created_before, - date_created=date_created, - date_created_after=date_created_after, - call_sid=call_sid, - conference_sid=conference_sid, - include_soft_deleted=include_soft_deleted, - limit=limit, - page_size=page_size, - )) - - def page(self, date_created_before=values.unset, date_created=values.unset, - date_created_after=values.unset, call_sid=values.unset, - conference_sid=values.unset, include_soft_deleted=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RecordingInstance records from the API. - Request is executed immediately - - :param datetime date_created_before: Only include recordings that were created on this date - :param datetime date_created: Only include recordings that were created on this date - :param datetime date_created_after: Only include recordings that were created on this date - :param unicode call_sid: The Call SID of the resources to read - :param unicode conference_sid: Read by unique Conference SID for the recording - :param bool include_soft_deleted: A boolean parameter indicating whether to retrieve soft deleted recordings or not. - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RecordingInstance - :rtype: twilio.rest.api.v2010.account.recording.RecordingPage - """ - data = values.of({ - 'DateCreated<': serialize.iso8601_datetime(date_created_before), - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateCreated>': serialize.iso8601_datetime(date_created_after), - 'CallSid': call_sid, - 'ConferenceSid': conference_sid, - 'IncludeSoftDeleted': include_soft_deleted, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return RecordingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RecordingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RecordingInstance - :rtype: twilio.rest.api.v2010.account.recording.RecordingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RecordingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RecordingContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.recording.RecordingContext - :rtype: twilio.rest.api.v2010.account.recording.RecordingContext - """ - return RecordingContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RecordingContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.recording.RecordingContext - :rtype: twilio.rest.api.v2010.account.recording.RecordingContext - """ - return RecordingContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base.version import Version +from twilio.base.page import Page -class RecordingPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the RecordingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - - :returns: twilio.rest.api.v2010.account.recording.RecordingPage - :rtype: twilio.rest.api.v2010.account.recording.RecordingPage - """ - super(RecordingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RecordingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.recording.RecordingInstance - :rtype: twilio.rest.api.v2010.account.recording.RecordingInstance - """ - return RecordingInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.recording.add_on_result import AddOnResultListInstancefrom twilio.rest.recording.transcription import TranscriptionListInstance class RecordingContext(InstanceContext): - - def __init__(self, version, account_sid, sid): - """ - Initialize the RecordingContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.recording.RecordingContext - :rtype: twilio.rest.api.v2010.account.recording.RecordingContext - """ - super(RecordingContext, self).__init__(version) + def __init__(self, version: Version, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Recordings/{sid}.json'.format(**self._solution) - - # Dependents - self._transcriptions = None + self._solution = { 'account_sid': account_sid, 'sid': sid, } + self._uri = '/Accounts/${account_sid}/Recordings/${sid}.json' + self._add_on_results = None - - def fetch(self, include_soft_deleted=values.unset): - """ - Fetch the RecordingInstance - - :param bool include_soft_deleted: A boolean parameter indicating whether to retrieve soft deleted recordings or not. - - :returns: The fetched RecordingInstance - :rtype: twilio.rest.api.v2010.account.recording.RecordingInstance - """ - data = values.of({'IncludeSoftDeleted': include_soft_deleted, }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return RecordingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - + self._transcriptions = None + def delete(self): + + + """ Deletes the RecordingInstance @@ -288,321 +49,119 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def transcriptions(self): + + def fetch(self, include_soft_deleted): + """ - Access the transcriptions + Fetch the RecordingInstance - :returns: twilio.rest.api.v2010.account.recording.transcription.TranscriptionList - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionList + :returns: The fetched RecordingInstance + #TODO: add rtype docs """ - if self._transcriptions is None: - self._transcriptions = TranscriptionList( - self._version, - account_sid=self._solution['account_sid'], - recording_sid=self._solution['sid'], - ) - return self._transcriptions + payload = self._version.fetch(method='GET', uri=self._uri, ) - @property - def add_on_results(self): - """ - Access the add_on_results + return RecordingInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + - :returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultList - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultList - """ - if self._add_on_results is None: - self._add_on_results = AddOnResultList( - self._version, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['sid'], - ) - return self._add_on_results + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class RecordingInstance(InstanceResource): - - class Status(object): - IN_PROGRESS = "in-progress" - PAUSED = "paused" - STOPPED = "stopped" - PROCESSING = "processing" - COMPLETED = "completed" - ABSENT = "absent" - DELETED = "deleted" + return '' - class Source(object): - DIALVERB = "DialVerb" - CONFERENCE = "Conference" - OUTBOUNDAPI = "OutboundAPI" - TRUNKING = "Trunking" - RECORDVERB = "RecordVerb" - STARTCALLRECORDINGAPI = "StartCallRecordingAPI" - STARTCONFERENCERECORDINGAPI = "StartConferenceRecordingAPI" - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the RecordingInstance - - :returns: twilio.rest.api.v2010.account.recording.RecordingInstance - :rtype: twilio.rest.api.v2010.account.recording.RecordingInstance - """ - super(RecordingInstance, self).__init__(version) - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'call_sid': payload.get('call_sid'), - 'conference_sid': payload.get('conference_sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'start_time': deserialize.rfc2822_datetime(payload.get('start_time')), - 'duration': payload.get('duration'), - 'sid': payload.get('sid'), - 'price': payload.get('price'), - 'price_unit': payload.get('price_unit'), - 'status': payload.get('status'), - 'channels': deserialize.integer(payload.get('channels')), - 'source': payload.get('source'), - 'error_code': deserialize.integer(payload.get('error_code')), - 'uri': payload.get('uri'), - 'encryption_details': payload.get('encryption_details'), - 'subresource_uris': payload.get('subresource_uris'), - 'media_url': payload.get('media_url'), +class RecordingInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'api_version' : payload.get('api_version'), + 'call_sid' : payload.get('call_sid'), + 'conference_sid' : payload.get('conference_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'start_time' : payload.get('start_time'), + 'duration' : payload.get('duration'), + 'sid' : payload.get('sid'), + 'price' : payload.get('price'), + 'price_unit' : payload.get('price_unit'), + 'status' : payload.get('status'), + 'channels' : payload.get('channels'), + 'source' : payload.get('source'), + 'error_code' : payload.get('error_code'), + 'uri' : payload.get('uri'), + 'encryption_details' : payload.get('encryption_details'), + 'subresource_uris' : payload.get('subresource_uris'), + 'media_url' : payload.get('media_url'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RecordingContext for this RecordingInstance - :rtype: twilio.rest.api.v2010.account.recording.RecordingContext - """ if self._context is None: self._context = RecordingContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The API version used during the recording. - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def call_sid(self): - """ - :returns: The SID of the Call the resource is associated with - :rtype: unicode - """ - return self._properties['call_sid'] - - @property - def conference_sid(self): - """ - :returns: The unique ID for the conference associated with the recording. - :rtype: unicode - """ - return self._properties['conference_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def start_time(self): - """ - :returns: The start time of the recording, given in RFC 2822 format - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def duration(self): - """ - :returns: The length of the recording in seconds. - :rtype: unicode - """ - return self._properties['duration'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def price(self): - """ - :returns: The one-time cost of creating the recording. - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The currency used in the price property. - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def status(self): - """ - :returns: The status of the recording. - :rtype: RecordingInstance.Status - """ - return self._properties['status'] - - @property - def channels(self): - """ - :returns: The number of channels in the final recording file as an integer. - :rtype: unicode - """ - return self._properties['channels'] - - @property - def source(self): - """ - :returns: How the recording was created - :rtype: RecordingInstance.Source - """ - return self._properties['source'] - - @property - def error_code(self): - """ - :returns: More information about why the recording is missing, if status is `absent`. - :rtype: unicode - """ - return self._properties['error_code'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def encryption_details(self): - """ - :returns: How to decrypt the recording. - :rtype: dict - """ - return self._properties['encryption_details'] - - @property - def subresource_uris(self): - """ - :returns: A list of related resources identified by their relative URIs - :rtype: unicode - """ - return self._properties['subresource_uris'] - + def add_on_results(self): + return self._proxy.add_on_results @property - def media_url(self): - """ - :returns: The URL of the media file. - :rtype: unicode - """ - return self._properties['media_url'] + def transcriptions(self): + return self._proxy.transcriptions + - def fetch(self, include_soft_deleted=values.unset): + def __repr__(self): """ - Fetch the RecordingInstance - - :param bool include_soft_deleted: A boolean parameter indicating whether to retrieve soft deleted recordings or not. - - :returns: The fetched RecordingInstance - :rtype: twilio.rest.api.v2010.account.recording.RecordingInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch(include_soft_deleted=include_soft_deleted, ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the RecordingInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - @property - def transcriptions(self): - """ - Access the transcriptions +class RecordingListInstance(ListResource): + def __init__(self, version: Version, account_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.api.v2010.account.recording.transcription.TranscriptionList - :rtype: twilio.rest.api.v2010.account.recording.transcription.TranscriptionList - """ - return self._proxy.transcriptions + # Path Solution + self._solution = { 'account_sid': account_sid, } + self._uri = '/Accounts/${account_sid}/Recordings.json' + + + """ + def page(self, date_created, date_created, date_created, call_sid, conference_sid, include_soft_deleted, page_size): + + data = values.of({ + 'date_created': date_created,'date_created': date_created,'date_created': date_created,'call_sid': call_sid,'conference_sid': conference_sid,'include_soft_deleted': include_soft_deleted,'page_size': page_size, + }) - @property - def add_on_results(self): - """ - Access the add_on_results + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultList - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultList - """ - return self._proxy.add_on_results + return RecordingPage(self._version, payload, account_sid=self._solution['account_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/recording/add_on_result.py b/twilio/rest/api/v2010/account/recording/add_on_result.py deleted file mode 100644 index fca56f33da..0000000000 --- a/twilio/rest/api/v2010/account/recording/add_on_result.py +++ /dev/null @@ -1,154 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Api - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.add_on_result.payload import PayloadListInstance - - -class AddOnResultContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, reference_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, 'reference_sid': reference_sid, 'sid': sid, } - self._uri = '/Accounts/${account_sid}/Recordings/${reference_sid}/AddOnResults/${sid}.json' - - self._payloads = None - - def delete(self): - - - - """ - Deletes the AddOnResultInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the AddOnResultInstance - - :returns: The fetched AddOnResultInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AddOnResultInstance(self._version, payload, account_sid=self._solution['account_sid'], reference_sid=self._solution['reference_sid'], sid=self._solution['sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class AddOnResultInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, reference_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'status' : payload.get('status'), - 'add_on_sid' : payload.get('add_on_sid'), - 'add_on_configuration_sid' : payload.get('add_on_configuration_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'date_completed' : payload.get('date_completed'), - 'reference_sid' : payload.get('reference_sid'), - 'subresource_uris' : payload.get('subresource_uris'), - } - - self._context = None - self._solution = { - 'account_sid': account_sid or self._properties['account_sid'],'reference_sid': reference_sid or self._properties['reference_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = AddOnResultContext( - self._version, - account_sid=self._solution['account_sid'],reference_sid=self._solution['reference_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def payloads(self): - return self._proxy.payloads - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class AddOnResultListInstance(ListResource): - def __init__(self, version: Version, account_sid: str, reference_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, 'reference_sid': reference_sid, } - self._uri = '/Accounts/${account_sid}/Recordings/${reference_sid}/AddOnResults.json' - - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return AddOnResultPage(self._version, payload, account_sid=self._solution['account_sid'], reference_sid=self._solution['reference_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py b/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py index e75bbd3d59..fca56f33da 100644 --- a/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py +++ b/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py @@ -1,244 +1,46 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.recording.add_on_result.payload import PayloadList - - -class AddOnResultList(ListResource): - - def __init__(self, version, account_sid, reference_sid): - """ - Initialize the AddOnResultList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - :param reference_sid: The SID of the recording to which the AddOnResult resource belongs - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultList - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultList - """ - super(AddOnResultList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'reference_sid': reference_sid, } - self._uri = '/Accounts/{account_sid}/Recordings/{reference_sid}/AddOnResults.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AddOnResultInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AddOnResultInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AddOnResultInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AddOnResultInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AddOnResultPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AddOnResultInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AddOnResultInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AddOnResultPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AddOnResultContext - - :param sid: The unique string that identifies the resource to fetch - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultContext - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultContext - """ - return AddOnResultContext( - self._version, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a AddOnResultContext +from twilio.base.version import Version - :param sid: The unique string that identifies the resource to fetch - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultContext - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultContext - """ - return AddOnResultContext( - self._version, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AddOnResultPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the AddOnResultPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - :param reference_sid: The SID of the recording to which the AddOnResult resource belongs - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultPage - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultPage - """ - super(AddOnResultPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AddOnResultInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultInstance - """ - return AddOnResultInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.add_on_result.payload import PayloadListInstance class AddOnResultContext(InstanceContext): - - def __init__(self, version, account_sid, reference_sid, sid): - """ - Initialize the AddOnResultContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param reference_sid: The SID of the recording to which the result to fetch belongs - :param sid: The unique string that identifies the resource to fetch - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultContext - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultContext - """ - super(AddOnResultContext, self).__init__(version) + def __init__(self, version: Version, account_sid: str, reference_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'reference_sid': reference_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/Recordings/{reference_sid}/AddOnResults/{sid}.json'.format(**self._solution) - - # Dependents + self._solution = { 'account_sid': account_sid, 'reference_sid': reference_sid, 'sid': sid, } + self._uri = '/Accounts/${account_sid}/Recordings/${reference_sid}/AddOnResults/${sid}.json' + self._payloads = None - - def fetch(self): - """ - Fetch the AddOnResultInstance - - :returns: The fetched AddOnResultInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AddOnResultInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the AddOnResultInstance @@ -246,210 +48,107 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def payloads(self): + + def fetch(self): + """ - Access the payloads + Fetch the AddOnResultInstance - :returns: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadList - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadList + :returns: The fetched AddOnResultInstance + #TODO: add rtype docs """ - if self._payloads is None: - self._payloads = PayloadList( - self._version, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - add_on_result_sid=self._solution['sid'], - ) - return self._payloads + payload = self._version.fetch(method='GET', uri=self._uri, ) + + return AddOnResultInstance(self._version, payload, account_sid=self._solution['account_sid'], reference_sid=self._solution['reference_sid'], sid=self._solution['sid'], ) + + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class AddOnResultInstance(InstanceResource): - class Status(object): - CANCELED = "canceled" - COMPLETED = "completed" - DELETED = "deleted" - FAILED = "failed" - IN_PROGRESS = "in-progress" - INIT = "init" - PROCESSING = "processing" - QUEUED = "queued" - def __init__(self, version, payload, account_sid, reference_sid, sid=None): - """ - Initialize the AddOnResultInstance - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultInstance - """ - super(AddOnResultInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'status': payload.get('status'), - 'add_on_sid': payload.get('add_on_sid'), - 'add_on_configuration_sid': payload.get('add_on_configuration_sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'date_completed': deserialize.rfc2822_datetime(payload.get('date_completed')), - 'reference_sid': payload.get('reference_sid'), - 'subresource_uris': payload.get('subresource_uris'), +class AddOnResultInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, reference_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'status' : payload.get('status'), + 'add_on_sid' : payload.get('add_on_sid'), + 'add_on_configuration_sid' : payload.get('add_on_configuration_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'date_completed' : payload.get('date_completed'), + 'reference_sid' : payload.get('reference_sid'), + 'subresource_uris' : payload.get('subresource_uris'), } - # Context self._context = None self._solution = { - 'account_sid': account_sid, - 'reference_sid': reference_sid, - 'sid': sid or self._properties['sid'], + 'account_sid': account_sid or self._properties['account_sid'],'reference_sid': reference_sid or self._properties['reference_sid'],'sid': sid or self._properties['sid'], } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AddOnResultContext for this AddOnResultInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultContext - """ if self._context is None: self._context = AddOnResultContext( self._version, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],reference_sid=self._solution['reference_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def status(self): - """ - :returns: The status of the result - :rtype: AddOnResultInstance.Status - """ - return self._properties['status'] - - @property - def add_on_sid(self): - """ - :returns: The SID of the Add-on to which the result belongs - :rtype: unicode - """ - return self._properties['add_on_sid'] - - @property - def add_on_configuration_sid(self): - """ - :returns: The SID of the Add-on configuration - :rtype: unicode - """ - return self._properties['add_on_configuration_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def date_completed(self): - """ - :returns: The date and time in GMT that the result was completed - :rtype: datetime - """ - return self._properties['date_completed'] - - @property - def reference_sid(self): - """ - :returns: The SID of the recording to which the AddOnResult resource belongs - :rtype: unicode - """ - return self._properties['reference_sid'] - - @property - def subresource_uris(self): - """ - :returns: A list of related resources identified by their relative URIs - :rtype: unicode - """ - return self._properties['subresource_uris'] + def payloads(self): + return self._proxy.payloads + - def fetch(self): + def __repr__(self): """ - Fetch the AddOnResultInstance - - :returns: The fetched AddOnResultInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the AddOnResultInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - @property - def payloads(self): - """ - Access the payloads +class AddOnResultListInstance(ListResource): + def __init__(self, version: Version, account_sid: str, reference_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadList - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadList - """ - return self._proxy.payloads + # Path Solution + self._solution = { 'account_sid': account_sid, 'reference_sid': reference_sid, } + self._uri = '/Accounts/${account_sid}/Recordings/${reference_sid}/AddOnResults.json' + + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AddOnResultPage(self._version, payload, account_sid=self._solution['account_sid'], reference_sid=self._solution['reference_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py b/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py deleted file mode 100644 index fa8a217c77..0000000000 --- a/twilio/rest/api/v2010/account/recording/add_on_result/payload/__init__.py +++ /dev/null @@ -1,442 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class PayloadList(ListResource): - - def __init__(self, version, account_sid, reference_sid, add_on_result_sid): - """ - Initialize the PayloadList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - :param reference_sid: The SID of the recording to which the AddOnResult resource that contains the payload belongs - :param add_on_result_sid: The SID of the AddOnResult to which the payload belongs - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadList - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadList - """ - super(PayloadList, self).__init__(version) - - # Path Solution - self._solution = { - 'account_sid': account_sid, - 'reference_sid': reference_sid, - 'add_on_result_sid': add_on_result_sid, - } - self._uri = '/Accounts/{account_sid}/Recordings/{reference_sid}/AddOnResults/{add_on_result_sid}/Payloads.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams PayloadInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists PayloadInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of PayloadInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of PayloadInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return PayloadPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of PayloadInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of PayloadInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return PayloadPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a PayloadContext - - :param sid: The unique string that identifies the resource to fetch - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadContext - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadContext - """ - return PayloadContext( - self._version, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - add_on_result_sid=self._solution['add_on_result_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a PayloadContext - - :param sid: The unique string that identifies the resource to fetch - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadContext - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadContext - """ - return PayloadContext( - self._version, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - add_on_result_sid=self._solution['add_on_result_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class PayloadPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the PayloadPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - :param reference_sid: The SID of the recording to which the AddOnResult resource that contains the payload belongs - :param add_on_result_sid: The SID of the AddOnResult to which the payload belongs - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadPage - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadPage - """ - super(PayloadPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of PayloadInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadInstance - """ - return PayloadInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - add_on_result_sid=self._solution['add_on_result_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class PayloadContext(InstanceContext): - - def __init__(self, version, account_sid, reference_sid, add_on_result_sid, sid): - """ - Initialize the PayloadContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param reference_sid: The SID of the recording to which the AddOnResult resource that contains the payload to fetch belongs - :param add_on_result_sid: The SID of the AddOnResult to which the payload to fetch belongs - :param sid: The unique string that identifies the resource to fetch - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadContext - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadContext - """ - super(PayloadContext, self).__init__(version) - - # Path Solution - self._solution = { - 'account_sid': account_sid, - 'reference_sid': reference_sid, - 'add_on_result_sid': add_on_result_sid, - 'sid': sid, - } - self._uri = '/Accounts/{account_sid}/Recordings/{reference_sid}/AddOnResults/{add_on_result_sid}/Payloads/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the PayloadInstance - - :returns: The fetched PayloadInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return PayloadInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - add_on_result_sid=self._solution['add_on_result_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the PayloadInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class PayloadInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, reference_sid, - add_on_result_sid, sid=None): - """ - Initialize the PayloadInstance - - :returns: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadInstance - """ - super(PayloadInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'add_on_result_sid': payload.get('add_on_result_sid'), - 'account_sid': payload.get('account_sid'), - 'label': payload.get('label'), - 'add_on_sid': payload.get('add_on_sid'), - 'add_on_configuration_sid': payload.get('add_on_configuration_sid'), - 'content_type': payload.get('content_type'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'reference_sid': payload.get('reference_sid'), - 'subresource_uris': payload.get('subresource_uris'), - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'reference_sid': reference_sid, - 'add_on_result_sid': add_on_result_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PayloadContext for this PayloadInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadContext - """ - if self._context is None: - self._context = PayloadContext( - self._version, - account_sid=self._solution['account_sid'], - reference_sid=self._solution['reference_sid'], - add_on_result_sid=self._solution['add_on_result_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def add_on_result_sid(self): - """ - :returns: The SID of the AddOnResult to which the payload belongs - :rtype: unicode - """ - return self._properties['add_on_result_sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def label(self): - """ - :returns: The string that describes the payload - :rtype: unicode - """ - return self._properties['label'] - - @property - def add_on_sid(self): - """ - :returns: The SID of the Add-on to which the result belongs - :rtype: unicode - """ - return self._properties['add_on_sid'] - - @property - def add_on_configuration_sid(self): - """ - :returns: The SID of the Add-on configuration - :rtype: unicode - """ - return self._properties['add_on_configuration_sid'] - - @property - def content_type(self): - """ - :returns: The MIME type of the payload - :rtype: unicode - """ - return self._properties['content_type'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def reference_sid(self): - """ - :returns: The SID of the recording to which the AddOnResult resource that contains the payload belongs - :rtype: unicode - """ - return self._properties['reference_sid'] - - @property - def subresource_uris(self): - """ - :returns: A list of related resources identified by their relative URIs - :rtype: unicode - """ - return self._properties['subresource_uris'] - - def fetch(self): - """ - Fetch the PayloadInstance - - :returns: The fetched PayloadInstance - :rtype: twilio.rest.api.v2010.account.recording.add_on_result.payload.PayloadInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the PayloadInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) diff --git a/twilio/rest/api/v2010/account/sip.py b/twilio/rest/api/v2010/account/sip.py deleted file mode 100644 index 67840a0d65..0000000000 --- a/twilio/rest/api/v2010/account/sip.py +++ /dev/null @@ -1,50 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Api - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.rest.sip.credential_list import CredentialListListInstancefrom twilio.rest.sip.domain import DomainListInstancefrom twilio.rest.sip.ip_access_control_list import IpAccessControlListListInstance - - - - -class SipListInstance(ListResource): - def __init__(self, version: Version, account_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, } - self._uri = '/Accounts/${account_sid}/SIP.json' - - self._credential_lists = None - self._domains = None - self._ip_access_control_lists = None - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/api/v2010/account/sip/__init__.py b/twilio/rest/api/v2010/account/sip/__init__.py index b829ae85dd..67840a0d65 100644 --- a/twilio/rest/api/v2010/account/sip/__init__.py +++ b/twilio/rest/api/v2010/account/sip/__init__.py @@ -1,153 +1,50 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Api + 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 twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.sip.credential_list import CredentialListList -from twilio.rest.api.v2010.account.sip.domain import DomainList -from twilio.rest.api.v2010.account.sip.ip_access_control_list import IpAccessControlListList +from twilio.base.version import Version +# from twilio.rest.sip.credential_list import CredentialListListInstancefrom twilio.rest.sip.domain import DomainListInstancefrom twilio.rest.sip.ip_access_control_list import IpAccessControlListListInstance -class SipList(ListResource): - def __init__(self, version, account_sid): - """ - Initialize the SipList - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - :returns: twilio.rest.api.v2010.account.sip.SipList - :rtype: twilio.rest.api.v2010.account.sip.SipList - """ - super(SipList, self).__init__(version) +class SipListInstance(ListResource): + def __init__(self, version: Version, account_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, } - - # Components + self._solution = { 'account_sid': account_sid, } + self._uri = '/Accounts/${account_sid}/SIP.json' + + self._credential_lists = None self._domains = None - self._regions = None self._ip_access_control_lists = None - self._credential_lists = None - - @property - def domains(self): - """ - Access the domains - - :returns: twilio.rest.api.v2010.account.sip.domain.DomainList - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainList - """ - if self._domains is None: - self._domains = DomainList(self._version, account_sid=self._solution['account_sid'], ) - return self._domains - - @property - def ip_access_control_lists(self): - """ - Access the ip_access_control_lists - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListList - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListList - """ - if self._ip_access_control_lists is None: - self._ip_access_control_lists = IpAccessControlListList( - self._version, - account_sid=self._solution['account_sid'], - ) - return self._ip_access_control_lists - - @property - def credential_lists(self): - """ - Access the credential_lists - - :returns: twilio.rest.api.v2010.account.sip.credential_list.CredentialListList - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListList - """ - if self._credential_lists is None: - self._credential_lists = CredentialListList( - self._version, - account_sid=self._solution['account_sid'], - ) - return self._credential_lists - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SipPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SipPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.sip.SipPage - :rtype: twilio.rest.api.v2010.account.sip.SipPage - """ - super(SipPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SipInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.SipInstance - :rtype: twilio.rest.api.v2010.account.sip.SipInstance - """ - return SipInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + return '' - -class SipInstance(InstanceResource): - - def __init__(self, version, payload, account_sid): - """ - Initialize the SipInstance - - :returns: twilio.rest.api.v2010.account.sip.SipInstance - :rtype: twilio.rest.api.v2010.account.sip.SipInstance - """ - super(SipInstance, self).__init__(version) - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/sip/credential_list.py b/twilio/rest/api/v2010/account/sip/credential_list.py deleted file mode 100644 index 7b917a585b..0000000000 --- a/twilio/rest/api/v2010/account/sip/credential_list.py +++ /dev/null @@ -1,176 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Api - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.credential_list.credential import CredentialListInstance - - -class CredentialListContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/${account_sid}/SIP/CredentialLists/${sid}.json' - - self._credentials = None - - def delete(self): - - - - """ - Deletes the CredentialListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the CredentialListInstance - - :returns: The fetched CredentialListInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CredentialListInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return CredentialListInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class CredentialListInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'friendly_name' : payload.get('friendly_name'), - 'sid' : payload.get('sid'), - 'subresource_uris' : payload.get('subresource_uris'), - 'uri' : payload.get('uri'), - } - - self._context = None - self._solution = { - 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = CredentialListContext( - self._version, - account_sid=self._solution['account_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def credentials(self): - return self._proxy.credentials - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class CredentialListListInstance(ListResource): - def __init__(self, version: Version, account_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, } - self._uri = '/Accounts/${account_sid}/SIP/CredentialLists.json' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return CredentialListInstance(self._version, payload, account_sid=self._solution['account_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return CredentialListPage(self._version, payload, account_sid=self._solution['account_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/api/v2010/account/sip/credential_list/__init__.py b/twilio/rest/api/v2010/account/sip/credential_list/__init__.py index f83dfec088..7b917a585b 100644 --- a/twilio/rest/api/v2010/account/sip/credential_list/__init__.py +++ b/twilio/rest/api/v2010/account/sip/credential_list/__init__.py @@ -1,439 +1,176 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.sip.credential_list.credential import CredentialList - - -class CredentialListList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the CredentialListList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.sip.credential_list.CredentialListList - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListList - """ - super(CredentialListList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/SIP/CredentialLists.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams CredentialListInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists CredentialListInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CredentialListInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CredentialListPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CredentialListInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CredentialListPage(self._version, response, self._solution) - - def create(self, friendly_name): - """ - Create the CredentialListInstance - - :param unicode friendly_name: Human readable descriptive text - - :returns: The created CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return CredentialListInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def get(self, sid): - """ - Constructs a CredentialListContext - - :param sid: Fetch by unique credential list Sid - - :returns: twilio.rest.api.v2010.account.sip.credential_list.CredentialListContext - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListContext - """ - return CredentialListContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CredentialListContext - - :param sid: Fetch by unique credential list Sid - - :returns: twilio.rest.api.v2010.account.sip.credential_list.CredentialListContext - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListContext - """ - return CredentialListContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) +from twilio.base.version import Version - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CredentialListPage(Page): +from twilio.base.page import Page - def __init__(self, version, response, solution): - """ - Initialize the CredentialListPage +# from twilio.rest.credential_list.credential import CredentialListInstance - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - :returns: twilio.rest.api.v2010.account.sip.credential_list.CredentialListPage - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListPage - """ - super(CredentialListPage, self).__init__(version, response) +class CredentialListContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CredentialListInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance - """ - return CredentialListInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CredentialListContext(InstanceContext): + self._solution = { 'account_sid': account_sid, 'sid': sid, } + self._uri = '/Accounts/${account_sid}/SIP/CredentialLists/${sid}.json' + + self._credentials = None + + def delete(self): + + - def __init__(self, version, account_sid, sid): """ - Initialize the CredentialListContext - - :param Version version: Version that contains the resource - :param account_sid: The unique id of the Account that is responsible for this resource. - :param sid: Fetch by unique credential list Sid + Deletes the CredentialListInstance - :returns: twilio.rest.api.v2010.account.sip.credential_list.CredentialListContext - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListContext + :returns: True if delete succeeds, False otherwise + :rtype: bool """ - super(CredentialListContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/SIP/CredentialLists/{sid}.json'.format(**self._solution) - - # Dependents - self._credentials = None - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the CredentialListInstance :returns: The fetched CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return CredentialListInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name): - """ - Update the CredentialListInstance - - :param unicode friendly_name: Human readable descriptive text + return CredentialListInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + - :returns: The updated CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance - """ - data = values.of({'FriendlyName': friendly_name, }) + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return CredentialListInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) + return CredentialListInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + - def delete(self): - """ - Deletes the CredentialListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def credentials(self): - """ - Access the credentials - - :returns: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialList - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialList - """ - if self._credentials is None: - self._credentials = CredentialList( - self._version, - account_sid=self._solution['account_sid'], - credential_list_sid=self._solution['sid'], - ) - return self._credentials + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class CredentialListInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the CredentialListInstance - :returns: twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance - """ - super(CredentialListInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'sid': payload.get('sid'), - 'subresource_uris': payload.get('subresource_uris'), - 'uri': payload.get('uri'), +class CredentialListInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'friendly_name' : payload.get('friendly_name'), + 'sid' : payload.get('sid'), + 'subresource_uris' : payload.get('subresource_uris'), + 'uri' : payload.get('uri'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CredentialListContext for this CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListContext - """ if self._context is None: self._context = CredentialListContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: Human readable descriptive text - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this credential - :rtype: unicode - """ - return self._properties['sid'] - - @property - def subresource_uris(self): - """ - :returns: The list of credentials associated with this credential list. - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch the CredentialListInstance - - :returns: The fetched CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance - """ - return self._proxy.fetch() + def credentials(self): + return self._proxy.credentials + - def update(self, friendly_name): + def __repr__(self): """ - Update the CredentialListInstance - - :param unicode friendly_name: Human readable descriptive text - - :returns: The updated CredentialListInstance - :rtype: twilio.rest.api.v2010.account.sip.credential_list.CredentialListInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update(friendly_name, ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the CredentialListInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - @property - def credentials(self): - """ - Access the credentials +class CredentialListListInstance(ListResource): + def __init__(self, version: Version, account_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialList - :rtype: twilio.rest.api.v2010.account.sip.credential_list.credential.CredentialList - """ - return self._proxy.credentials + # Path Solution + self._solution = { 'account_sid': account_sid, } + self._uri = '/Accounts/${account_sid}/SIP/CredentialLists.json' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return CredentialListInstance(self._version, payload, account_sid=self._solution['account_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return CredentialListPage(self._version, payload, account_sid=self._solution['account_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/sip/domain.py b/twilio/rest/api/v2010/account/sip/domain.py deleted file mode 100644 index eaff551a2d..0000000000 --- a/twilio/rest/api/v2010/account/sip/domain.py +++ /dev/null @@ -1,198 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Api - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.domain.auth_types import AuthTypesListInstancefrom twilio.rest.domain.credential_list_mapping import CredentialListMappingListInstancefrom twilio.rest.domain.ip_access_control_list_mapping import IpAccessControlListMappingListInstance - - -class DomainContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/${account_sid}/SIP/Domains/${sid}.json' - - self._auth = None - self._credential_list_mappings = None - self._ip_access_control_list_mappings = None - - def delete(self): - - - - """ - Deletes the DomainInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the DomainInstance - - :returns: The fetched DomainInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DomainInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return DomainInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class DomainInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'api_version' : payload.get('api_version'), - 'auth_type' : payload.get('auth_type'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'domain_name' : payload.get('domain_name'), - 'friendly_name' : payload.get('friendly_name'), - 'sid' : payload.get('sid'), - 'uri' : payload.get('uri'), - 'voice_fallback_method' : payload.get('voice_fallback_method'), - 'voice_fallback_url' : payload.get('voice_fallback_url'), - 'voice_method' : payload.get('voice_method'), - 'voice_status_callback_method' : payload.get('voice_status_callback_method'), - 'voice_status_callback_url' : payload.get('voice_status_callback_url'), - 'voice_url' : payload.get('voice_url'), - 'subresource_uris' : payload.get('subresource_uris'), - 'sip_registration' : payload.get('sip_registration'), - 'emergency_calling_enabled' : payload.get('emergency_calling_enabled'), - 'secure' : payload.get('secure'), - 'byoc_trunk_sid' : payload.get('byoc_trunk_sid'), - 'emergency_caller_sid' : payload.get('emergency_caller_sid'), - } - - self._context = None - self._solution = { - 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = DomainContext( - self._version, - account_sid=self._solution['account_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def auth(self): - return self._proxy.auth - @property - def credential_list_mappings(self): - return self._proxy.credential_list_mappings - @property - def ip_access_control_list_mappings(self): - return self._proxy.ip_access_control_list_mappings - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class DomainListInstance(ListResource): - def __init__(self, version: Version, account_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, } - self._uri = '/Accounts/${account_sid}/SIP/Domains.json' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return DomainInstance(self._version, payload, account_sid=self._solution['account_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return DomainPage(self._version, payload, account_sid=self._solution['account_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/api/v2010/account/sip/domain/__init__.py b/twilio/rest/api/v2010/account/sip/domain/__init__.py index 265267e1b1..eaff551a2d 100644 --- a/twilio/rest/api/v2010/account/sip/domain/__init__.py +++ b/twilio/rest/api/v2010/account/sip/domain/__init__.py @@ -1,329 +1,48 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.sip.domain.auth_types import AuthTypesList -from twilio.rest.api.v2010.account.sip.domain.credential_list_mapping import CredentialListMappingList -from twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping import IpAccessControlListMappingList - - -class DomainList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the DomainList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.sip.domain.DomainList - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainList - """ - super(DomainList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/SIP/Domains.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams DomainInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.sip.domain.DomainInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DomainInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.domain.DomainInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DomainInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return DomainPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DomainInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DomainPage(self._version, response, self._solution) - - def create(self, domain_name, friendly_name=values.unset, - voice_url=values.unset, voice_method=values.unset, - voice_fallback_url=values.unset, voice_fallback_method=values.unset, - voice_status_callback_url=values.unset, - voice_status_callback_method=values.unset, - sip_registration=values.unset, - emergency_calling_enabled=values.unset, secure=values.unset, - byoc_trunk_sid=values.unset, emergency_caller_sid=values.unset): - """ - Create the DomainInstance - - :param unicode domain_name: The unique address on Twilio to route SIP traffic - :param unicode friendly_name: A string to describe the resource - :param unicode voice_url: The URL we should call when receiving a call - :param unicode voice_method: The HTTP method to use with voice_url - :param unicode voice_fallback_url: The URL we should call when an error occurs in executing TwiML - :param unicode voice_fallback_method: The HTTP method to use with voice_fallback_url - :param unicode voice_status_callback_url: The URL that we should call to pass status updates - :param unicode voice_status_callback_method: The HTTP method we should use to call `voice_status_callback_url` - :param bool sip_registration: Whether SIP registration is allowed - :param bool emergency_calling_enabled: Whether emergency calling is enabled for the domain. - :param bool secure: Whether secure SIP is enabled for the domain - :param unicode byoc_trunk_sid: The SID of the BYOC Trunk resource. - :param unicode emergency_caller_sid: Whether an emergency caller sid is configured for the domain. - - :returns: The created DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainInstance - """ - data = values.of({ - 'DomainName': domain_name, - 'FriendlyName': friendly_name, - 'VoiceUrl': voice_url, - 'VoiceMethod': voice_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceFallbackMethod': voice_fallback_method, - 'VoiceStatusCallbackUrl': voice_status_callback_url, - 'VoiceStatusCallbackMethod': voice_status_callback_method, - 'SipRegistration': sip_registration, - 'EmergencyCallingEnabled': emergency_calling_enabled, - 'Secure': secure, - 'ByocTrunkSid': byoc_trunk_sid, - 'EmergencyCallerSid': emergency_caller_sid, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return DomainInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def get(self, sid): - """ - Constructs a DomainContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.DomainContext - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainContext - """ - return DomainContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a DomainContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.DomainContext - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainContext - """ - return DomainContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class DomainPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the DomainPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.sip.domain.DomainPage - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainPage - """ - super(DomainPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DomainInstance +from twilio.base.version import Version - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.api.v2010.account.sip.domain.DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainInstance - """ - return DomainInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.domain.auth_types import AuthTypesListInstancefrom twilio.rest.domain.credential_list_mapping import CredentialListMappingListInstancefrom twilio.rest.domain.ip_access_control_list_mapping import IpAccessControlListMappingListInstance class DomainContext(InstanceContext): - - def __init__(self, version, account_sid, sid): - """ - Initialize the DomainContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.DomainContext - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainContext - """ - super(DomainContext, self).__init__(version) + def __init__(self, version: Version, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/SIP/Domains/{sid}.json'.format(**self._solution) - - # Dependents - self._ip_access_control_list_mappings = None - self._credential_list_mappings = None + self._solution = { 'account_sid': account_sid, 'sid': sid, } + self._uri = '/Accounts/${account_sid}/SIP/Domains/${sid}.json' + self._auth = None - - def fetch(self): - """ - Fetch the DomainInstance - - :returns: The fetched DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DomainInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset, voice_fallback_method=values.unset, - voice_fallback_url=values.unset, voice_method=values.unset, - voice_status_callback_method=values.unset, - voice_status_callback_url=values.unset, voice_url=values.unset, - sip_registration=values.unset, domain_name=values.unset, - emergency_calling_enabled=values.unset, secure=values.unset, - byoc_trunk_sid=values.unset, emergency_caller_sid=values.unset): - """ - Update the DomainInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode voice_fallback_method: The HTTP method used with voice_fallback_url - :param unicode voice_fallback_url: The URL we should call when an error occurs in executing TwiML - :param unicode voice_method: The HTTP method we should use with voice_url - :param unicode voice_status_callback_method: The HTTP method we should use to call voice_status_callback_url - :param unicode voice_status_callback_url: The URL that we should call to pass status updates - :param unicode voice_url: The URL we should call when receiving a call - :param bool sip_registration: Whether SIP registration is allowed - :param unicode domain_name: The unique address on Twilio to route SIP traffic - :param bool emergency_calling_enabled: Whether emergency calling is enabled for the domain. - :param bool secure: Whether secure SIP is enabled for the domain - :param unicode byoc_trunk_sid: The SID of the BYOC Trunk resource. - :param unicode emergency_caller_sid: Whether an emergency caller sid is configured for the domain. - - :returns: The updated DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'VoiceFallbackMethod': voice_fallback_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceMethod': voice_method, - 'VoiceStatusCallbackMethod': voice_status_callback_method, - 'VoiceStatusCallbackUrl': voice_status_callback_url, - 'VoiceUrl': voice_url, - 'SipRegistration': sip_registration, - 'DomainName': domain_name, - 'EmergencyCallingEnabled': emergency_calling_enabled, - 'Secure': secure, - 'ByocTrunkSid': byoc_trunk_sid, - 'EmergencyCallerSid': emergency_caller_sid, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return DomainInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - + self._credential_list_mappings = None + self._ip_access_control_list_mappings = None + def delete(self): + + + """ Deletes the DomainInstance @@ -331,388 +50,149 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def ip_access_control_list_mappings(self): + + def fetch(self): + """ - Access the ip_access_control_list_mappings + Fetch the DomainInstance - :returns: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingList - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingList + :returns: The fetched DomainInstance + #TODO: add rtype docs """ - if self._ip_access_control_list_mappings is None: - self._ip_access_control_list_mappings = IpAccessControlListMappingList( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['sid'], - ) - return self._ip_access_control_list_mappings + payload = self._version.fetch(method='GET', uri=self._uri, ) - @property - def credential_list_mappings(self): - """ - Access the credential_list_mappings + return DomainInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + - :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingList - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingList - """ - if self._credential_list_mappings is None: - self._credential_list_mappings = CredentialListMappingList( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['sid'], - ) - return self._credential_list_mappings + + + def update(self, body): + data = values.of({ + 'body': body, + }) - @property - def auth(self): - """ - Access the auth + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.AuthTypesList - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.AuthTypesList - """ - if self._auth is None: - self._auth = AuthTypesList( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['sid'], - ) - return self._auth + return DomainInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class DomainInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the DomainInstance - :returns: twilio.rest.api.v2010.account.sip.domain.DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainInstance - """ - super(DomainInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'auth_type': payload.get('auth_type'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'domain_name': payload.get('domain_name'), - 'friendly_name': payload.get('friendly_name'), - 'sid': payload.get('sid'), - 'uri': payload.get('uri'), - 'voice_fallback_method': payload.get('voice_fallback_method'), - 'voice_fallback_url': payload.get('voice_fallback_url'), - 'voice_method': payload.get('voice_method'), - 'voice_status_callback_method': payload.get('voice_status_callback_method'), - 'voice_status_callback_url': payload.get('voice_status_callback_url'), - 'voice_url': payload.get('voice_url'), - 'subresource_uris': payload.get('subresource_uris'), - 'sip_registration': payload.get('sip_registration'), - 'emergency_calling_enabled': payload.get('emergency_calling_enabled'), - 'secure': payload.get('secure'), - 'byoc_trunk_sid': payload.get('byoc_trunk_sid'), - 'emergency_caller_sid': payload.get('emergency_caller_sid'), +class DomainInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'api_version' : payload.get('api_version'), + 'auth_type' : payload.get('auth_type'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'domain_name' : payload.get('domain_name'), + 'friendly_name' : payload.get('friendly_name'), + 'sid' : payload.get('sid'), + 'uri' : payload.get('uri'), + 'voice_fallback_method' : payload.get('voice_fallback_method'), + 'voice_fallback_url' : payload.get('voice_fallback_url'), + 'voice_method' : payload.get('voice_method'), + 'voice_status_callback_method' : payload.get('voice_status_callback_method'), + 'voice_status_callback_url' : payload.get('voice_status_callback_url'), + 'voice_url' : payload.get('voice_url'), + 'subresource_uris' : payload.get('subresource_uris'), + 'sip_registration' : payload.get('sip_registration'), + 'emergency_calling_enabled' : payload.get('emergency_calling_enabled'), + 'secure' : payload.get('secure'), + 'byoc_trunk_sid' : payload.get('byoc_trunk_sid'), + 'emergency_caller_sid' : payload.get('emergency_caller_sid'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DomainContext for this DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainContext - """ if self._context is None: self._context = DomainContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The API version used to process the call - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def auth_type(self): - """ - :returns: The types of authentication mapped to the domain - :rtype: unicode - """ - return self._properties['auth_type'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def domain_name(self): - """ - :returns: The unique address on Twilio to route SIP traffic - :rtype: unicode - """ - return self._properties['domain_name'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def voice_fallback_method(self): - """ - :returns: The HTTP method used with voice_fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: The URL we call when an error occurs while executing TwiML - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_method(self): - """ - :returns: The HTTP method to use with voice_url - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_status_callback_method(self): - """ - :returns: The HTTP method we use to call voice_status_callback_url - :rtype: unicode - """ - return self._properties['voice_status_callback_method'] - - @property - def voice_status_callback_url(self): - """ - :returns: The URL that we call with status updates - :rtype: unicode - """ - return self._properties['voice_status_callback_url'] - - @property - def voice_url(self): - """ - :returns: The URL we call when receiving a call - :rtype: unicode - """ - return self._properties['voice_url'] - - @property - def subresource_uris(self): - """ - :returns: A list mapping resources associated with the SIP Domain resource - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def sip_registration(self): - """ - :returns: Whether SIP registration is allowed - :rtype: bool - """ - return self._properties['sip_registration'] - - @property - def emergency_calling_enabled(self): - """ - :returns: Whether emergency calling is enabled for the domain. - :rtype: bool - """ - return self._properties['emergency_calling_enabled'] - - @property - def secure(self): - """ - :returns: Whether secure SIP is enabled for the domain - :rtype: bool - """ - return self._properties['secure'] - + def auth(self): + return self._proxy.auth @property - def byoc_trunk_sid(self): - """ - :returns: The SID of the BYOC Trunk resource. - :rtype: unicode - """ - return self._properties['byoc_trunk_sid'] - + def credential_list_mappings(self): + return self._proxy.credential_list_mappings @property - def emergency_caller_sid(self): - """ - :returns: Whether an emergency caller sid is configured for the domain. - :rtype: unicode - """ - return self._properties['emergency_caller_sid'] - - def fetch(self): - """ - Fetch the DomainInstance + def ip_access_control_list_mappings(self): + return self._proxy.ip_access_control_list_mappings + - :returns: The fetched DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, voice_fallback_method=values.unset, - voice_fallback_url=values.unset, voice_method=values.unset, - voice_status_callback_method=values.unset, - voice_status_callback_url=values.unset, voice_url=values.unset, - sip_registration=values.unset, domain_name=values.unset, - emergency_calling_enabled=values.unset, secure=values.unset, - byoc_trunk_sid=values.unset, emergency_caller_sid=values.unset): + def __repr__(self): """ - Update the DomainInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode voice_fallback_method: The HTTP method used with voice_fallback_url - :param unicode voice_fallback_url: The URL we should call when an error occurs in executing TwiML - :param unicode voice_method: The HTTP method we should use with voice_url - :param unicode voice_status_callback_method: The HTTP method we should use to call voice_status_callback_url - :param unicode voice_status_callback_url: The URL that we should call to pass status updates - :param unicode voice_url: The URL we should call when receiving a call - :param bool sip_registration: Whether SIP registration is allowed - :param unicode domain_name: The unique address on Twilio to route SIP traffic - :param bool emergency_calling_enabled: Whether emergency calling is enabled for the domain. - :param bool secure: Whether secure SIP is enabled for the domain - :param unicode byoc_trunk_sid: The SID of the BYOC Trunk resource. - :param unicode emergency_caller_sid: Whether an emergency caller sid is configured for the domain. - - :returns: The updated DomainInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.DomainInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update( - friendly_name=friendly_name, - voice_fallback_method=voice_fallback_method, - voice_fallback_url=voice_fallback_url, - voice_method=voice_method, - voice_status_callback_method=voice_status_callback_method, - voice_status_callback_url=voice_status_callback_url, - voice_url=voice_url, - sip_registration=sip_registration, - domain_name=domain_name, - emergency_calling_enabled=emergency_calling_enabled, - secure=secure, - byoc_trunk_sid=byoc_trunk_sid, - emergency_caller_sid=emergency_caller_sid, - ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the DomainInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - @property - def ip_access_control_list_mappings(self): - """ - Access the ip_access_control_list_mappings +class DomainListInstance(ListResource): + def __init__(self, version: Version, account_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingList - :rtype: twilio.rest.api.v2010.account.sip.domain.ip_access_control_list_mapping.IpAccessControlListMappingList - """ - return self._proxy.ip_access_control_list_mappings + # Path Solution + self._solution = { 'account_sid': account_sid, } + self._uri = '/Accounts/${account_sid}/SIP/Domains.json' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def credential_list_mappings(self): - """ - Access the credential_list_mappings + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingList - :rtype: twilio.rest.api.v2010.account.sip.domain.credential_list_mapping.CredentialListMappingList - """ - return self._proxy.credential_list_mappings + return DomainInstance(self._version, payload, account_sid=self._solution['account_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def auth(self): - """ - Access the auth + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.AuthTypesList - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.AuthTypesList - """ - return self._proxy.auth + return DomainPage(self._version, payload, account_sid=self._solution['account_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types.py b/twilio/rest/api/v2010/account/sip/domain/auth_types.py deleted file mode 100644 index dec31d930b..0000000000 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types.py +++ /dev/null @@ -1,49 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Api - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.rest.auth_types.auth_type_calls import AuthTypeCallsListInstancefrom twilio.rest.auth_types.auth_type_registrations import AuthTypeRegistrationsListInstance - - - - -class AuthTypesListInstance(ListResource): - def __init__(self, version: Version, account_sid: str, domain_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, 'domain_sid': domain_sid, } - self._uri = '/Accounts/${account_sid}/SIP/Domains/${domain_sid}/Auth.json' - - self._calls = None - self._registrations = None - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/__init__.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/__init__.py index d3944c8c66..dec31d930b 100644 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/__init__.py +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/__init__.py @@ -1,147 +1,49 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Api + 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 twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping import AuthTypeCallsList -from twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping import AuthTypeRegistrationsList +from twilio.base.version import Version +# from twilio.rest.auth_types.auth_type_calls import AuthTypeCallsListInstancefrom twilio.rest.auth_types.auth_type_registrations import AuthTypeRegistrationsListInstance -class AuthTypesList(ListResource): - def __init__(self, version, account_sid, domain_sid): - """ - Initialize the AuthTypesList - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - :param domain_sid: The unique string that identifies the resource - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.AuthTypesList - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.AuthTypesList - """ - super(AuthTypesList, self).__init__(version) +class AuthTypesListInstance(ListResource): + def __init__(self, version: Version, account_sid: str, domain_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, } - - # Components + self._solution = { 'account_sid': account_sid, 'domain_sid': domain_sid, } + self._uri = '/Accounts/${account_sid}/SIP/Domains/${domain_sid}/Auth.json' + self._calls = None self._registrations = None - - @property - def calls(self): - """ - Access the calls - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.AuthTypeCallsList - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.AuthTypeCallsList - """ - if self._calls is None: - self._calls = AuthTypeCallsList( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) - return self._calls - - @property - def registrations(self): - """ - Access the registrations - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.AuthTypeRegistrationsList - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.AuthTypeRegistrationsList - """ - if self._registrations is None: - self._registrations = AuthTypeRegistrationsList( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) - return self._registrations - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AuthTypesPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the AuthTypesPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - :param domain_sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.AuthTypesPage - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.AuthTypesPage - """ - super(AuthTypesPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AuthTypesInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.AuthTypesInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.AuthTypesInstance - """ - return AuthTypesInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class AuthTypesInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, domain_sid): - """ - Initialize the AuthTypesInstance + return '' - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.AuthTypesInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.AuthTypesInstance - """ - super(AuthTypesInstance, self).__init__(version) - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, } - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping/__init__.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping/__init__.py deleted file mode 100644 index 7a48723e14..0000000000 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping/__init__.py +++ /dev/null @@ -1,147 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping import AuthCallsCredentialListMappingList -from twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping import AuthCallsIpAccessControlListMappingList - - -class AuthTypeCallsList(ListResource): - - def __init__(self, version, account_sid, domain_sid): - """ - Initialize the AuthTypeCallsList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - :param domain_sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.AuthTypeCallsList - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.AuthTypeCallsList - """ - super(AuthTypeCallsList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, } - - # Components - self._credential_list_mappings = None - self._ip_access_control_list_mappings = None - - @property - def credential_list_mappings(self): - """ - Access the credential_list_mappings - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingList - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingList - """ - if self._credential_list_mappings is None: - self._credential_list_mappings = AuthCallsCredentialListMappingList( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) - return self._credential_list_mappings - - @property - def ip_access_control_list_mappings(self): - """ - Access the ip_access_control_list_mappings - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingList - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingList - """ - if self._ip_access_control_list_mappings is None: - self._ip_access_control_list_mappings = AuthCallsIpAccessControlListMappingList( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) - return self._ip_access_control_list_mappings - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AuthTypeCallsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the AuthTypeCallsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - :param domain_sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.AuthTypeCallsPage - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.AuthTypeCallsPage - """ - super(AuthTypeCallsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AuthTypeCallsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.AuthTypeCallsInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.AuthTypeCallsInstance - """ - return AuthTypeCallsInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AuthTypeCallsInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, domain_sid): - """ - Initialize the AuthTypeCallsInstance - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.AuthTypeCallsInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.AuthTypeCallsInstance - """ - super(AuthTypeCallsInstance, self).__init__(version) - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, } - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping/auth_calls_credential_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping/auth_calls_credential_list_mapping.py deleted file mode 100644 index 60c3c292ce..0000000000 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping/auth_calls_credential_list_mapping.py +++ /dev/null @@ -1,389 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AuthCallsCredentialListMappingList(ListResource): - - def __init__(self, version, account_sid, domain_sid): - """ - Initialize the AuthCallsCredentialListMappingList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - :param domain_sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingList - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingList - """ - super(AuthCallsCredentialListMappingList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, } - self._uri = '/Accounts/{account_sid}/SIP/Domains/{domain_sid}/Auth/Calls/CredentialListMappings.json'.format(**self._solution) - - def create(self, credential_list_sid): - """ - Create the AuthCallsCredentialListMappingInstance - - :param unicode credential_list_sid: The SID of the CredentialList resource to map to the SIP domain - - :returns: The created AuthCallsCredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingInstance - """ - data = values.of({'CredentialListSid': credential_list_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return AuthCallsCredentialListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams AuthCallsCredentialListMappingInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AuthCallsCredentialListMappingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AuthCallsCredentialListMappingInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AuthCallsCredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AuthCallsCredentialListMappingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AuthCallsCredentialListMappingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AuthCallsCredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AuthCallsCredentialListMappingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AuthCallsCredentialListMappingContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingContext - """ - return AuthCallsCredentialListMappingContext( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a AuthCallsCredentialListMappingContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingContext - """ - return AuthCallsCredentialListMappingContext( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AuthCallsCredentialListMappingPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the AuthCallsCredentialListMappingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - :param domain_sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingPage - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingPage - """ - super(AuthCallsCredentialListMappingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AuthCallsCredentialListMappingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingInstance - """ - return AuthCallsCredentialListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AuthCallsCredentialListMappingContext(InstanceContext): - - def __init__(self, version, account_sid, domain_sid, sid): - """ - Initialize the AuthCallsCredentialListMappingContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param domain_sid: The SID of the SIP domain that contains the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingContext - """ - super(AuthCallsCredentialListMappingContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/SIP/Domains/{domain_sid}/Auth/Calls/CredentialListMappings/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the AuthCallsCredentialListMappingInstance - - :returns: The fetched AuthCallsCredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AuthCallsCredentialListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the AuthCallsCredentialListMappingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class AuthCallsCredentialListMappingInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, domain_sid, sid=None): - """ - Initialize the AuthCallsCredentialListMappingInstance - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingInstance - """ - super(AuthCallsCredentialListMappingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'sid': payload.get('sid'), - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'domain_sid': domain_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AuthCallsCredentialListMappingContext for this AuthCallsCredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingContext - """ - if self._context is None: - self._context = AuthCallsCredentialListMappingContext( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - def fetch(self): - """ - Fetch the AuthCallsCredentialListMappingInstance - - :returns: The fetched AuthCallsCredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the AuthCallsCredentialListMappingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping/auth_calls_ip_access_control_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping/auth_calls_ip_access_control_list_mapping.py deleted file mode 100644 index 69ae91e0f9..0000000000 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_calls_mapping/auth_calls_ip_access_control_list_mapping.py +++ /dev/null @@ -1,389 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AuthCallsIpAccessControlListMappingList(ListResource): - - def __init__(self, version, account_sid, domain_sid): - """ - Initialize the AuthCallsIpAccessControlListMappingList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - :param domain_sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingList - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingList - """ - super(AuthCallsIpAccessControlListMappingList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, } - self._uri = '/Accounts/{account_sid}/SIP/Domains/{domain_sid}/Auth/Calls/IpAccessControlListMappings.json'.format(**self._solution) - - def create(self, ip_access_control_list_sid): - """ - Create the AuthCallsIpAccessControlListMappingInstance - - :param unicode ip_access_control_list_sid: The SID of the IpAccessControlList resource to map to the SIP domain - - :returns: The created AuthCallsIpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingInstance - """ - data = values.of({'IpAccessControlListSid': ip_access_control_list_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return AuthCallsIpAccessControlListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams AuthCallsIpAccessControlListMappingInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AuthCallsIpAccessControlListMappingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AuthCallsIpAccessControlListMappingInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AuthCallsIpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AuthCallsIpAccessControlListMappingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AuthCallsIpAccessControlListMappingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AuthCallsIpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AuthCallsIpAccessControlListMappingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AuthCallsIpAccessControlListMappingContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingContext - """ - return AuthCallsIpAccessControlListMappingContext( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a AuthCallsIpAccessControlListMappingContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingContext - """ - return AuthCallsIpAccessControlListMappingContext( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AuthCallsIpAccessControlListMappingPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the AuthCallsIpAccessControlListMappingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - :param domain_sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingPage - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingPage - """ - super(AuthCallsIpAccessControlListMappingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AuthCallsIpAccessControlListMappingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingInstance - """ - return AuthCallsIpAccessControlListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AuthCallsIpAccessControlListMappingContext(InstanceContext): - - def __init__(self, version, account_sid, domain_sid, sid): - """ - Initialize the AuthCallsIpAccessControlListMappingContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param domain_sid: The SID of the SIP domain that contains the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingContext - """ - super(AuthCallsIpAccessControlListMappingContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/SIP/Domains/{domain_sid}/Auth/Calls/IpAccessControlListMappings/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the AuthCallsIpAccessControlListMappingInstance - - :returns: The fetched AuthCallsIpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AuthCallsIpAccessControlListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the AuthCallsIpAccessControlListMappingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class AuthCallsIpAccessControlListMappingInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, domain_sid, sid=None): - """ - Initialize the AuthCallsIpAccessControlListMappingInstance - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingInstance - """ - super(AuthCallsIpAccessControlListMappingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'sid': payload.get('sid'), - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'domain_sid': domain_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AuthCallsIpAccessControlListMappingContext for this AuthCallsIpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingContext - """ - if self._context is None: - self._context = AuthCallsIpAccessControlListMappingContext( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - def fetch(self): - """ - Fetch the AuthCallsIpAccessControlListMappingInstance - - :returns: The fetched AuthCallsIpAccessControlListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_ip_access_control_list_mapping.AuthCallsIpAccessControlListMappingInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the AuthCallsIpAccessControlListMappingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_registrations_mapping/__init__.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_registrations_mapping/__init__.py deleted file mode 100644 index 13fe0c7036..0000000000 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_registrations_mapping/__init__.py +++ /dev/null @@ -1,129 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping import AuthRegistrationsCredentialListMappingList - - -class AuthTypeRegistrationsList(ListResource): - - def __init__(self, version, account_sid, domain_sid): - """ - Initialize the AuthTypeRegistrationsList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - :param domain_sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.AuthTypeRegistrationsList - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.AuthTypeRegistrationsList - """ - super(AuthTypeRegistrationsList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, } - - # Components - self._credential_list_mappings = None - - @property - def credential_list_mappings(self): - """ - Access the credential_list_mappings - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingList - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingList - """ - if self._credential_list_mappings is None: - self._credential_list_mappings = AuthRegistrationsCredentialListMappingList( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) - return self._credential_list_mappings - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AuthTypeRegistrationsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the AuthTypeRegistrationsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - :param domain_sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.AuthTypeRegistrationsPage - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.AuthTypeRegistrationsPage - """ - super(AuthTypeRegistrationsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AuthTypeRegistrationsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.AuthTypeRegistrationsInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.AuthTypeRegistrationsInstance - """ - return AuthTypeRegistrationsInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AuthTypeRegistrationsInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, domain_sid): - """ - Initialize the AuthTypeRegistrationsInstance - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.AuthTypeRegistrationsInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.AuthTypeRegistrationsInstance - """ - super(AuthTypeRegistrationsInstance, self).__init__(version) - - # Context - self._context = None - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, } - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_registrations_mapping/auth_registrations_credential_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_registrations_mapping/auth_registrations_credential_list_mapping.py deleted file mode 100644 index d2bd0b9d6c..0000000000 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_registrations_mapping/auth_registrations_credential_list_mapping.py +++ /dev/null @@ -1,389 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AuthRegistrationsCredentialListMappingList(ListResource): - - def __init__(self, version, account_sid, domain_sid): - """ - Initialize the AuthRegistrationsCredentialListMappingList - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource - :param domain_sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingList - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingList - """ - super(AuthRegistrationsCredentialListMappingList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, } - self._uri = '/Accounts/{account_sid}/SIP/Domains/{domain_sid}/Auth/Registrations/CredentialListMappings.json'.format(**self._solution) - - def create(self, credential_list_sid): - """ - Create the AuthRegistrationsCredentialListMappingInstance - - :param unicode credential_list_sid: The SID of the CredentialList resource to map to the SIP domain - - :returns: The created AuthRegistrationsCredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingInstance - """ - data = values.of({'CredentialListSid': credential_list_sid, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return AuthRegistrationsCredentialListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams AuthRegistrationsCredentialListMappingInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AuthRegistrationsCredentialListMappingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AuthRegistrationsCredentialListMappingInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AuthRegistrationsCredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AuthRegistrationsCredentialListMappingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AuthRegistrationsCredentialListMappingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AuthRegistrationsCredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AuthRegistrationsCredentialListMappingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AuthRegistrationsCredentialListMappingContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingContext - """ - return AuthRegistrationsCredentialListMappingContext( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a AuthRegistrationsCredentialListMappingContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingContext - """ - return AuthRegistrationsCredentialListMappingContext( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AuthRegistrationsCredentialListMappingPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the AuthRegistrationsCredentialListMappingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: The SID of the Account that created the resource - :param domain_sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingPage - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingPage - """ - super(AuthRegistrationsCredentialListMappingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AuthRegistrationsCredentialListMappingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingInstance - """ - return AuthRegistrationsCredentialListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AuthRegistrationsCredentialListMappingContext(InstanceContext): - - def __init__(self, version, account_sid, domain_sid, sid): - """ - Initialize the AuthRegistrationsCredentialListMappingContext - - :param Version version: Version that contains the resource - :param account_sid: The SID of the Account that created the resource to fetch - :param domain_sid: The SID of the SIP domain that contains the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingContext - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingContext - """ - super(AuthRegistrationsCredentialListMappingContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'domain_sid': domain_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/SIP/Domains/{domain_sid}/Auth/Registrations/CredentialListMappings/{sid}.json'.format(**self._solution) - - def fetch(self): - """ - Fetch the AuthRegistrationsCredentialListMappingInstance - - :returns: The fetched AuthRegistrationsCredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AuthRegistrationsCredentialListMappingInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the AuthRegistrationsCredentialListMappingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class AuthRegistrationsCredentialListMappingInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, domain_sid, sid=None): - """ - Initialize the AuthRegistrationsCredentialListMappingInstance - - :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingInstance - """ - super(AuthRegistrationsCredentialListMappingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'sid': payload.get('sid'), - } - - # Context - self._context = None - self._solution = { - 'account_sid': account_sid, - 'domain_sid': domain_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AuthRegistrationsCredentialListMappingContext for this AuthRegistrationsCredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingContext - """ - if self._context is None: - self._context = AuthRegistrationsCredentialListMappingContext( - self._version, - account_sid=self._solution['account_sid'], - domain_sid=self._solution['domain_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - def fetch(self): - """ - Fetch the AuthRegistrationsCredentialListMappingInstance - - :returns: The fetched AuthRegistrationsCredentialListMappingInstance - :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_registrations_mapping.auth_registrations_credential_list_mapping.AuthRegistrationsCredentialListMappingInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the AuthRegistrationsCredentialListMappingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/__init__.py similarity index 100% rename from twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls.py rename to twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/__init__.py diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/__init__.py similarity index 100% rename from twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations.py rename to twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/__init__.py diff --git a/twilio/rest/api/v2010/account/sip/ip_access_control_list.py b/twilio/rest/api/v2010/account/sip/ip_access_control_list.py deleted file mode 100644 index f44596ce9d..0000000000 --- a/twilio/rest/api/v2010/account/sip/ip_access_control_list.py +++ /dev/null @@ -1,176 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Api - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.ip_access_control_list.ip_address import IpAddressListInstance - - -class IpAccessControlListContext(InstanceContext): - def __init__(self, version: Version, account_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/${account_sid}/SIP/IpAccessControlLists/${sid}.json' - - self._ip_addresses = None - - def delete(self): - - - - """ - Deletes the IpAccessControlListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the IpAccessControlListInstance - - :returns: The fetched IpAccessControlListInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return IpAccessControlListInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return IpAccessControlListInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class IpAccessControlListInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'subresource_uris' : payload.get('subresource_uris'), - 'uri' : payload.get('uri'), - } - - self._context = None - self._solution = { - 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = IpAccessControlListContext( - self._version, - account_sid=self._solution['account_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def ip_addresses(self): - return self._proxy.ip_addresses - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class IpAccessControlListListInstance(ListResource): - def __init__(self, version: Version, account_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, } - self._uri = '/Accounts/${account_sid}/SIP/IpAccessControlLists.json' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return IpAccessControlListInstance(self._version, payload, account_sid=self._solution['account_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return IpAccessControlListPage(self._version, payload, account_sid=self._solution['account_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py b/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py index 62d151eea2..f44596ce9d 100644 --- a/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py +++ b/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py @@ -1,447 +1,176 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address import IpAddressList - - -class IpAccessControlListList(ListResource): - - def __init__(self, version, account_sid): - """ - Initialize the IpAccessControlListList - - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListList - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListList - """ - super(IpAccessControlListList, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/SIP/IpAccessControlLists.json'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams IpAccessControlListInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists IpAccessControlListInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of IpAccessControlListInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return IpAccessControlListPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of IpAccessControlListInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return IpAccessControlListPage(self._version, response, self._solution) - - def create(self, friendly_name): - """ - Create the IpAccessControlListInstance - - :param unicode friendly_name: A human readable description of this resource - - :returns: The created IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return IpAccessControlListInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ) - - def get(self, sid): - """ - Constructs a IpAccessControlListContext - - :param sid: A string that identifies the resource to fetch - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListContext - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListContext - """ - return IpAccessControlListContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a IpAccessControlListContext - - :param sid: A string that identifies the resource to fetch - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListContext - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListContext - """ - return IpAccessControlListContext(self._version, account_sid=self._solution['account_sid'], sid=sid, ) +from twilio.base.version import Version - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class IpAccessControlListPage(Page): +from twilio.base.page import Page - def __init__(self, version, response, solution): - """ - Initialize the IpAccessControlListPage +# from twilio.rest.ip_access_control_list.ip_address import IpAddressListInstance - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListPage - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListPage - """ - super(IpAccessControlListPage, self).__init__(version, response) +class IpAccessControlListContext(InstanceContext): + def __init__(self, version: Version, account_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of IpAccessControlListInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance - """ - return IpAccessControlListInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class IpAccessControlListContext(InstanceContext): + self._solution = { 'account_sid': account_sid, 'sid': sid, } + self._uri = '/Accounts/${account_sid}/SIP/IpAccessControlLists/${sid}.json' + + self._ip_addresses = None + + def delete(self): + + - def __init__(self, version, account_sid, sid): """ - Initialize the IpAccessControlListContext - - :param Version version: Version that contains the resource - :param account_sid: The unique sid that identifies this account - :param sid: A string that identifies the resource to fetch + Deletes the IpAccessControlListInstance - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListContext - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListContext + :returns: True if delete succeeds, False otherwise + :rtype: bool """ - super(IpAccessControlListContext, self).__init__(version) - - # Path Solution - self._solution = {'account_sid': account_sid, 'sid': sid, } - self._uri = '/Accounts/{account_sid}/SIP/IpAccessControlLists/{sid}.json'.format(**self._solution) - - # Dependents - self._ip_addresses = None - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the IpAccessControlListInstance :returns: The fetched IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return IpAccessControlListInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name): - """ - Update the IpAccessControlListInstance - - :param unicode friendly_name: A human readable description of this resource + return IpAccessControlListInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + - :returns: The updated IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance - """ - data = values.of({'FriendlyName': friendly_name, }) + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return IpAccessControlListInstance( - self._version, - payload, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], - ) + return IpAccessControlListInstance(self._version, payload, account_sid=self._solution['account_sid'], sid=self._solution['sid'], ) + + - def delete(self): - """ - Deletes the IpAccessControlListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def ip_addresses(self): - """ - Access the ip_addresses - - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressList - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressList - """ - if self._ip_addresses is None: - self._ip_addresses = IpAddressList( - self._version, - account_sid=self._solution['account_sid'], - ip_access_control_list_sid=self._solution['sid'], - ) - return self._ip_addresses + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class IpAccessControlListInstance(InstanceResource): - - def __init__(self, version, payload, account_sid, sid=None): - """ - Initialize the IpAccessControlListInstance - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance - """ - super(IpAccessControlListInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.rfc2822_datetime(payload.get('date_created')), - 'date_updated': deserialize.rfc2822_datetime(payload.get('date_updated')), - 'subresource_uris': payload.get('subresource_uris'), - 'uri': payload.get('uri'), +class IpAccessControlListInstance(InstanceResource): + def __init__(self, version, payload, account_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'subresource_uris' : payload.get('subresource_uris'), + 'uri' : payload.get('uri'), } - # Context self._context = None - self._solution = {'account_sid': account_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'account_sid': account_sid or self._properties['account_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: IpAccessControlListContext for this IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListContext - """ if self._context is None: self._context = IpAccessControlListContext( self._version, - account_sid=self._solution['account_sid'], - sid=self._solution['sid'], + account_sid=self._solution['account_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: A string that uniquely identifies this resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The unique sid that identifies this account - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: A human readable description of this resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def subresource_uris(self): - """ - :returns: The IP addresses associated with this resource. - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The URI for this resource - :rtype: unicode - """ - return self._properties['uri'] - - def fetch(self): - """ - Fetch the IpAccessControlListInstance - - :returns: The fetched IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance - """ - return self._proxy.fetch() + def ip_addresses(self): + return self._proxy.ip_addresses + - def update(self, friendly_name): + def __repr__(self): """ - Update the IpAccessControlListInstance - - :param unicode friendly_name: A human readable description of this resource - - :returns: The updated IpAccessControlListInstance - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.IpAccessControlListInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update(friendly_name, ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the IpAccessControlListInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - @property - def ip_addresses(self): - """ - Access the ip_addresses +class IpAccessControlListListInstance(ListResource): + def __init__(self, version: Version, account_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressList - :rtype: twilio.rest.api.v2010.account.sip.ip_access_control_list.ip_address.IpAddressList - """ - return self._proxy.ip_addresses + # Path Solution + self._solution = { 'account_sid': account_sid, } + self._uri = '/Accounts/${account_sid}/SIP/IpAccessControlLists.json' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return IpAccessControlListInstance(self._version, payload, account_sid=self._solution['account_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return IpAccessControlListPage(self._version, payload, account_sid=self._solution['account_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/api/v2010/account/usage.py b/twilio/rest/api/v2010/account/usage.py deleted file mode 100644 index 78de83b90d..0000000000 --- a/twilio/rest/api/v2010/account/usage.py +++ /dev/null @@ -1,49 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Api - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.rest.usage.record import RecordListInstancefrom twilio.rest.usage.trigger import TriggerListInstance - - - - -class UsageListInstance(ListResource): - def __init__(self, version: Version, account_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, } - self._uri = '/Accounts/${account_sid}/Usage.json' - - self._records = None - self._triggers = None - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/api/v2010/account/usage/__init__.py b/twilio/rest/api/v2010/account/usage/__init__.py index b2cec30543..78de83b90d 100644 --- a/twilio/rest/api/v2010/account/usage/__init__.py +++ b/twilio/rest/api/v2010/account/usage/__init__.py @@ -1,132 +1,49 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Api + 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 twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.api.v2010.account.usage.record import RecordList -from twilio.rest.api.v2010.account.usage.trigger import TriggerList +from twilio.base.version import Version +# from twilio.rest.usage.record import RecordListInstancefrom twilio.rest.usage.trigger import TriggerListInstance -class UsageList(ListResource): - def __init__(self, version, account_sid): - """ - Initialize the UsageList - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - :returns: twilio.rest.api.v2010.account.usage.UsageList - :rtype: twilio.rest.api.v2010.account.usage.UsageList - """ - super(UsageList, self).__init__(version) +class UsageListInstance(ListResource): + def __init__(self, version: Version, account_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, } - - # Components + self._solution = { 'account_sid': account_sid, } + self._uri = '/Accounts/${account_sid}/Usage.json' + self._records = None self._triggers = None - - @property - def records(self): - """ - Access the records - - :returns: twilio.rest.api.v2010.account.usage.record.RecordList - :rtype: twilio.rest.api.v2010.account.usage.record.RecordList - """ - if self._records is None: - self._records = RecordList(self._version, account_sid=self._solution['account_sid'], ) - return self._records - - @property - def triggers(self): - """ - Access the triggers - - :returns: twilio.rest.api.v2010.account.usage.trigger.TriggerList - :rtype: twilio.rest.api.v2010.account.usage.trigger.TriggerList - """ - if self._triggers is None: - self._triggers = TriggerList(self._version, account_sid=self._solution['account_sid'], ) - return self._triggers - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class UsagePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the UsagePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.UsagePage - :rtype: twilio.rest.api.v2010.account.usage.UsagePage - """ - super(UsagePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UsageInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.usage.UsageInstance - :rtype: twilio.rest.api.v2010.account.usage.UsageInstance - """ - return UsageInstance(self._version, payload, account_sid=self._solution['account_sid'], ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class UsageInstance(InstanceResource): - - def __init__(self, version, payload, account_sid): - """ - Initialize the UsageInstance + return '' - :returns: twilio.rest.api.v2010.account.usage.UsageInstance - :rtype: twilio.rest.api.v2010.account.usage.UsageInstance - """ - super(UsageInstance, self).__init__(version) - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/api/v2010/account/usage/record.py b/twilio/rest/api/v2010/account/usage/record.py deleted file mode 100644 index e9fa6e2e67..0000000000 --- a/twilio/rest/api/v2010/account/usage/record.py +++ /dev/null @@ -1,69 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Api - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.record.all_time import AllTimeListInstancefrom twilio.rest.record.daily import DailyListInstancefrom twilio.rest.record.last_month import LastMonthListInstancefrom twilio.rest.record.monthly import MonthlyListInstancefrom twilio.rest.record.this_month import ThisMonthListInstancefrom twilio.rest.record.today import TodayListInstancefrom twilio.rest.record.yearly import YearlyListInstancefrom twilio.rest.record.yesterday import YesterdayListInstance - - - - -class RecordListInstance(ListResource): - def __init__(self, version: Version, account_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'account_sid': account_sid, } - self._uri = '/Accounts/${account_sid}/Usage/Records.json' - - self._all_time = None - self._daily = None - self._last_month = None - self._monthly = None - self._this_month = None - self._today = None - self._yearly = None - self._yesterday = None - - """ - def page(self, category, start_date, end_date, include_subaccounts, page_size): - - data = values.of({ - 'category': category,'start_date': start_date,'end_date': end_date,'include_subaccounts': include_subaccounts,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return RecordPage(self._version, payload, account_sid=self._solution['account_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/api/v2010/account/usage/record/__init__.py b/twilio/rest/api/v2010/account/usage/record/__init__.py index 73ae4e2d22..e9fa6e2e67 100644 --- a/twilio/rest/api/v2010/account/usage/record/__init__.py +++ b/twilio/rest/api/v2010/account/usage/record/__init__.py @@ -1,46 +1,42 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Api + 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 twilio.base import deserialize from twilio.base import serialize from twilio.base import values +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.api.v2010.account.usage.record.all_time import AllTimeList -from twilio.rest.api.v2010.account.usage.record.daily import DailyList -from twilio.rest.api.v2010.account.usage.record.last_month import LastMonthList -from twilio.rest.api.v2010.account.usage.record.monthly import MonthlyList -from twilio.rest.api.v2010.account.usage.record.this_month import ThisMonthList -from twilio.rest.api.v2010.account.usage.record.today import TodayList -from twilio.rest.api.v2010.account.usage.record.yearly import YearlyList -from twilio.rest.api.v2010.account.usage.record.yesterday import YesterdayList +# from twilio.rest.record.all_time import AllTimeListInstancefrom twilio.rest.record.daily import DailyListInstancefrom twilio.rest.record.last_month import LastMonthListInstancefrom twilio.rest.record.monthly import MonthlyListInstancefrom twilio.rest.record.this_month import ThisMonthListInstancefrom twilio.rest.record.today import TodayListInstancefrom twilio.rest.record.yearly import YearlyListInstancefrom twilio.rest.record.yesterday import YesterdayListInstance -class RecordList(ListResource): - def __init__(self, version, account_sid): - """ - Initialize the RecordList - :param Version version: Version that contains the resource - :param account_sid: A 34 character string that uniquely identifies this resource. - :returns: twilio.rest.api.v2010.account.usage.record.RecordList - :rtype: twilio.rest.api.v2010.account.usage.record.RecordList - """ - super(RecordList, self).__init__(version) +class RecordListInstance(ListResource): + def __init__(self, version: Version, account_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'account_sid': account_sid, } - self._uri = '/Accounts/{account_sid}/Usage/Records.json'.format(**self._solution) - - # Components + self._solution = { 'account_sid': account_sid, } + self._uri = '/Accounts/${account_sid}/Usage/Records.json' + self._all_time = None self._daily = None self._last_month = None @@ -49,674 +45,25 @@ def __init__(self, version, account_sid): self._today = None self._yearly = None self._yesterday = None - - def stream(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, limit=None, - page_size=None): - """ - Streams RecordInstance 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 RecordInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.api.v2010.account.usage.record.RecordInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - category=category, - start_date=start_date, - end_date=end_date, - include_subaccounts=include_subaccounts, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, limit=None, - page_size=None): - """ - Lists RecordInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param RecordInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.api.v2010.account.usage.record.RecordInstance] - """ - return list(self.stream( - category=category, - start_date=start_date, - end_date=end_date, - include_subaccounts=include_subaccounts, - limit=limit, - page_size=page_size, - )) - - def page(self, category=values.unset, start_date=values.unset, - end_date=values.unset, include_subaccounts=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RecordInstance records from the API. - Request is executed immediately - - :param RecordInstance.Category category: The usage category of the UsageRecord resources to read - :param date start_date: Only include usage that has occurred on or after this date - :param date end_date: Only include usage that occurred on or before this date - :param bool include_subaccounts: Whether to include usage from the master account and all its subaccounts - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RecordInstance - :rtype: twilio.rest.api.v2010.account.usage.record.RecordPage - """ + + """ + def page(self, category, start_date, end_date, include_subaccounts, page_size): + data = values.of({ - 'Category': category, - 'StartDate': serialize.iso8601_date(start_date), - 'EndDate': serialize.iso8601_date(end_date), - 'IncludeSubaccounts': include_subaccounts, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, + 'category': category,'start_date': start_date,'end_date': end_date,'include_subaccounts': include_subaccounts,'page_size': page_size, }) - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return RecordPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RecordInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RecordInstance - :rtype: twilio.rest.api.v2010.account.usage.record.RecordPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RecordPage(self._version, response, self._solution) - - @property - def all_time(self): - """ - Access the all_time - - :returns: twilio.rest.api.v2010.account.usage.record.all_time.AllTimeList - :rtype: twilio.rest.api.v2010.account.usage.record.all_time.AllTimeList - """ - if self._all_time is None: - self._all_time = AllTimeList(self._version, account_sid=self._solution['account_sid'], ) - return self._all_time - - @property - def daily(self): - """ - Access the daily - - :returns: twilio.rest.api.v2010.account.usage.record.daily.DailyList - :rtype: twilio.rest.api.v2010.account.usage.record.daily.DailyList - """ - if self._daily is None: - self._daily = DailyList(self._version, account_sid=self._solution['account_sid'], ) - return self._daily - - @property - def last_month(self): - """ - Access the last_month + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthList - :rtype: twilio.rest.api.v2010.account.usage.record.last_month.LastMonthList - """ - if self._last_month is None: - self._last_month = LastMonthList(self._version, account_sid=self._solution['account_sid'], ) - return self._last_month - - @property - def monthly(self): - """ - Access the monthly - - :returns: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyList - :rtype: twilio.rest.api.v2010.account.usage.record.monthly.MonthlyList - """ - if self._monthly is None: - self._monthly = MonthlyList(self._version, account_sid=self._solution['account_sid'], ) - return self._monthly - - @property - def this_month(self): - """ - Access the this_month - - :returns: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthList - :rtype: twilio.rest.api.v2010.account.usage.record.this_month.ThisMonthList - """ - if self._this_month is None: - self._this_month = ThisMonthList(self._version, account_sid=self._solution['account_sid'], ) - return self._this_month - - @property - def today(self): - """ - Access the today - - :returns: twilio.rest.api.v2010.account.usage.record.today.TodayList - :rtype: twilio.rest.api.v2010.account.usage.record.today.TodayList - """ - if self._today is None: - self._today = TodayList(self._version, account_sid=self._solution['account_sid'], ) - return self._today - - @property - def yearly(self): - """ - Access the yearly - - :returns: twilio.rest.api.v2010.account.usage.record.yearly.YearlyList - :rtype: twilio.rest.api.v2010.account.usage.record.yearly.YearlyList - """ - if self._yearly is None: - self._yearly = YearlyList(self._version, account_sid=self._solution['account_sid'], ) - return self._yearly - - @property - def yesterday(self): - """ - Access the yesterday - - :returns: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayList - :rtype: twilio.rest.api.v2010.account.usage.record.yesterday.YesterdayList - """ - if self._yesterday is None: - self._yesterday = YesterdayList(self._version, account_sid=self._solution['account_sid'], ) - return self._yesterday + return RecordPage(self._version, payload, account_sid=self._solution['account_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class RecordPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the RecordPage + return '' - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param account_sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.api.v2010.account.usage.record.RecordPage - :rtype: twilio.rest.api.v2010.account.usage.record.RecordPage - """ - super(RecordPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RecordInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.api.v2010.account.usage.record.RecordInstance - :rtype: twilio.rest.api.v2010.account.usage.record.RecordInstance - """ - return RecordInstance(self._version, payload, account_sid=self._solution['account_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RecordInstance(InstanceResource): - - class Category(object): - A2P_REGISTRATION_FEES = "a2p-registration-fees" - AGENT_CONFERENCE = "agent-conference" - AMAZON_POLLY = "amazon-polly" - ANSWERING_MACHINE_DETECTION = "answering-machine-detection" - AUTHY_AUTHENTICATIONS = "authy-authentications" - AUTHY_CALLS_OUTBOUND = "authy-calls-outbound" - AUTHY_MONTHLY_FEES = "authy-monthly-fees" - AUTHY_PHONE_INTELLIGENCE = "authy-phone-intelligence" - AUTHY_PHONE_VERIFICATIONS = "authy-phone-verifications" - AUTHY_SMS_OUTBOUND = "authy-sms-outbound" - CALL_PROGESS_EVENTS = "call-progess-events" - CALLERIDLOOKUPS = "calleridlookups" - CALLS = "calls" - CALLS_CLIENT = "calls-client" - CALLS_GLOBALCONFERENCE = "calls-globalconference" - CALLS_INBOUND = "calls-inbound" - CALLS_INBOUND_LOCAL = "calls-inbound-local" - CALLS_INBOUND_MOBILE = "calls-inbound-mobile" - CALLS_INBOUND_TOLLFREE = "calls-inbound-tollfree" - CALLS_OUTBOUND = "calls-outbound" - CALLS_PAY_VERB_TRANSACTIONS = "calls-pay-verb-transactions" - CALLS_RECORDINGS = "calls-recordings" - CALLS_SIP = "calls-sip" - CALLS_SIP_INBOUND = "calls-sip-inbound" - CALLS_SIP_OUTBOUND = "calls-sip-outbound" - CALLS_TRANSFERS = "calls-transfers" - CARRIER_LOOKUPS = "carrier-lookups" - CONVERSATIONS = "conversations" - CONVERSATIONS_API_REQUESTS = "conversations-api-requests" - CONVERSATIONS_CONVERSATION_EVENTS = "conversations-conversation-events" - CONVERSATIONS_ENDPOINT_CONNECTIVITY = "conversations-endpoint-connectivity" - CONVERSATIONS_EVENTS = "conversations-events" - CONVERSATIONS_PARTICIPANT_EVENTS = "conversations-participant-events" - CONVERSATIONS_PARTICIPANTS = "conversations-participants" - CPS = "cps" - FLEX_USAGE = "flex-usage" - FRAUD_LOOKUPS = "fraud-lookups" - GROUP_ROOMS = "group-rooms" - GROUP_ROOMS_DATA_TRACK = "group-rooms-data-track" - GROUP_ROOMS_ENCRYPTED_MEDIA_RECORDED = "group-rooms-encrypted-media-recorded" - GROUP_ROOMS_MEDIA_DOWNLOADED = "group-rooms-media-downloaded" - GROUP_ROOMS_MEDIA_RECORDED = "group-rooms-media-recorded" - GROUP_ROOMS_MEDIA_ROUTED = "group-rooms-media-routed" - GROUP_ROOMS_MEDIA_STORED = "group-rooms-media-stored" - GROUP_ROOMS_PARTICIPANT_MINUTES = "group-rooms-participant-minutes" - GROUP_ROOMS_RECORDED_MINUTES = "group-rooms-recorded-minutes" - IMP_V1_USAGE = "imp-v1-usage" - LOOKUPS = "lookups" - MARKETPLACE = "marketplace" - MARKETPLACE_ALGORITHMIA_NAMED_ENTITY_RECOGNITION = "marketplace-algorithmia-named-entity-recognition" - MARKETPLACE_CADENCE_TRANSCRIPTION = "marketplace-cadence-transcription" - MARKETPLACE_CADENCE_TRANSLATION = "marketplace-cadence-translation" - MARKETPLACE_CAPIO_SPEECH_TO_TEXT = "marketplace-capio-speech-to-text" - MARKETPLACE_CONVRIZA_ABABA = "marketplace-convriza-ababa" - MARKETPLACE_DEEPGRAM_PHRASE_DETECTOR = "marketplace-deepgram-phrase-detector" - MARKETPLACE_DIGITAL_SEGMENT_BUSINESS_INFO = "marketplace-digital-segment-business-info" - MARKETPLACE_FACEBOOK_OFFLINE_CONVERSIONS = "marketplace-facebook-offline-conversions" - MARKETPLACE_GOOGLE_SPEECH_TO_TEXT = "marketplace-google-speech-to-text" - MARKETPLACE_IBM_WATSON_MESSAGE_INSIGHTS = "marketplace-ibm-watson-message-insights" - MARKETPLACE_IBM_WATSON_MESSAGE_SENTIMENT = "marketplace-ibm-watson-message-sentiment" - MARKETPLACE_IBM_WATSON_RECORDING_ANALYSIS = "marketplace-ibm-watson-recording-analysis" - MARKETPLACE_IBM_WATSON_TONE_ANALYZER = "marketplace-ibm-watson-tone-analyzer" - MARKETPLACE_ICEHOOK_SYSTEMS_SCOUT = "marketplace-icehook-systems-scout" - MARKETPLACE_INFOGROUP_DATAAXLE_BIZINFO = "marketplace-infogroup-dataaxle-bizinfo" - MARKETPLACE_KEEN_IO_CONTACT_CENTER_ANALYTICS = "marketplace-keen-io-contact-center-analytics" - MARKETPLACE_MARCHEX_CLEANCALL = "marketplace-marchex-cleancall" - MARKETPLACE_MARCHEX_SENTIMENT_ANALYSIS_FOR_SMS = "marketplace-marchex-sentiment-analysis-for-sms" - MARKETPLACE_MARKETPLACE_NEXTCALLER_SOCIAL_ID = "marketplace-marketplace-nextcaller-social-id" - MARKETPLACE_MOBILE_COMMONS_OPT_OUT_CLASSIFIER = "marketplace-mobile-commons-opt-out-classifier" - MARKETPLACE_NEXIWAVE_VOICEMAIL_TO_TEXT = "marketplace-nexiwave-voicemail-to-text" - MARKETPLACE_NEXTCALLER_ADVANCED_CALLER_IDENTIFICATION = "marketplace-nextcaller-advanced-caller-identification" - MARKETPLACE_NOMOROBO_SPAM_SCORE = "marketplace-nomorobo-spam-score" - MARKETPLACE_PAYFONE_TCPA_COMPLIANCE = "marketplace-payfone-tcpa-compliance" - MARKETPLACE_REMEETING_AUTOMATIC_SPEECH_RECOGNITION = "marketplace-remeeting-automatic-speech-recognition" - MARKETPLACE_TCPA_DEFENSE_SOLUTIONS_BLACKLIST_FEED = "marketplace-tcpa-defense-solutions-blacklist-feed" - MARKETPLACE_TELO_OPENCNAM = "marketplace-telo-opencnam" - MARKETPLACE_TRUECNAM_TRUE_SPAM = "marketplace-truecnam-true-spam" - MARKETPLACE_TWILIO_CALLER_NAME_LOOKUP_US = "marketplace-twilio-caller-name-lookup-us" - MARKETPLACE_TWILIO_CARRIER_INFORMATION_LOOKUP = "marketplace-twilio-carrier-information-lookup" - MARKETPLACE_VOICEBASE_PCI = "marketplace-voicebase-pci" - MARKETPLACE_VOICEBASE_TRANSCRIPTION = "marketplace-voicebase-transcription" - MARKETPLACE_VOICEBASE_TRANSCRIPTION_CUSTOM_VOCABULARY = "marketplace-voicebase-transcription-custom-vocabulary" - MARKETPLACE_WHITEPAGES_PRO_CALLER_IDENTIFICATION = "marketplace-whitepages-pro-caller-identification" - MARKETPLACE_WHITEPAGES_PRO_PHONE_INTELLIGENCE = "marketplace-whitepages-pro-phone-intelligence" - MARKETPLACE_WHITEPAGES_PRO_PHONE_REPUTATION = "marketplace-whitepages-pro-phone-reputation" - MARKETPLACE_WOLFARM_SPOKEN_RESULTS = "marketplace-wolfarm-spoken-results" - MARKETPLACE_WOLFRAM_SHORT_ANSWER = "marketplace-wolfram-short-answer" - MARKETPLACE_YTICA_CONTACT_CENTER_REPORTING_ANALYTICS = "marketplace-ytica-contact-center-reporting-analytics" - MEDIASTORAGE = "mediastorage" - MMS = "mms" - MMS_INBOUND = "mms-inbound" - MMS_INBOUND_LONGCODE = "mms-inbound-longcode" - MMS_INBOUND_SHORTCODE = "mms-inbound-shortcode" - MMS_MESSAGES_CARRIERFEES = "mms-messages-carrierfees" - MMS_OUTBOUND = "mms-outbound" - MMS_OUTBOUND_LONGCODE = "mms-outbound-longcode" - MMS_OUTBOUND_SHORTCODE = "mms-outbound-shortcode" - MONITOR_READS = "monitor-reads" - MONITOR_STORAGE = "monitor-storage" - MONITOR_WRITES = "monitor-writes" - NOTIFY = "notify" - NOTIFY_ACTIONS_ATTEMPTS = "notify-actions-attempts" - NOTIFY_CHANNELS = "notify-channels" - NUMBER_FORMAT_LOOKUPS = "number-format-lookups" - PCHAT = "pchat" - PCHAT_USERS = "pchat-users" - PEER_TO_PEER_ROOMS_PARTICIPANT_MINUTES = "peer-to-peer-rooms-participant-minutes" - PFAX = "pfax" - PFAX_MINUTES = "pfax-minutes" - PFAX_MINUTES_INBOUND = "pfax-minutes-inbound" - PFAX_MINUTES_OUTBOUND = "pfax-minutes-outbound" - PFAX_PAGES = "pfax-pages" - PHONENUMBERS = "phonenumbers" - PHONENUMBERS_CPS = "phonenumbers-cps" - PHONENUMBERS_EMERGENCY = "phonenumbers-emergency" - PHONENUMBERS_LOCAL = "phonenumbers-local" - PHONENUMBERS_MOBILE = "phonenumbers-mobile" - PHONENUMBERS_SETUPS = "phonenumbers-setups" - PHONENUMBERS_TOLLFREE = "phonenumbers-tollfree" - PREMIUMSUPPORT = "premiumsupport" - PROXY = "proxy" - PROXY_ACTIVE_SESSIONS = "proxy-active-sessions" - PSTNCONNECTIVITY = "pstnconnectivity" - PV = "pv" - PV_COMPOSITION_MEDIA_DOWNLOADED = "pv-composition-media-downloaded" - PV_COMPOSITION_MEDIA_ENCRYPTED = "pv-composition-media-encrypted" - PV_COMPOSITION_MEDIA_STORED = "pv-composition-media-stored" - PV_COMPOSITION_MINUTES = "pv-composition-minutes" - PV_RECORDING_COMPOSITIONS = "pv-recording-compositions" - PV_ROOM_PARTICIPANTS = "pv-room-participants" - PV_ROOM_PARTICIPANTS_AU1 = "pv-room-participants-au1" - PV_ROOM_PARTICIPANTS_BR1 = "pv-room-participants-br1" - PV_ROOM_PARTICIPANTS_IE1 = "pv-room-participants-ie1" - PV_ROOM_PARTICIPANTS_JP1 = "pv-room-participants-jp1" - PV_ROOM_PARTICIPANTS_SG1 = "pv-room-participants-sg1" - PV_ROOM_PARTICIPANTS_US1 = "pv-room-participants-us1" - PV_ROOM_PARTICIPANTS_US2 = "pv-room-participants-us2" - PV_ROOMS = "pv-rooms" - PV_SIP_ENDPOINT_REGISTRATIONS = "pv-sip-endpoint-registrations" - RECORDINGS = "recordings" - RECORDINGSTORAGE = "recordingstorage" - ROOMS_GROUP_BANDWIDTH = "rooms-group-bandwidth" - ROOMS_GROUP_MINUTES = "rooms-group-minutes" - ROOMS_PEER_TO_PEER_MINUTES = "rooms-peer-to-peer-minutes" - SHORTCODES = "shortcodes" - SHORTCODES_CUSTOMEROWNED = "shortcodes-customerowned" - SHORTCODES_MMS_ENABLEMENT = "shortcodes-mms-enablement" - SHORTCODES_MPS = "shortcodes-mps" - SHORTCODES_RANDOM = "shortcodes-random" - SHORTCODES_UK = "shortcodes-uk" - SHORTCODES_VANITY = "shortcodes-vanity" - SMALL_GROUP_ROOMS = "small-group-rooms" - SMALL_GROUP_ROOMS_DATA_TRACK = "small-group-rooms-data-track" - SMALL_GROUP_ROOMS_PARTICIPANT_MINUTES = "small-group-rooms-participant-minutes" - SMS = "sms" - SMS_INBOUND = "sms-inbound" - SMS_INBOUND_LONGCODE = "sms-inbound-longcode" - SMS_INBOUND_SHORTCODE = "sms-inbound-shortcode" - SMS_MESSAGES_CARRIERFEES = "sms-messages-carrierfees" - SMS_MESSAGES_FEATURES = "sms-messages-features" - SMS_MESSAGES_FEATURES_SENDERID = "sms-messages-features-senderid" - SMS_OUTBOUND = "sms-outbound" - SMS_OUTBOUND_CONTENT_INSPECTION = "sms-outbound-content-inspection" - SMS_OUTBOUND_LONGCODE = "sms-outbound-longcode" - SMS_OUTBOUND_SHORTCODE = "sms-outbound-shortcode" - SPEECH_RECOGNITION = "speech-recognition" - STUDIO_ENGAGEMENTS = "studio-engagements" - SYNC = "sync" - SYNC_ACTIONS = "sync-actions" - SYNC_ENDPOINT_HOURS = "sync-endpoint-hours" - SYNC_ENDPOINT_HOURS_ABOVE_DAILY_CAP = "sync-endpoint-hours-above-daily-cap" - TASKROUTER_TASKS = "taskrouter-tasks" - TOTALPRICE = "totalprice" - TRANSCRIPTIONS = "transcriptions" - TRUNKING_CPS = "trunking-cps" - TRUNKING_EMERGENCY_CALLS = "trunking-emergency-calls" - TRUNKING_ORIGINATION = "trunking-origination" - TRUNKING_ORIGINATION_LOCAL = "trunking-origination-local" - TRUNKING_ORIGINATION_MOBILE = "trunking-origination-mobile" - TRUNKING_ORIGINATION_TOLLFREE = "trunking-origination-tollfree" - TRUNKING_RECORDINGS = "trunking-recordings" - TRUNKING_SECURE = "trunking-secure" - TRUNKING_TERMINATION = "trunking-termination" - TURNMEGABYTES = "turnmegabytes" - TURNMEGABYTES_AUSTRALIA = "turnmegabytes-australia" - TURNMEGABYTES_BRASIL = "turnmegabytes-brasil" - TURNMEGABYTES_GERMANY = "turnmegabytes-germany" - TURNMEGABYTES_INDIA = "turnmegabytes-india" - TURNMEGABYTES_IRELAND = "turnmegabytes-ireland" - TURNMEGABYTES_JAPAN = "turnmegabytes-japan" - TURNMEGABYTES_SINGAPORE = "turnmegabytes-singapore" - TURNMEGABYTES_USEAST = "turnmegabytes-useast" - TURNMEGABYTES_USWEST = "turnmegabytes-uswest" - TWILIO_INTERCONNECT = "twilio-interconnect" - VERIFY_PUSH = "verify-push" - VERIFY_TOTP = "verify-totp" - VERIFY_WHATSAPP_CONVERSATIONS_BUSINESS_INITIATED = "verify-whatsapp-conversations-business-initiated" - VIDEO_RECORDINGS = "video-recordings" - VIRTUAL_AGENT = "virtual-agent" - VOICE_INSIGHTS = "voice-insights" - VOICE_INSIGHTS_CLIENT_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-client-insights-on-demand-minute" - VOICE_INSIGHTS_PTSN_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-ptsn-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_INTERFACE_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-interface-insights-on-demand-minute" - VOICE_INSIGHTS_SIP_TRUNKING_INSIGHTS_ON_DEMAND_MINUTE = "voice-insights-sip-trunking-insights-on-demand-minute" - WIRELESS = "wireless" - WIRELESS_ORDERS = "wireless-orders" - WIRELESS_ORDERS_ARTWORK = "wireless-orders-artwork" - WIRELESS_ORDERS_BULK = "wireless-orders-bulk" - WIRELESS_ORDERS_ESIM = "wireless-orders-esim" - WIRELESS_ORDERS_STARTER = "wireless-orders-starter" - WIRELESS_USAGE = "wireless-usage" - WIRELESS_USAGE_COMMANDS = "wireless-usage-commands" - WIRELESS_USAGE_COMMANDS_AFRICA = "wireless-usage-commands-africa" - WIRELESS_USAGE_COMMANDS_ASIA = "wireless-usage-commands-asia" - WIRELESS_USAGE_COMMANDS_CENTRALANDSOUTHAMERICA = "wireless-usage-commands-centralandsouthamerica" - WIRELESS_USAGE_COMMANDS_EUROPE = "wireless-usage-commands-europe" - WIRELESS_USAGE_COMMANDS_HOME = "wireless-usage-commands-home" - WIRELESS_USAGE_COMMANDS_NORTHAMERICA = "wireless-usage-commands-northamerica" - WIRELESS_USAGE_COMMANDS_OCEANIA = "wireless-usage-commands-oceania" - WIRELESS_USAGE_COMMANDS_ROAMING = "wireless-usage-commands-roaming" - WIRELESS_USAGE_DATA = "wireless-usage-data" - WIRELESS_USAGE_DATA_AFRICA = "wireless-usage-data-africa" - WIRELESS_USAGE_DATA_ASIA = "wireless-usage-data-asia" - WIRELESS_USAGE_DATA_CENTRALANDSOUTHAMERICA = "wireless-usage-data-centralandsouthamerica" - WIRELESS_USAGE_DATA_CUSTOM_ADDITIONALMB = "wireless-usage-data-custom-additionalmb" - WIRELESS_USAGE_DATA_CUSTOM_FIRST5MB = "wireless-usage-data-custom-first5mb" - WIRELESS_USAGE_DATA_DOMESTIC_ROAMING = "wireless-usage-data-domestic-roaming" - WIRELESS_USAGE_DATA_EUROPE = "wireless-usage-data-europe" - WIRELESS_USAGE_DATA_INDIVIDUAL_ADDITIONALGB = "wireless-usage-data-individual-additionalgb" - WIRELESS_USAGE_DATA_INDIVIDUAL_FIRSTGB = "wireless-usage-data-individual-firstgb" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_CANADA = "wireless-usage-data-international-roaming-canada" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_INDIA = "wireless-usage-data-international-roaming-india" - WIRELESS_USAGE_DATA_INTERNATIONAL_ROAMING_MEXICO = "wireless-usage-data-international-roaming-mexico" - WIRELESS_USAGE_DATA_NORTHAMERICA = "wireless-usage-data-northamerica" - WIRELESS_USAGE_DATA_OCEANIA = "wireless-usage-data-oceania" - WIRELESS_USAGE_DATA_POOLED = "wireless-usage-data-pooled" - WIRELESS_USAGE_DATA_POOLED_DOWNLINK = "wireless-usage-data-pooled-downlink" - WIRELESS_USAGE_DATA_POOLED_UPLINK = "wireless-usage-data-pooled-uplink" - WIRELESS_USAGE_MRC = "wireless-usage-mrc" - WIRELESS_USAGE_MRC_CUSTOM = "wireless-usage-mrc-custom" - WIRELESS_USAGE_MRC_INDIVIDUAL = "wireless-usage-mrc-individual" - WIRELESS_USAGE_MRC_POOLED = "wireless-usage-mrc-pooled" - WIRELESS_USAGE_MRC_SUSPENDED = "wireless-usage-mrc-suspended" - WIRELESS_USAGE_SMS = "wireless-usage-sms" - WIRELESS_USAGE_VOICE = "wireless-usage-voice" - - def __init__(self, version, payload, account_sid): - """ - Initialize the RecordInstance - - :returns: twilio.rest.api.v2010.account.usage.record.RecordInstance - :rtype: twilio.rest.api.v2010.account.usage.record.RecordInstance - """ - super(RecordInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'api_version': payload.get('api_version'), - 'as_of': payload.get('as_of'), - 'category': payload.get('category'), - 'count': payload.get('count'), - 'count_unit': payload.get('count_unit'), - 'description': payload.get('description'), - 'end_date': deserialize.iso8601_date(payload.get('end_date')), - 'price': deserialize.decimal(payload.get('price')), - 'price_unit': payload.get('price_unit'), - 'start_date': deserialize.iso8601_date(payload.get('start_date')), - 'subresource_uris': payload.get('subresource_uris'), - 'uri': payload.get('uri'), - 'usage': payload.get('usage'), - 'usage_unit': payload.get('usage_unit'), - } - - # Context - self._context = None - self._solution = {'account_sid': account_sid, } - - @property - def account_sid(self): - """ - :returns: The SID of the Account accrued the usage - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def api_version(self): - """ - :returns: The API version used to create the resource - :rtype: unicode - """ - return self._properties['api_version'] - - @property - def as_of(self): - """ - :returns: Usage records up to date as of this timestamp - :rtype: unicode - """ - return self._properties['as_of'] - - @property - def category(self): - """ - :returns: The category of usage - :rtype: RecordInstance.Category - """ - return self._properties['category'] - - @property - def count(self): - """ - :returns: The number of usage events - :rtype: unicode - """ - return self._properties['count'] - - @property - def count_unit(self): - """ - :returns: The units in which count is measured - :rtype: unicode - """ - return self._properties['count_unit'] - - @property - def description(self): - """ - :returns: A plain-language description of the usage category - :rtype: unicode - """ - return self._properties['description'] - - @property - def end_date(self): - """ - :returns: The last date for which usage is included in the UsageRecord - :rtype: date - """ - return self._properties['end_date'] - - @property - def price(self): - """ - :returns: The total price of the usage - :rtype: unicode - """ - return self._properties['price'] - - @property - def price_unit(self): - """ - :returns: The currency in which `price` is measured - :rtype: unicode - """ - return self._properties['price_unit'] - - @property - def start_date(self): - """ - :returns: The first date for which usage is included in this UsageRecord - :rtype: date - """ - return self._properties['start_date'] - - @property - def subresource_uris(self): - """ - :returns: A list of related resources identified by their relative URIs - :rtype: unicode - """ - return self._properties['subresource_uris'] - - @property - def uri(self): - """ - :returns: The URI of the resource, relative to `https://api.twilio.com` - :rtype: unicode - """ - return self._properties['uri'] - - @property - def usage(self): - """ - :returns: The amount of usage - :rtype: unicode - """ - return self._properties['usage'] - - @property - def usage_unit(self): - """ - :returns: The units in which usage is measured - :rtype: unicode - """ - return self._properties['usage_unit'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/autopilot/v1/assistant.py b/twilio/rest/autopilot/v1/assistant.py deleted file mode 100644 index f1867bd0ba..0000000000 --- a/twilio/rest/autopilot/v1/assistant.py +++ /dev/null @@ -1,211 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Autopilot - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.assistant.defaults import DefaultsListInstancefrom twilio.rest.assistant.dialogue import DialogueListInstancefrom twilio.rest.assistant.field_type import FieldTypeListInstancefrom twilio.rest.assistant.model_build import ModelBuildListInstancefrom twilio.rest.assistant.query import QueryListInstancefrom twilio.rest.assistant.style_sheet import StyleSheetListInstancefrom twilio.rest.assistant.task import TaskListInstancefrom twilio.rest.assistant.webhook import WebhookListInstance - - -class AssistantContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Assistants/${sid}' - - self._defaults = None - self._dialogues = None - self._field_types = None - self._model_builds = None - self._queries = None - self._style_sheet = None - self._tasks = None - self._webhooks = None - - def delete(self): - - - - """ - Deletes the AssistantInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the AssistantInstance - - :returns: The fetched AssistantInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AssistantInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return AssistantInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class AssistantInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'friendly_name' : payload.get('friendly_name'), - 'latest_model_build_sid' : payload.get('latest_model_build_sid'), - 'links' : payload.get('links'), - 'log_queries' : payload.get('log_queries'), - 'development_stage' : payload.get('development_stage'), - 'needs_model_build' : payload.get('needs_model_build'), - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'url' : payload.get('url'), - 'callback_url' : payload.get('callback_url'), - 'callback_events' : payload.get('callback_events'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = AssistantContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def defaults(self): - return self._proxy.defaults - @property - def dialogues(self): - return self._proxy.dialogues - @property - def field_types(self): - return self._proxy.field_types - @property - def model_builds(self): - return self._proxy.model_builds - @property - def queries(self): - return self._proxy.queries - @property - def style_sheet(self): - return self._proxy.style_sheet - @property - def tasks(self): - return self._proxy.tasks - @property - def webhooks(self): - return self._proxy.webhooks - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class AssistantListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Assistants' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return AssistantInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return AssistantPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/autopilot/v1/assistant/__init__.py b/twilio/rest/autopilot/v1/assistant/__init__.py index 3e139e7fd4..f1867bd0ba 100644 --- a/twilio/rest/autopilot/v1/assistant/__init__.py +++ b/twilio/rest/autopilot/v1/assistant/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,706 +19,193 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.autopilot.v1.assistant.defaults import DefaultsList -from twilio.rest.autopilot.v1.assistant.dialogue import DialogueList -from twilio.rest.autopilot.v1.assistant.field_type import FieldTypeList -from twilio.rest.autopilot.v1.assistant.model_build import ModelBuildList -from twilio.rest.autopilot.v1.assistant.query import QueryList -from twilio.rest.autopilot.v1.assistant.style_sheet import StyleSheetList -from twilio.rest.autopilot.v1.assistant.task import TaskList -from twilio.rest.autopilot.v1.assistant.webhook import WebhookList - - -class AssistantList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the AssistantList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.autopilot.v1.assistant.AssistantList - :rtype: twilio.rest.autopilot.v1.assistant.AssistantList - """ - super(AssistantList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Assistants'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AssistantInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.autopilot.v1.assistant.AssistantInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) +from twilio.base.version import Version - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AssistantInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.autopilot.v1.assistant.AssistantInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AssistantInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AssistantInstance - :rtype: twilio.rest.autopilot.v1.assistant.AssistantPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AssistantPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AssistantInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AssistantInstance - :rtype: twilio.rest.autopilot.v1.assistant.AssistantPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AssistantPage(self._version, response, self._solution) - - def create(self, friendly_name=values.unset, log_queries=values.unset, - unique_name=values.unset, callback_url=values.unset, - callback_events=values.unset, style_sheet=values.unset, - defaults=values.unset): - """ - Create the AssistantInstance - - :param unicode friendly_name: A string to describe the new resource - :param bool log_queries: Whether queries should be logged and kept after training - :param unicode unique_name: An application-defined string that uniquely identifies the new resource - :param unicode callback_url: Reserved - :param unicode callback_events: Reserved - :param dict style_sheet: A JSON string that defines the Assistant's style sheet - :param dict defaults: A JSON object that defines the Assistant's default tasks for various scenarios - - :returns: The created AssistantInstance - :rtype: twilio.rest.autopilot.v1.assistant.AssistantInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'LogQueries': log_queries, - 'UniqueName': unique_name, - 'CallbackUrl': callback_url, - 'CallbackEvents': callback_events, - 'StyleSheet': serialize.object(style_sheet), - 'Defaults': serialize.object(defaults), - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return AssistantInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a AssistantContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.AssistantContext - :rtype: twilio.rest.autopilot.v1.assistant.AssistantContext - """ - return AssistantContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a AssistantContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.AssistantContext - :rtype: twilio.rest.autopilot.v1.assistant.AssistantContext - """ - return AssistantContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AssistantPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the AssistantPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.autopilot.v1.assistant.AssistantPage - :rtype: twilio.rest.autopilot.v1.assistant.AssistantPage - """ - super(AssistantPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AssistantInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.autopilot.v1.assistant.AssistantInstance - :rtype: twilio.rest.autopilot.v1.assistant.AssistantInstance - """ - return AssistantInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.assistant.defaults import DefaultsListInstancefrom twilio.rest.assistant.dialogue import DialogueListInstancefrom twilio.rest.assistant.field_type import FieldTypeListInstancefrom twilio.rest.assistant.model_build import ModelBuildListInstancefrom twilio.rest.assistant.query import QueryListInstancefrom twilio.rest.assistant.style_sheet import StyleSheetListInstancefrom twilio.rest.assistant.task import TaskListInstancefrom twilio.rest.assistant.webhook import WebhookListInstance class AssistantContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the AssistantContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.AssistantContext - :rtype: twilio.rest.autopilot.v1.assistant.AssistantContext - """ - super(AssistantContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Assistants/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Assistants/${sid}' + + self._defaults = None + self._dialogues = None self._field_types = None - self._tasks = None self._model_builds = None self._queries = None self._style_sheet = None - self._defaults = None - self._dialogues = None + self._tasks = None self._webhooks = None + + def delete(self): + + + """ + Deletes the AssistantInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the AssistantInstance :returns: The fetched AssistantInstance - :rtype: twilio.rest.autopilot.v1.assistant.AssistantInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return AssistantInstance(self._version, payload, sid=self._solution['sid'], ) + - def update(self, friendly_name=values.unset, log_queries=values.unset, - unique_name=values.unset, callback_url=values.unset, - callback_events=values.unset, style_sheet=values.unset, - defaults=values.unset, development_stage=values.unset): - """ - Update the AssistantInstance - - :param unicode friendly_name: A string to describe the resource - :param bool log_queries: Whether queries should be logged and kept after training - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode callback_url: Reserved - :param unicode callback_events: Reserved - :param dict style_sheet: A JSON string that defines the Assistant's style sheet - :param dict defaults: A JSON object that defines the Assistant's `default tasks `_ for various scenarios - :param unicode development_stage: A string describing the state of the assistant. - - :returns: The updated AssistantInstance - :rtype: twilio.rest.autopilot.v1.assistant.AssistantInstance - """ + + + def update(self, body): data = values.of({ - 'FriendlyName': friendly_name, - 'LogQueries': log_queries, - 'UniqueName': unique_name, - 'CallbackUrl': callback_url, - 'CallbackEvents': callback_events, - 'StyleSheet': serialize.object(style_sheet), - 'Defaults': serialize.object(defaults), - 'DevelopmentStage': development_stage, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return AssistantInstance(self._version, payload, sid=self._solution['sid'], ) + + - def delete(self): - """ - Deletes the AssistantInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def field_types(self): - """ - Access the field_types - - :returns: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeList - :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeList - """ - if self._field_types is None: - self._field_types = FieldTypeList(self._version, assistant_sid=self._solution['sid'], ) - return self._field_types - - @property - def tasks(self): - """ - Access the tasks - - :returns: twilio.rest.autopilot.v1.assistant.task.TaskList - :rtype: twilio.rest.autopilot.v1.assistant.task.TaskList - """ - if self._tasks is None: - self._tasks = TaskList(self._version, assistant_sid=self._solution['sid'], ) - return self._tasks - - @property - def model_builds(self): - """ - Access the model_builds - - :returns: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildList - :rtype: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildList - """ - if self._model_builds is None: - self._model_builds = ModelBuildList(self._version, assistant_sid=self._solution['sid'], ) - return self._model_builds - - @property - def queries(self): - """ - Access the queries - - :returns: twilio.rest.autopilot.v1.assistant.query.QueryList - :rtype: twilio.rest.autopilot.v1.assistant.query.QueryList - """ - if self._queries is None: - self._queries = QueryList(self._version, assistant_sid=self._solution['sid'], ) - return self._queries - - @property - def style_sheet(self): - """ - Access the style_sheet - - :returns: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetList - :rtype: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetList - """ - if self._style_sheet is None: - self._style_sheet = StyleSheetList(self._version, assistant_sid=self._solution['sid'], ) - return self._style_sheet - - @property - def defaults(self): - """ - Access the defaults - - :returns: twilio.rest.autopilot.v1.assistant.defaults.DefaultsList - :rtype: twilio.rest.autopilot.v1.assistant.defaults.DefaultsList - """ - if self._defaults is None: - self._defaults = DefaultsList(self._version, assistant_sid=self._solution['sid'], ) - return self._defaults - - @property - def dialogues(self): - """ - Access the dialogues - - :returns: twilio.rest.autopilot.v1.assistant.dialogue.DialogueList - :rtype: twilio.rest.autopilot.v1.assistant.dialogue.DialogueList - """ - if self._dialogues is None: - self._dialogues = DialogueList(self._version, assistant_sid=self._solution['sid'], ) - return self._dialogues - - @property - def webhooks(self): - """ - Access the webhooks - - :returns: twilio.rest.autopilot.v1.assistant.webhook.WebhookList - :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookList - """ - if self._webhooks is None: - self._webhooks = WebhookList(self._version, assistant_sid=self._solution['sid'], ) - return self._webhooks + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class AssistantInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, sid=None): - """ - Initialize the AssistantInstance - - :returns: twilio.rest.autopilot.v1.assistant.AssistantInstance - :rtype: twilio.rest.autopilot.v1.assistant.AssistantInstance - """ - super(AssistantInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'latest_model_build_sid': payload.get('latest_model_build_sid'), - 'links': payload.get('links'), - 'log_queries': payload.get('log_queries'), - 'development_stage': payload.get('development_stage'), - 'needs_model_build': payload.get('needs_model_build'), - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'url': payload.get('url'), - 'callback_url': payload.get('callback_url'), - 'callback_events': payload.get('callback_events'), +class AssistantInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'friendly_name' : payload.get('friendly_name'), + 'latest_model_build_sid' : payload.get('latest_model_build_sid'), + 'links' : payload.get('links'), + 'log_queries' : payload.get('log_queries'), + 'development_stage' : payload.get('development_stage'), + 'needs_model_build' : payload.get('needs_model_build'), + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'url' : payload.get('url'), + 'callback_url' : payload.get('callback_url'), + 'callback_events' : payload.get('callback_events'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AssistantContext for this AssistantInstance - :rtype: twilio.rest.autopilot.v1.assistant.AssistantContext - """ if self._context is None: - self._context = AssistantContext(self._version, sid=self._solution['sid'], ) + self._context = AssistantContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def latest_model_build_sid(self): - """ - :returns: Reserved - :rtype: unicode - """ - return self._properties['latest_model_build_sid'] - - @property - def links(self): - """ - :returns: A list of the URLs of the Assistant's related resources - :rtype: unicode - """ - return self._properties['links'] - - @property - def log_queries(self): - """ - :returns: Whether queries should be logged and kept after training - :rtype: bool - """ - return self._properties['log_queries'] - - @property - def development_stage(self): - """ - :returns: A string describing the state of the assistant. - :rtype: unicode - """ - return self._properties['development_stage'] - - @property - def needs_model_build(self): - """ - :returns: Whether model needs to be rebuilt - :rtype: bool - """ - return self._properties['needs_model_build'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def url(self): - """ - :returns: The absolute URL of the Assistant resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def callback_url(self): - """ - :returns: Reserved - :rtype: unicode - """ - return self._properties['callback_url'] - + def defaults(self): + return self._proxy.defaults @property - def callback_events(self): - """ - :returns: Reserved - :rtype: unicode - """ - return self._properties['callback_events'] - - def fetch(self): - """ - Fetch the AssistantInstance - - :returns: The fetched AssistantInstance - :rtype: twilio.rest.autopilot.v1.assistant.AssistantInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, log_queries=values.unset, - unique_name=values.unset, callback_url=values.unset, - callback_events=values.unset, style_sheet=values.unset, - defaults=values.unset, development_stage=values.unset): - """ - Update the AssistantInstance - - :param unicode friendly_name: A string to describe the resource - :param bool log_queries: Whether queries should be logged and kept after training - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode callback_url: Reserved - :param unicode callback_events: Reserved - :param dict style_sheet: A JSON string that defines the Assistant's style sheet - :param dict defaults: A JSON object that defines the Assistant's `default tasks `_ for various scenarios - :param unicode development_stage: A string describing the state of the assistant. - - :returns: The updated AssistantInstance - :rtype: twilio.rest.autopilot.v1.assistant.AssistantInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - log_queries=log_queries, - unique_name=unique_name, - callback_url=callback_url, - callback_events=callback_events, - style_sheet=style_sheet, - defaults=defaults, - development_stage=development_stage, - ) - - def delete(self): - """ - Deletes the AssistantInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - + def dialogues(self): + return self._proxy.dialogues @property def field_types(self): - """ - Access the field_types - - :returns: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeList - :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeList - """ return self._proxy.field_types - - @property - def tasks(self): - """ - Access the tasks - - :returns: twilio.rest.autopilot.v1.assistant.task.TaskList - :rtype: twilio.rest.autopilot.v1.assistant.task.TaskList - """ - return self._proxy.tasks - @property def model_builds(self): - """ - Access the model_builds - - :returns: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildList - :rtype: twilio.rest.autopilot.v1.assistant.model_build.ModelBuildList - """ return self._proxy.model_builds - @property def queries(self): - """ - Access the queries - - :returns: twilio.rest.autopilot.v1.assistant.query.QueryList - :rtype: twilio.rest.autopilot.v1.assistant.query.QueryList - """ return self._proxy.queries - @property def style_sheet(self): - """ - Access the style_sheet - - :returns: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetList - :rtype: twilio.rest.autopilot.v1.assistant.style_sheet.StyleSheetList - """ return self._proxy.style_sheet - @property - def defaults(self): - """ - Access the defaults + def tasks(self): + return self._proxy.tasks + @property + def webhooks(self): + return self._proxy.webhooks + - :returns: twilio.rest.autopilot.v1.assistant.defaults.DefaultsList - :rtype: twilio.rest.autopilot.v1.assistant.defaults.DefaultsList + def __repr__(self): """ - return self._proxy.defaults - - @property - def dialogues(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Access the dialogues + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: twilio.rest.autopilot.v1.assistant.dialogue.DialogueList - :rtype: twilio.rest.autopilot.v1.assistant.dialogue.DialogueList - """ - return self._proxy.dialogues - @property - def webhooks(self): - """ - Access the webhooks - :returns: twilio.rest.autopilot.v1.assistant.webhook.WebhookList - :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookList - """ - return self._proxy.webhooks +class AssistantListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Assistants' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return AssistantInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AssistantPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/autopilot/v1/assistant/field_type.py b/twilio/rest/autopilot/v1/assistant/field_type.py deleted file mode 100644 index f15f7fa404..0000000000 --- a/twilio/rest/autopilot/v1/assistant/field_type.py +++ /dev/null @@ -1,178 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Autopilot - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.field_type.field_value import FieldValueListInstance - - -class FieldTypeContext(InstanceContext): - def __init__(self, version: Version, assistant_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'assistant_sid': assistant_sid, 'sid': sid, } - self._uri = '/Assistants/${assistant_sid}/FieldTypes/${sid}' - - self._field_values = None - - def delete(self): - - - - """ - Deletes the FieldTypeInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the FieldTypeInstance - - :returns: The fetched FieldTypeInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class FieldTypeInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'friendly_name' : payload.get('friendly_name'), - 'links' : payload.get('links'), - 'assistant_sid' : payload.get('assistant_sid'), - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'url' : payload.get('url'), - } - - self._context = None - self._solution = { - 'assistant_sid': assistant_sid or self._properties['assistant_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = FieldTypeContext( - self._version, - assistant_sid=self._solution['assistant_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def field_values(self): - return self._proxy.field_values - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class FieldTypeListInstance(ListResource): - def __init__(self, version: Version, assistant_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'assistant_sid': assistant_sid, } - self._uri = '/Assistants/${assistant_sid}/FieldTypes' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return FieldTypePage(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/autopilot/v1/assistant/field_type/__init__.py b/twilio/rest/autopilot/v1/assistant/field_type/__init__.py index b2c57c8a5a..f15f7fa404 100644 --- a/twilio/rest/autopilot/v1/assistant/field_type/__init__.py +++ b/twilio/rest/autopilot/v1/assistant/field_type/__init__.py @@ -1,472 +1,178 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.autopilot.v1.assistant.field_type.field_value import FieldValueList - - -class FieldTypeList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the FieldTypeList - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the resource - - :returns: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeList - :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeList - """ - super(FieldTypeList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - self._uri = '/Assistants/{assistant_sid}/FieldTypes'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams FieldTypeInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.autopilot.v1.assistant.field_type.FieldTypeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists FieldTypeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.autopilot.v1.assistant.field_type.FieldTypeInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of FieldTypeInstance records from the API. - Request is executed immediately +from twilio.base.version import Version - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of FieldTypeInstance - :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return FieldTypePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FieldTypeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FieldTypeInstance - :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FieldTypePage(self._version, response, self._solution) - - def create(self, unique_name, friendly_name=values.unset): - """ - Create the FieldTypeInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the new resource - :param unicode friendly_name: A string to describe the new resource - - :returns: The created FieldTypeInstance - :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeInstance - """ - data = values.of({'UniqueName': unique_name, 'FriendlyName': friendly_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - - def get(self, sid): - """ - Constructs a FieldTypeContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeContext - :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeContext - """ - return FieldTypeContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a FieldTypeContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeContext - :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeContext - """ - return FieldTypeContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FieldTypePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ +from twilio.base.page import Page - def __init__(self, version, response, solution): - """ - Initialize the FieldTypePage +# from twilio.rest.field_type.field_value import FieldValueListInstance - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The SID of the Assistant that is the parent of the resource - :returns: twilio.rest.autopilot.v1.assistant.field_type.FieldTypePage - :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypePage - """ - super(FieldTypePage, self).__init__(version, response) +class FieldTypeContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FieldTypeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeInstance - :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeInstance - """ - return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FieldTypeContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ + self._solution = { 'assistant_sid': assistant_sid, 'sid': sid, } + self._uri = '/Assistants/${assistant_sid}/FieldTypes/${sid}' + + self._field_values = None + + def delete(self): + + - def __init__(self, version, assistant_sid, sid): """ - Initialize the FieldTypeContext - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the resource to fetch - :param sid: The unique string that identifies the resource + Deletes the FieldTypeInstance - :returns: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeContext - :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeContext + :returns: True if delete succeeds, False otherwise + :rtype: bool """ - super(FieldTypeContext, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'sid': sid, } - self._uri = '/Assistants/{assistant_sid}/FieldTypes/{sid}'.format(**self._solution) - - # Dependents - self._field_values = None - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the FieldTypeInstance :returns: The fetched FieldTypeInstance - :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return FieldTypeInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) + return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) + - def update(self, friendly_name=values.unset, unique_name=values.unset): - """ - Update the FieldTypeInstance + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :param unicode friendly_name: A string to describe the resource - :param unicode unique_name: An application-defined string that uniquely identifies the resource + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: The updated FieldTypeInstance - :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeInstance - """ - data = values.of({'FriendlyName': friendly_name, 'UniqueName': unique_name, }) + return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) + + - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return FieldTypeInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the FieldTypeInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def field_values(self): - """ - Access the field_values - - :returns: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueList - :rtype: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueList - """ - if self._field_values is None: - self._field_values = FieldValueList( - self._version, - assistant_sid=self._solution['assistant_sid'], - field_type_sid=self._solution['sid'], - ) - return self._field_values + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class FieldTypeInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, assistant_sid, sid=None): - """ - Initialize the FieldTypeInstance - :returns: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeInstance - :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeInstance - """ - super(FieldTypeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'links': payload.get('links'), - 'assistant_sid': payload.get('assistant_sid'), - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'url': payload.get('url'), +class FieldTypeInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'friendly_name' : payload.get('friendly_name'), + 'links' : payload.get('links'), + 'assistant_sid' : payload.get('assistant_sid'), + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'url' : payload.get('url'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FieldTypeContext for this FieldTypeInstance - :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeContext - """ if self._context is None: self._context = FieldTypeContext( self._version, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], + assistant_sid=self._solution['assistant_sid'],sid=self._solution['sid'], ) return self._context @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def links(self): - """ - :returns: A list of the URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - - @property - def assistant_sid(self): - """ - :returns: The SID of the Assistant that is the parent of the resource - :rtype: unicode - """ - return self._properties['assistant_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def url(self): - """ - :returns: The absolute URL of the FieldType resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the FieldTypeInstance - - :returns: The fetched FieldTypeInstance - :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeInstance - """ - return self._proxy.fetch() + def field_values(self): + return self._proxy.field_values + - def update(self, friendly_name=values.unset, unique_name=values.unset): + def __repr__(self): """ - Update the FieldTypeInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode unique_name: An application-defined string that uniquely identifies the resource - - :returns: The updated FieldTypeInstance - :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update(friendly_name=friendly_name, unique_name=unique_name, ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the FieldTypeInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - @property - def field_values(self): - """ - Access the field_values +class FieldTypeListInstance(ListResource): + def __init__(self, version: Version, assistant_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueList - :rtype: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueList - """ - return self._proxy.field_values + # Path Solution + self._solution = { 'assistant_sid': assistant_sid, } + self._uri = '/Assistants/${assistant_sid}/FieldTypes' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return FieldTypePage(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/autopilot/v1/assistant/task.py b/twilio/rest/autopilot/v1/assistant/task.py deleted file mode 100644 index 5ac4894a51..0000000000 --- a/twilio/rest/autopilot/v1/assistant/task.py +++ /dev/null @@ -1,191 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Autopilot - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.task.field import FieldListInstancefrom twilio.rest.task.sample import SampleListInstancefrom twilio.rest.task.task_actions import TaskActionsListInstancefrom twilio.rest.task.task_statistics import TaskStatisticsListInstance - - -class TaskContext(InstanceContext): - def __init__(self, version: Version, assistant_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'assistant_sid': assistant_sid, 'sid': sid, } - self._uri = '/Assistants/${assistant_sid}/Tasks/${sid}' - - self._fields = None - self._samples = None - self._task_actions = None - self._statistics = None - - def delete(self): - - - - """ - Deletes the TaskInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the TaskInstance - - :returns: The fetched TaskInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TaskInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return TaskInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class TaskInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'friendly_name' : payload.get('friendly_name'), - 'links' : payload.get('links'), - 'assistant_sid' : payload.get('assistant_sid'), - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'actions_url' : payload.get('actions_url'), - 'url' : payload.get('url'), - } - - self._context = None - self._solution = { - 'assistant_sid': assistant_sid or self._properties['assistant_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = TaskContext( - self._version, - assistant_sid=self._solution['assistant_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def fields(self): - return self._proxy.fields - @property - def samples(self): - return self._proxy.samples - @property - def task_actions(self): - return self._proxy.task_actions - @property - def statistics(self): - return self._proxy.statistics - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class TaskListInstance(ListResource): - def __init__(self, version: Version, assistant_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'assistant_sid': assistant_sid, } - self._uri = '/Assistants/${assistant_sid}/Tasks' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return TaskInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return TaskPage(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/autopilot/v1/assistant/task/__init__.py b/twilio/rest/autopilot/v1/assistant/task/__init__.py index 94dfdedfa7..5ac4894a51 100644 --- a/twilio/rest/autopilot/v1/assistant/task/__init__.py +++ b/twilio/rest/autopilot/v1/assistant/task/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Autopilot + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,283 +19,31 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.autopilot.v1.assistant.task.field import FieldList -from twilio.rest.autopilot.v1.assistant.task.sample import SampleList -from twilio.rest.autopilot.v1.assistant.task.task_actions import TaskActionsList -from twilio.rest.autopilot.v1.assistant.task.task_statistics import TaskStatisticsList - - -class TaskList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the TaskList - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the resource - - :returns: twilio.rest.autopilot.v1.assistant.task.TaskList - :rtype: twilio.rest.autopilot.v1.assistant.task.TaskList - """ - super(TaskList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - self._uri = '/Assistants/{assistant_sid}/Tasks'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams TaskInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.autopilot.v1.assistant.task.TaskInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists TaskInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.autopilot.v1.assistant.task.TaskInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of TaskInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of TaskInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.TaskPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return TaskPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TaskInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TaskInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.TaskPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TaskPage(self._version, response, self._solution) - - def create(self, unique_name, friendly_name=values.unset, actions=values.unset, - actions_url=values.unset): - """ - Create the TaskInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode friendly_name: descriptive string that you create to describe the new resource - :param dict actions: The JSON string that specifies the actions that instruct the Assistant on how to perform the task - :param unicode actions_url: The URL from which the Assistant can fetch actions - - :returns: The created TaskInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.TaskInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'FriendlyName': friendly_name, - 'Actions': serialize.object(actions), - 'ActionsUrl': actions_url, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return TaskInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - - def get(self, sid): - """ - Constructs a TaskContext - - :param sid: The unique string that identifies the resource to fetch - - :returns: twilio.rest.autopilot.v1.assistant.task.TaskContext - :rtype: twilio.rest.autopilot.v1.assistant.task.TaskContext - """ - return TaskContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a TaskContext - - :param sid: The unique string that identifies the resource to fetch - - :returns: twilio.rest.autopilot.v1.assistant.task.TaskContext - :rtype: twilio.rest.autopilot.v1.assistant.task.TaskContext - """ - return TaskContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TaskPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the TaskPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The SID of the Assistant that is the parent of the resource - - :returns: twilio.rest.autopilot.v1.assistant.task.TaskPage - :rtype: twilio.rest.autopilot.v1.assistant.task.TaskPage - """ - super(TaskPage, self).__init__(version, response) +from twilio.base.version import Version - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TaskInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.autopilot.v1.assistant.task.TaskInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.TaskInstance - """ - return TaskInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.task.field import FieldListInstancefrom twilio.rest.task.sample import SampleListInstancefrom twilio.rest.task.task_actions import TaskActionsListInstancefrom twilio.rest.task.task_statistics import TaskStatisticsListInstance class TaskContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, sid): - """ - Initialize the TaskContext - - :param Version version: Version that contains the resource - :param assistant_sid: The SID of the Assistant that is the parent of the resource to fetch - :param sid: The unique string that identifies the resource to fetch - - :returns: twilio.rest.autopilot.v1.assistant.task.TaskContext - :rtype: twilio.rest.autopilot.v1.assistant.task.TaskContext - """ - super(TaskContext, self).__init__(version) + def __init__(self, version: Version, assistant_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'sid': sid, } - self._uri = '/Assistants/{assistant_sid}/Tasks/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'assistant_sid': assistant_sid, 'sid': sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks/${sid}' + self._fields = None self._samples = None self._task_actions = None self._statistics = None - - def fetch(self): - """ - Fetch the TaskInstance - - :returns: The fetched TaskInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.TaskInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TaskInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset, unique_name=values.unset, - actions=values.unset, actions_url=values.unset): - """ - Update the TaskInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param dict actions: The JSON string that specifies the actions that instruct the Assistant on how to perform the task - :param unicode actions_url: The URL from which the Assistant can fetch actions - - :returns: The updated TaskInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.TaskInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Actions': serialize.object(actions), - 'ActionsUrl': actions_url, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return TaskInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the TaskInstance @@ -296,295 +51,141 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def fields(self): + + def fetch(self): + """ - Access the fields + Fetch the TaskInstance - :returns: twilio.rest.autopilot.v1.assistant.task.field.FieldList - :rtype: twilio.rest.autopilot.v1.assistant.task.field.FieldList + :returns: The fetched TaskInstance + #TODO: add rtype docs """ - if self._fields is None: - self._fields = FieldList( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['sid'], - ) - return self._fields + payload = self._version.fetch(method='GET', uri=self._uri, ) - @property - def samples(self): - """ - Access the samples + return TaskInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) + - :returns: twilio.rest.autopilot.v1.assistant.task.sample.SampleList - :rtype: twilio.rest.autopilot.v1.assistant.task.sample.SampleList - """ - if self._samples is None: - self._samples = SampleList( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['sid'], - ) - return self._samples + + + def update(self, body): + data = values.of({ + 'body': body, + }) - @property - def task_actions(self): - """ - Access the task_actions + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsList - :rtype: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsList - """ - if self._task_actions is None: - self._task_actions = TaskActionsList( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['sid'], - ) - return self._task_actions + return TaskInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) + + - @property - def statistics(self): - """ - Access the statistics - - :returns: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsList - :rtype: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsList - """ - if self._statistics is None: - self._statistics = TaskStatisticsList( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['sid'], - ) - return self._statistics + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class TaskInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, assistant_sid, sid=None): - """ - Initialize the TaskInstance - :returns: twilio.rest.autopilot.v1.assistant.task.TaskInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.TaskInstance - """ - super(TaskInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'links': payload.get('links'), - 'assistant_sid': payload.get('assistant_sid'), - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'actions_url': payload.get('actions_url'), - 'url': payload.get('url'), +class TaskInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'friendly_name' : payload.get('friendly_name'), + 'links' : payload.get('links'), + 'assistant_sid' : payload.get('assistant_sid'), + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'actions_url' : payload.get('actions_url'), + 'url' : payload.get('url'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TaskContext for this TaskInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.TaskContext - """ if self._context is None: self._context = TaskContext( self._version, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], + assistant_sid=self._solution['assistant_sid'],sid=self._solution['sid'], ) return self._context @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def links(self): - """ - :returns: A list of the URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - - @property - def assistant_sid(self): - """ - :returns: The SID of the Assistant that is the parent of the resource - :rtype: unicode - """ - return self._properties['assistant_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - + def fields(self): + return self._proxy.fields @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - + def samples(self): + return self._proxy.samples @property - def actions_url(self): - """ - :returns: The URL from which the Assistant can fetch actions - :rtype: unicode - """ - return self._properties['actions_url'] - + def task_actions(self): + return self._proxy.task_actions @property - def url(self): - """ - :returns: The absolute URL of the Task resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the TaskInstance - - :returns: The fetched TaskInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.TaskInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, unique_name=values.unset, - actions=values.unset, actions_url=values.unset): - """ - Update the TaskInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param dict actions: The JSON string that specifies the actions that instruct the Assistant on how to perform the task - :param unicode actions_url: The URL from which the Assistant can fetch actions - - :returns: The updated TaskInstance - :rtype: twilio.rest.autopilot.v1.assistant.task.TaskInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - unique_name=unique_name, - actions=actions, - actions_url=actions_url, - ) + def statistics(self): + return self._proxy.statistics + - def delete(self): + def __repr__(self): """ - Deletes the TaskInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.delete() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def fields(self): - """ - Access the fields - :returns: twilio.rest.autopilot.v1.assistant.task.field.FieldList - :rtype: twilio.rest.autopilot.v1.assistant.task.field.FieldList - """ - return self._proxy.fields - @property - def samples(self): - """ - Access the samples +class TaskListInstance(ListResource): + def __init__(self, version: Version, assistant_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.autopilot.v1.assistant.task.sample.SampleList - :rtype: twilio.rest.autopilot.v1.assistant.task.sample.SampleList - """ - return self._proxy.samples + # Path Solution + self._solution = { 'assistant_sid': assistant_sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def task_actions(self): - """ - Access the task_actions + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsList - :rtype: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsList - """ - return self._proxy.task_actions + return TaskInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def statistics(self): - """ - Access the statistics + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsList - :rtype: twilio.rest.autopilot.v1.assistant.task.task_statistics.TaskStatisticsList - """ - return self._proxy.statistics + return TaskPage(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/bulkexports/v1/export.py b/twilio/rest/bulkexports/v1/export.py deleted file mode 100644 index acab1311ec..0000000000 --- a/twilio/rest/bulkexports/v1/export.py +++ /dev/null @@ -1,126 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Bulkexports - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.rest.export.day import DayListInstancefrom twilio.rest.export.export_custom_job import ExportCustomJobListInstancefrom twilio.rest.export.job import JobListInstance - - -class ExportContext(InstanceContext): - def __init__(self, version: Version, resource_type: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'resource_type': resource_type, } - self._uri = '/Exports/${resource_type}' - - self._days = None - self._export_custom_jobs = None - - def fetch(self): - - """ - Fetch the ExportInstance - - :returns: The fetched ExportInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ExportInstance(self._version, payload, resource_type=self._solution['resource_type'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ExportInstance(InstanceResource): - def __init__(self, version, payload, resource_type: str): - super().__init__(version) - self._properties = { - 'resource_type' : payload.get('resource_type'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'resource_type': resource_type or self._properties['resource_type'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ExportContext( - self._version, - resource_type=self._solution['resource_type'], - ) - return self._context - - @property - def days(self): - return self._proxy.days - @property - def export_custom_jobs(self): - return self._proxy.export_custom_jobs - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ExportListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Exports' - - self._jobs = None - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/bulkexports/v1/export/__init__.py b/twilio/rest/bulkexports/v1/export/__init__.py index ba056dbb61..acab1311ec 100644 --- a/twilio/rest/bulkexports/v1/export/__init__.py +++ b/twilio/rest/bulkexports/v1/export/__init__.py @@ -1,287 +1,126 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Bulkexports + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.bulkexports.v1.export.day import DayList -from twilio.rest.bulkexports.v1.export.export_custom_job import ExportCustomJobList -from twilio.rest.bulkexports.v1.export.job import JobList - - -class ExportList(ListResource): - - def __init__(self, version): - """ - Initialize the ExportList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.bulkexports.v1.export.ExportList - :rtype: twilio.rest.bulkexports.v1.export.ExportList - """ - super(ExportList, self).__init__(version) - - # Path Solution - self._solution = {} - - # Components - self._jobs = None - - @property - def jobs(self): - """ - Access the jobs - - :returns: twilio.rest.bulkexports.v1.export.job.JobList - :rtype: twilio.rest.bulkexports.v1.export.job.JobList - """ - if self._jobs is None: - self._jobs = JobList(self._version, ) - return self._jobs - - def get(self, resource_type): - """ - Constructs a ExportContext - - :param resource_type: The type of communication – Messages, Calls, Conferences, and Participants - - :returns: twilio.rest.bulkexports.v1.export.ExportContext - :rtype: twilio.rest.bulkexports.v1.export.ExportContext - """ - return ExportContext(self._version, resource_type=resource_type, ) - - def __call__(self, resource_type): - """ - Constructs a ExportContext - - :param resource_type: The type of communication – Messages, Calls, Conferences, and Participants - - :returns: twilio.rest.bulkexports.v1.export.ExportContext - :rtype: twilio.rest.bulkexports.v1.export.ExportContext - """ - return ExportContext(self._version, resource_type=resource_type, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ExportPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ExportPage +from twilio.base.version import Version - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.bulkexports.v1.export.ExportPage - :rtype: twilio.rest.bulkexports.v1.export.ExportPage - """ - super(ExportPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ExportInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.bulkexports.v1.export.ExportInstance - :rtype: twilio.rest.bulkexports.v1.export.ExportInstance - """ - return ExportInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.export.day import DayListInstancefrom twilio.rest.export.export_custom_job import ExportCustomJobListInstancefrom twilio.rest.export.job import JobListInstance class ExportContext(InstanceContext): - - def __init__(self, version, resource_type): - """ - Initialize the ExportContext - - :param Version version: Version that contains the resource - :param resource_type: The type of communication – Messages, Calls, Conferences, and Participants - - :returns: twilio.rest.bulkexports.v1.export.ExportContext - :rtype: twilio.rest.bulkexports.v1.export.ExportContext - """ - super(ExportContext, self).__init__(version) + def __init__(self, version: Version, resource_type: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'resource_type': resource_type, } - self._uri = '/Exports/{resource_type}'.format(**self._solution) - - # Dependents + self._solution = { 'resource_type': resource_type, } + self._uri = '/Exports/${resource_type}' + self._days = None self._export_custom_jobs = None - + def fetch(self): + """ Fetch the ExportInstance :returns: The fetched ExportInstance - :rtype: twilio.rest.bulkexports.v1.export.ExportInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return ExportInstance(self._version, payload, resource_type=self._solution['resource_type'], ) + - @property - def days(self): - """ - Access the days - - :returns: twilio.rest.bulkexports.v1.export.day.DayList - :rtype: twilio.rest.bulkexports.v1.export.day.DayList - """ - if self._days is None: - self._days = DayList(self._version, resource_type=self._solution['resource_type'], ) - return self._days - - @property - def export_custom_jobs(self): - """ - Access the export_custom_jobs - - :returns: twilio.rest.bulkexports.v1.export.export_custom_job.ExportCustomJobList - :rtype: twilio.rest.bulkexports.v1.export.export_custom_job.ExportCustomJobList - """ - if self._export_custom_jobs is None: - self._export_custom_jobs = ExportCustomJobList( - self._version, - resource_type=self._solution['resource_type'], - ) - return self._export_custom_jobs + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ExportInstance(InstanceResource): - def __init__(self, version, payload, resource_type=None): - """ - Initialize the ExportInstance - - :returns: twilio.rest.bulkexports.v1.export.ExportInstance - :rtype: twilio.rest.bulkexports.v1.export.ExportInstance - """ - super(ExportInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'resource_type': payload.get('resource_type'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ExportInstance(InstanceResource): + def __init__(self, version, payload, resource_type: str): + super().__init__(version) + self._properties = { + 'resource_type' : payload.get('resource_type'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'resource_type': resource_type or self._properties['resource_type'], } + self._solution = { + 'resource_type': resource_type or self._properties['resource_type'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ExportContext for this ExportInstance - :rtype: twilio.rest.bulkexports.v1.export.ExportContext - """ if self._context is None: - self._context = ExportContext(self._version, resource_type=self._solution['resource_type'], ) + self._context = ExportContext( + self._version, + resource_type=self._solution['resource_type'], + ) return self._context @property - def resource_type(self): - """ - :returns: The type of communication – Messages, Calls, Conferences, and Participants - :rtype: unicode - """ - return self._properties['resource_type'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - + def days(self): + return self._proxy.days @property - def links(self): - """ - :returns: Nested resource URLs. - :rtype: unicode - """ - return self._properties['links'] + def export_custom_jobs(self): + return self._proxy.export_custom_jobs + - def fetch(self): + def __repr__(self): """ - Fetch the ExportInstance - - :returns: The fetched ExportInstance - :rtype: twilio.rest.bulkexports.v1.export.ExportInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def days(self): - """ - Access the days - :returns: twilio.rest.bulkexports.v1.export.day.DayList - :rtype: twilio.rest.bulkexports.v1.export.day.DayList - """ - return self._proxy.days - @property - def export_custom_jobs(self): - """ - Access the export_custom_jobs +class ExportListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.bulkexports.v1.export.export_custom_job.ExportCustomJobList - :rtype: twilio.rest.bulkexports.v1.export.export_custom_job.ExportCustomJobList - """ - return self._proxy.export_custom_jobs + # Path Solution + self._solution = { } + self._uri = '/Exports' + + self._jobs = None + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v1/service.py b/twilio/rest/chat/v1/service.py deleted file mode 100644 index e5b20d0ab4..0000000000 --- a/twilio/rest/chat/v1/service.py +++ /dev/null @@ -1,198 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Chat - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.service.channel import ChannelListInstancefrom twilio.rest.service.role import RoleListInstancefrom twilio.rest.service.user import UserListInstance - - -class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Services/${sid}' - - self._channels = None - self._roles = None - self._users = None - - def delete(self): - - - - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'default_service_role_sid' : payload.get('default_service_role_sid'), - 'default_channel_role_sid' : payload.get('default_channel_role_sid'), - 'default_channel_creator_role_sid' : payload.get('default_channel_creator_role_sid'), - 'read_status_enabled' : payload.get('read_status_enabled'), - 'reachability_enabled' : payload.get('reachability_enabled'), - 'typing_indicator_timeout' : payload.get('typing_indicator_timeout'), - 'consumption_report_interval' : payload.get('consumption_report_interval'), - 'limits' : payload.get('limits'), - 'webhooks' : payload.get('webhooks'), - 'pre_webhook_url' : payload.get('pre_webhook_url'), - 'post_webhook_url' : payload.get('post_webhook_url'), - 'webhook_method' : payload.get('webhook_method'), - 'webhook_filters' : payload.get('webhook_filters'), - 'notifications' : payload.get('notifications'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ServiceContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def channels(self): - return self._proxy.channels - @property - def roles(self): - return self._proxy.roles - @property - def users(self): - return self._proxy.users - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ServiceListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Services' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ServicePage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/chat/v1/service/__init__.py b/twilio/rest/chat/v1/service/__init__.py index 709dc88c4f..e5b20d0ab4 100644 --- a/twilio/rest/chat/v1/service/__init__.py +++ b/twilio/rest/chat/v1/service/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,898 +19,180 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.chat.v1.service.channel import ChannelList -from twilio.rest.chat.v1.service.role import RoleList -from twilio.rest.chat.v1.service.user import UserList - - -class ServiceList(ListResource): - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.chat.v1.service.ServiceList - :rtype: twilio.rest.chat.v1.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def create(self, friendly_name): - """ - Create the ServiceInstance - - :param unicode friendly_name: A string to describe the resource +from twilio.base.version import Version - :returns: The created ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.chat.v1.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServicePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.ServiceContext - :rtype: twilio.rest.chat.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.ServiceContext - :rtype: twilio.rest.chat.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ServicePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.chat.v1.service.ServicePage - :rtype: twilio.rest.chat.v1.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.service.channel import ChannelListInstancefrom twilio.rest.service.role import RoleListInstancefrom twilio.rest.service.user import UserListInstance class ServiceContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.ServiceContext - :rtype: twilio.rest.chat.v1.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Services/${sid}' + self._channels = None self._roles = None self._users = None + + def delete(self): + + + + """ + Deletes the ServiceInstance + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the ServiceInstance :returns: The fetched ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, friendly_name=values.unset, - default_service_role_sid=values.unset, - default_channel_role_sid=values.unset, - default_channel_creator_role_sid=values.unset, - read_status_enabled=values.unset, reachability_enabled=values.unset, - typing_indicator_timeout=values.unset, - consumption_report_interval=values.unset, - notifications_new_message_enabled=values.unset, - notifications_new_message_template=values.unset, - notifications_added_to_channel_enabled=values.unset, - notifications_added_to_channel_template=values.unset, - notifications_removed_from_channel_enabled=values.unset, - notifications_removed_from_channel_template=values.unset, - notifications_invited_to_channel_enabled=values.unset, - notifications_invited_to_channel_template=values.unset, - pre_webhook_url=values.unset, post_webhook_url=values.unset, - webhook_method=values.unset, webhook_filters=values.unset, - webhooks_on_message_send_url=values.unset, - webhooks_on_message_send_method=values.unset, - webhooks_on_message_update_url=values.unset, - webhooks_on_message_update_method=values.unset, - webhooks_on_message_remove_url=values.unset, - webhooks_on_message_remove_method=values.unset, - webhooks_on_channel_add_url=values.unset, - webhooks_on_channel_add_method=values.unset, - webhooks_on_channel_destroy_url=values.unset, - webhooks_on_channel_destroy_method=values.unset, - webhooks_on_channel_update_url=values.unset, - webhooks_on_channel_update_method=values.unset, - webhooks_on_member_add_url=values.unset, - webhooks_on_member_add_method=values.unset, - webhooks_on_member_remove_url=values.unset, - webhooks_on_member_remove_method=values.unset, - webhooks_on_message_sent_url=values.unset, - webhooks_on_message_sent_method=values.unset, - webhooks_on_message_updated_url=values.unset, - webhooks_on_message_updated_method=values.unset, - webhooks_on_message_removed_url=values.unset, - webhooks_on_message_removed_method=values.unset, - webhooks_on_channel_added_url=values.unset, - webhooks_on_channel_added_method=values.unset, - webhooks_on_channel_destroyed_url=values.unset, - webhooks_on_channel_destroyed_method=values.unset, - webhooks_on_channel_updated_url=values.unset, - webhooks_on_channel_updated_method=values.unset, - webhooks_on_member_added_url=values.unset, - webhooks_on_member_added_method=values.unset, - webhooks_on_member_removed_url=values.unset, - webhooks_on_member_removed_method=values.unset, - limits_channel_members=values.unset, - limits_user_channels=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode default_service_role_sid: The service role assigned to users when they are added to the service - :param unicode default_channel_role_sid: The channel role assigned to users when they are added to a channel - :param unicode default_channel_creator_role_sid: The channel role assigned to a channel creator when they join a new channel - :param bool read_status_enabled: Whether to enable the Message Consumption Horizon feature - :param bool reachability_enabled: Whether to enable the Reachability Indicator feature for this Service instance - :param unicode typing_indicator_timeout: How long in seconds to wait before assuming the user is no longer typing - :param unicode consumption_report_interval: DEPRECATED - :param bool notifications_new_message_enabled: Whether to send a notification when a new message is added to a channel - :param unicode notifications_new_message_template: The template to use to create the notification text displayed when a new message is added to a channel - :param bool notifications_added_to_channel_enabled: Whether to send a notification when a member is added to a channel - :param unicode notifications_added_to_channel_template: The template to use to create the notification text displayed when a member is added to a channel - :param bool notifications_removed_from_channel_enabled: Whether to send a notification to a user when they are removed from a channel - :param unicode notifications_removed_from_channel_template: The template to use to create the notification text displayed to a user when they are removed - :param bool notifications_invited_to_channel_enabled: Whether to send a notification when a user is invited to a channel - :param unicode notifications_invited_to_channel_template: The template to use to create the notification text displayed when a user is invited to a channel - :param unicode pre_webhook_url: The webhook URL for pre-event webhooks - :param unicode post_webhook_url: The URL for post-event webhooks - :param unicode webhook_method: The HTTP method to use for both PRE and POST webhooks - :param list[unicode] webhook_filters: The list of WebHook events that are enabled for this Service instance - :param unicode webhooks_on_message_send_url: The URL of the webhook to call in response to the on_message_send event - :param unicode webhooks_on_message_send_method: The HTTP method to use when calling the webhooks.on_message_send.url - :param unicode webhooks_on_message_update_url: The URL of the webhook to call in response to the on_message_update event - :param unicode webhooks_on_message_update_method: The HTTP method to use when calling the webhooks.on_message_update.url - :param unicode webhooks_on_message_remove_url: The URL of the webhook to call in response to the on_message_remove event - :param unicode webhooks_on_message_remove_method: The HTTP method to use when calling the webhooks.on_message_remove.url - :param unicode webhooks_on_channel_add_url: The URL of the webhook to call in response to the on_channel_add event - :param unicode webhooks_on_channel_add_method: The HTTP method to use when calling the webhooks.on_channel_add.url - :param unicode webhooks_on_channel_destroy_url: The URL of the webhook to call in response to the on_channel_destroy event - :param unicode webhooks_on_channel_destroy_method: The HTTP method to use when calling the webhooks.on_channel_destroy.url - :param unicode webhooks_on_channel_update_url: The URL of the webhook to call in response to the on_channel_update event - :param unicode webhooks_on_channel_update_method: The HTTP method to use when calling the webhooks.on_channel_update.url - :param unicode webhooks_on_member_add_url: The URL of the webhook to call in response to the on_member_add event - :param unicode webhooks_on_member_add_method: The HTTP method to use when calling the webhooks.on_member_add.url - :param unicode webhooks_on_member_remove_url: The URL of the webhook to call in response to the on_member_remove event - :param unicode webhooks_on_member_remove_method: The HTTP method to use when calling the webhooks.on_member_remove.url - :param unicode webhooks_on_message_sent_url: The URL of the webhook to call in response to the on_message_sent event - :param unicode webhooks_on_message_sent_method: The URL of the webhook to call in response to the on_message_sent event - :param unicode webhooks_on_message_updated_url: The URL of the webhook to call in response to the on_message_updated event - :param unicode webhooks_on_message_updated_method: The HTTP method to use when calling the webhooks.on_message_updated.url - :param unicode webhooks_on_message_removed_url: The URL of the webhook to call in response to the on_message_removed event - :param unicode webhooks_on_message_removed_method: The HTTP method to use when calling the webhooks.on_message_removed.url - :param unicode webhooks_on_channel_added_url: The URL of the webhook to call in response to the on_channel_added event - :param unicode webhooks_on_channel_added_method: The URL of the webhook to call in response to the on_channel_added event - :param unicode webhooks_on_channel_destroyed_url: The URL of the webhook to call in response to the on_channel_added event - :param unicode webhooks_on_channel_destroyed_method: The HTTP method to use when calling the webhooks.on_channel_destroyed.url - :param unicode webhooks_on_channel_updated_url: he URL of the webhook to call in response to the on_channel_updated event - :param unicode webhooks_on_channel_updated_method: The HTTP method to use when calling the webhooks.on_channel_updated.url - :param unicode webhooks_on_member_added_url: The URL of the webhook to call in response to the on_channel_updated event - :param unicode webhooks_on_member_added_method: he HTTP method to use when calling the webhooks.on_channel_updated.url - :param unicode webhooks_on_member_removed_url: The URL of the webhook to call in response to the on_member_removed event - :param unicode webhooks_on_member_removed_method: The HTTP method to use when calling the webhooks.on_member_removed.url - :param unicode limits_channel_members: The maximum number of Members that can be added to Channels within this Service - :param unicode limits_user_channels: The maximum number of Channels Users can be a Member of within this Service - - :returns: The updated ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance - """ + + + def update(self, body): data = values.of({ - 'FriendlyName': friendly_name, - 'DefaultServiceRoleSid': default_service_role_sid, - 'DefaultChannelRoleSid': default_channel_role_sid, - 'DefaultChannelCreatorRoleSid': default_channel_creator_role_sid, - 'ReadStatusEnabled': read_status_enabled, - 'ReachabilityEnabled': reachability_enabled, - 'TypingIndicatorTimeout': typing_indicator_timeout, - 'ConsumptionReportInterval': consumption_report_interval, - 'Notifications.NewMessage.Enabled': notifications_new_message_enabled, - 'Notifications.NewMessage.Template': notifications_new_message_template, - 'Notifications.AddedToChannel.Enabled': notifications_added_to_channel_enabled, - 'Notifications.AddedToChannel.Template': notifications_added_to_channel_template, - 'Notifications.RemovedFromChannel.Enabled': notifications_removed_from_channel_enabled, - 'Notifications.RemovedFromChannel.Template': notifications_removed_from_channel_template, - 'Notifications.InvitedToChannel.Enabled': notifications_invited_to_channel_enabled, - 'Notifications.InvitedToChannel.Template': notifications_invited_to_channel_template, - 'PreWebhookUrl': pre_webhook_url, - 'PostWebhookUrl': post_webhook_url, - 'WebhookMethod': webhook_method, - 'WebhookFilters': serialize.map(webhook_filters, lambda e: e), - 'Webhooks.OnMessageSend.Url': webhooks_on_message_send_url, - 'Webhooks.OnMessageSend.Method': webhooks_on_message_send_method, - 'Webhooks.OnMessageUpdate.Url': webhooks_on_message_update_url, - 'Webhooks.OnMessageUpdate.Method': webhooks_on_message_update_method, - 'Webhooks.OnMessageRemove.Url': webhooks_on_message_remove_url, - 'Webhooks.OnMessageRemove.Method': webhooks_on_message_remove_method, - 'Webhooks.OnChannelAdd.Url': webhooks_on_channel_add_url, - 'Webhooks.OnChannelAdd.Method': webhooks_on_channel_add_method, - 'Webhooks.OnChannelDestroy.Url': webhooks_on_channel_destroy_url, - 'Webhooks.OnChannelDestroy.Method': webhooks_on_channel_destroy_method, - 'Webhooks.OnChannelUpdate.Url': webhooks_on_channel_update_url, - 'Webhooks.OnChannelUpdate.Method': webhooks_on_channel_update_method, - 'Webhooks.OnMemberAdd.Url': webhooks_on_member_add_url, - 'Webhooks.OnMemberAdd.Method': webhooks_on_member_add_method, - 'Webhooks.OnMemberRemove.Url': webhooks_on_member_remove_url, - 'Webhooks.OnMemberRemove.Method': webhooks_on_member_remove_method, - 'Webhooks.OnMessageSent.Url': webhooks_on_message_sent_url, - 'Webhooks.OnMessageSent.Method': webhooks_on_message_sent_method, - 'Webhooks.OnMessageUpdated.Url': webhooks_on_message_updated_url, - 'Webhooks.OnMessageUpdated.Method': webhooks_on_message_updated_method, - 'Webhooks.OnMessageRemoved.Url': webhooks_on_message_removed_url, - 'Webhooks.OnMessageRemoved.Method': webhooks_on_message_removed_method, - 'Webhooks.OnChannelAdded.Url': webhooks_on_channel_added_url, - 'Webhooks.OnChannelAdded.Method': webhooks_on_channel_added_method, - 'Webhooks.OnChannelDestroyed.Url': webhooks_on_channel_destroyed_url, - 'Webhooks.OnChannelDestroyed.Method': webhooks_on_channel_destroyed_method, - 'Webhooks.OnChannelUpdated.Url': webhooks_on_channel_updated_url, - 'Webhooks.OnChannelUpdated.Method': webhooks_on_channel_updated_method, - 'Webhooks.OnMemberAdded.Url': webhooks_on_member_added_url, - 'Webhooks.OnMemberAdded.Method': webhooks_on_member_added_method, - 'Webhooks.OnMemberRemoved.Url': webhooks_on_member_removed_url, - 'Webhooks.OnMemberRemoved.Method': webhooks_on_member_removed_method, - 'Limits.ChannelMembers': limits_channel_members, - 'Limits.UserChannels': limits_user_channels, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def channels(self): - """ - Access the channels - - :returns: twilio.rest.chat.v1.service.channel.ChannelList - :rtype: twilio.rest.chat.v1.service.channel.ChannelList - """ - if self._channels is None: - self._channels = ChannelList(self._version, service_sid=self._solution['sid'], ) - return self._channels - - @property - def roles(self): - """ - Access the roles - - :returns: twilio.rest.chat.v1.service.role.RoleList - :rtype: twilio.rest.chat.v1.service.role.RoleList - """ - if self._roles is None: - self._roles = RoleList(self._version, service_sid=self._solution['sid'], ) - return self._roles - - @property - def users(self): - """ - Access the users - - :returns: twilio.rest.chat.v1.service.user.UserList - :rtype: twilio.rest.chat.v1.service.user.UserList - """ - if self._users is None: - self._users = UserList(self._version, service_sid=self._solution['sid'], ) - return self._users + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ServiceInstance(InstanceResource): - - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - :returns: twilio.rest.chat.v1.service.ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'default_service_role_sid': payload.get('default_service_role_sid'), - 'default_channel_role_sid': payload.get('default_channel_role_sid'), - 'default_channel_creator_role_sid': payload.get('default_channel_creator_role_sid'), - 'read_status_enabled': payload.get('read_status_enabled'), - 'reachability_enabled': payload.get('reachability_enabled'), - 'typing_indicator_timeout': deserialize.integer(payload.get('typing_indicator_timeout')), - 'consumption_report_interval': deserialize.integer(payload.get('consumption_report_interval')), - 'limits': payload.get('limits'), - 'webhooks': payload.get('webhooks'), - 'pre_webhook_url': payload.get('pre_webhook_url'), - 'post_webhook_url': payload.get('post_webhook_url'), - 'webhook_method': payload.get('webhook_method'), - 'webhook_filters': payload.get('webhook_filters'), - 'notifications': payload.get('notifications'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'default_service_role_sid' : payload.get('default_service_role_sid'), + 'default_channel_role_sid' : payload.get('default_channel_role_sid'), + 'default_channel_creator_role_sid' : payload.get('default_channel_creator_role_sid'), + 'read_status_enabled' : payload.get('read_status_enabled'), + 'reachability_enabled' : payload.get('reachability_enabled'), + 'typing_indicator_timeout' : payload.get('typing_indicator_timeout'), + 'consumption_report_interval' : payload.get('consumption_report_interval'), + 'limits' : payload.get('limits'), + 'webhooks' : payload.get('webhooks'), + 'pre_webhook_url' : payload.get('pre_webhook_url'), + 'post_webhook_url' : payload.get('post_webhook_url'), + 'webhook_method' : payload.get('webhook_method'), + 'webhook_filters' : payload.get('webhook_filters'), + 'notifications' : payload.get('notifications'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceContext - """ if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def default_service_role_sid(self): - """ - :returns: The service role assigned to users when they are added to the service - :rtype: unicode - """ - return self._properties['default_service_role_sid'] - - @property - def default_channel_role_sid(self): - """ - :returns: The channel role assigned to users when they are added to a channel - :rtype: unicode - """ - return self._properties['default_channel_role_sid'] - - @property - def default_channel_creator_role_sid(self): - """ - :returns: The channel role assigned to a channel creator when they join a new channel - :rtype: unicode - """ - return self._properties['default_channel_creator_role_sid'] - - @property - def read_status_enabled(self): - """ - :returns: Whether the Message Consumption Horizon feature is enabled - :rtype: bool - """ - return self._properties['read_status_enabled'] - - @property - def reachability_enabled(self): - """ - :returns: Whether the Reachability Indicator feature is enabled for this Service instance - :rtype: bool - """ - return self._properties['reachability_enabled'] - - @property - def typing_indicator_timeout(self): - """ - :returns: How long in seconds to wait before assuming the user is no longer typing - :rtype: unicode - """ - return self._properties['typing_indicator_timeout'] - - @property - def consumption_report_interval(self): - """ - :returns: DEPRECATED - :rtype: unicode - """ - return self._properties['consumption_report_interval'] - - @property - def limits(self): - """ - :returns: An object that describes the limits of the service instance - :rtype: dict - """ - return self._properties['limits'] - - @property - def webhooks(self): - """ - :returns: An object that contains information about the webhooks configured for this service - :rtype: dict - """ - return self._properties['webhooks'] - - @property - def pre_webhook_url(self): - """ - :returns: The webhook URL for pre-event webhooks - :rtype: unicode - """ - return self._properties['pre_webhook_url'] - - @property - def post_webhook_url(self): - """ - :returns: The URL for post-event webhooks - :rtype: unicode - """ - return self._properties['post_webhook_url'] - - @property - def webhook_method(self): - """ - :returns: The HTTP method to use for both PRE and POST webhooks - :rtype: unicode - """ - return self._properties['webhook_method'] - - @property - def webhook_filters(self): - """ - :returns: The list of WebHook events that are enabled for this Service instance - :rtype: list[unicode] - """ - return self._properties['webhook_filters'] - - @property - def notifications(self): - """ - :returns: The notification configuration for the Service instance - :rtype: dict - """ - return self._properties['notifications'] - + def channels(self): + return self._proxy.channels @property - def url(self): - """ - :returns: The absolute URL of the Service resource - :rtype: unicode - """ - return self._properties['url'] - + def roles(self): + return self._proxy.roles @property - def links(self): - """ - :returns: The absolute URLs of the Service's Channels, Roles, and Users - :rtype: unicode - """ - return self._properties['links'] + def users(self): + return self._proxy.users + - def fetch(self): + def __repr__(self): """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the ServiceInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, - default_service_role_sid=values.unset, - default_channel_role_sid=values.unset, - default_channel_creator_role_sid=values.unset, - read_status_enabled=values.unset, reachability_enabled=values.unset, - typing_indicator_timeout=values.unset, - consumption_report_interval=values.unset, - notifications_new_message_enabled=values.unset, - notifications_new_message_template=values.unset, - notifications_added_to_channel_enabled=values.unset, - notifications_added_to_channel_template=values.unset, - notifications_removed_from_channel_enabled=values.unset, - notifications_removed_from_channel_template=values.unset, - notifications_invited_to_channel_enabled=values.unset, - notifications_invited_to_channel_template=values.unset, - pre_webhook_url=values.unset, post_webhook_url=values.unset, - webhook_method=values.unset, webhook_filters=values.unset, - webhooks_on_message_send_url=values.unset, - webhooks_on_message_send_method=values.unset, - webhooks_on_message_update_url=values.unset, - webhooks_on_message_update_method=values.unset, - webhooks_on_message_remove_url=values.unset, - webhooks_on_message_remove_method=values.unset, - webhooks_on_channel_add_url=values.unset, - webhooks_on_channel_add_method=values.unset, - webhooks_on_channel_destroy_url=values.unset, - webhooks_on_channel_destroy_method=values.unset, - webhooks_on_channel_update_url=values.unset, - webhooks_on_channel_update_method=values.unset, - webhooks_on_member_add_url=values.unset, - webhooks_on_member_add_method=values.unset, - webhooks_on_member_remove_url=values.unset, - webhooks_on_member_remove_method=values.unset, - webhooks_on_message_sent_url=values.unset, - webhooks_on_message_sent_method=values.unset, - webhooks_on_message_updated_url=values.unset, - webhooks_on_message_updated_method=values.unset, - webhooks_on_message_removed_url=values.unset, - webhooks_on_message_removed_method=values.unset, - webhooks_on_channel_added_url=values.unset, - webhooks_on_channel_added_method=values.unset, - webhooks_on_channel_destroyed_url=values.unset, - webhooks_on_channel_destroyed_method=values.unset, - webhooks_on_channel_updated_url=values.unset, - webhooks_on_channel_updated_method=values.unset, - webhooks_on_member_added_url=values.unset, - webhooks_on_member_added_method=values.unset, - webhooks_on_member_removed_url=values.unset, - webhooks_on_member_removed_method=values.unset, - limits_channel_members=values.unset, - limits_user_channels=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode default_service_role_sid: The service role assigned to users when they are added to the service - :param unicode default_channel_role_sid: The channel role assigned to users when they are added to a channel - :param unicode default_channel_creator_role_sid: The channel role assigned to a channel creator when they join a new channel - :param bool read_status_enabled: Whether to enable the Message Consumption Horizon feature - :param bool reachability_enabled: Whether to enable the Reachability Indicator feature for this Service instance - :param unicode typing_indicator_timeout: How long in seconds to wait before assuming the user is no longer typing - :param unicode consumption_report_interval: DEPRECATED - :param bool notifications_new_message_enabled: Whether to send a notification when a new message is added to a channel - :param unicode notifications_new_message_template: The template to use to create the notification text displayed when a new message is added to a channel - :param bool notifications_added_to_channel_enabled: Whether to send a notification when a member is added to a channel - :param unicode notifications_added_to_channel_template: The template to use to create the notification text displayed when a member is added to a channel - :param bool notifications_removed_from_channel_enabled: Whether to send a notification to a user when they are removed from a channel - :param unicode notifications_removed_from_channel_template: The template to use to create the notification text displayed to a user when they are removed - :param bool notifications_invited_to_channel_enabled: Whether to send a notification when a user is invited to a channel - :param unicode notifications_invited_to_channel_template: The template to use to create the notification text displayed when a user is invited to a channel - :param unicode pre_webhook_url: The webhook URL for pre-event webhooks - :param unicode post_webhook_url: The URL for post-event webhooks - :param unicode webhook_method: The HTTP method to use for both PRE and POST webhooks - :param list[unicode] webhook_filters: The list of WebHook events that are enabled for this Service instance - :param unicode webhooks_on_message_send_url: The URL of the webhook to call in response to the on_message_send event - :param unicode webhooks_on_message_send_method: The HTTP method to use when calling the webhooks.on_message_send.url - :param unicode webhooks_on_message_update_url: The URL of the webhook to call in response to the on_message_update event - :param unicode webhooks_on_message_update_method: The HTTP method to use when calling the webhooks.on_message_update.url - :param unicode webhooks_on_message_remove_url: The URL of the webhook to call in response to the on_message_remove event - :param unicode webhooks_on_message_remove_method: The HTTP method to use when calling the webhooks.on_message_remove.url - :param unicode webhooks_on_channel_add_url: The URL of the webhook to call in response to the on_channel_add event - :param unicode webhooks_on_channel_add_method: The HTTP method to use when calling the webhooks.on_channel_add.url - :param unicode webhooks_on_channel_destroy_url: The URL of the webhook to call in response to the on_channel_destroy event - :param unicode webhooks_on_channel_destroy_method: The HTTP method to use when calling the webhooks.on_channel_destroy.url - :param unicode webhooks_on_channel_update_url: The URL of the webhook to call in response to the on_channel_update event - :param unicode webhooks_on_channel_update_method: The HTTP method to use when calling the webhooks.on_channel_update.url - :param unicode webhooks_on_member_add_url: The URL of the webhook to call in response to the on_member_add event - :param unicode webhooks_on_member_add_method: The HTTP method to use when calling the webhooks.on_member_add.url - :param unicode webhooks_on_member_remove_url: The URL of the webhook to call in response to the on_member_remove event - :param unicode webhooks_on_member_remove_method: The HTTP method to use when calling the webhooks.on_member_remove.url - :param unicode webhooks_on_message_sent_url: The URL of the webhook to call in response to the on_message_sent event - :param unicode webhooks_on_message_sent_method: The URL of the webhook to call in response to the on_message_sent event - :param unicode webhooks_on_message_updated_url: The URL of the webhook to call in response to the on_message_updated event - :param unicode webhooks_on_message_updated_method: The HTTP method to use when calling the webhooks.on_message_updated.url - :param unicode webhooks_on_message_removed_url: The URL of the webhook to call in response to the on_message_removed event - :param unicode webhooks_on_message_removed_method: The HTTP method to use when calling the webhooks.on_message_removed.url - :param unicode webhooks_on_channel_added_url: The URL of the webhook to call in response to the on_channel_added event - :param unicode webhooks_on_channel_added_method: The URL of the webhook to call in response to the on_channel_added event - :param unicode webhooks_on_channel_destroyed_url: The URL of the webhook to call in response to the on_channel_added event - :param unicode webhooks_on_channel_destroyed_method: The HTTP method to use when calling the webhooks.on_channel_destroyed.url - :param unicode webhooks_on_channel_updated_url: he URL of the webhook to call in response to the on_channel_updated event - :param unicode webhooks_on_channel_updated_method: The HTTP method to use when calling the webhooks.on_channel_updated.url - :param unicode webhooks_on_member_added_url: The URL of the webhook to call in response to the on_channel_updated event - :param unicode webhooks_on_member_added_method: he HTTP method to use when calling the webhooks.on_channel_updated.url - :param unicode webhooks_on_member_removed_url: The URL of the webhook to call in response to the on_member_removed event - :param unicode webhooks_on_member_removed_method: The HTTP method to use when calling the webhooks.on_member_removed.url - :param unicode limits_channel_members: The maximum number of Members that can be added to Channels within this Service - :param unicode limits_user_channels: The maximum number of Channels Users can be a Member of within this Service - - :returns: The updated ServiceInstance - :rtype: twilio.rest.chat.v1.service.ServiceInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - default_service_role_sid=default_service_role_sid, - default_channel_role_sid=default_channel_role_sid, - default_channel_creator_role_sid=default_channel_creator_role_sid, - read_status_enabled=read_status_enabled, - reachability_enabled=reachability_enabled, - typing_indicator_timeout=typing_indicator_timeout, - consumption_report_interval=consumption_report_interval, - notifications_new_message_enabled=notifications_new_message_enabled, - notifications_new_message_template=notifications_new_message_template, - notifications_added_to_channel_enabled=notifications_added_to_channel_enabled, - notifications_added_to_channel_template=notifications_added_to_channel_template, - notifications_removed_from_channel_enabled=notifications_removed_from_channel_enabled, - notifications_removed_from_channel_template=notifications_removed_from_channel_template, - notifications_invited_to_channel_enabled=notifications_invited_to_channel_enabled, - notifications_invited_to_channel_template=notifications_invited_to_channel_template, - pre_webhook_url=pre_webhook_url, - post_webhook_url=post_webhook_url, - webhook_method=webhook_method, - webhook_filters=webhook_filters, - webhooks_on_message_send_url=webhooks_on_message_send_url, - webhooks_on_message_send_method=webhooks_on_message_send_method, - webhooks_on_message_update_url=webhooks_on_message_update_url, - webhooks_on_message_update_method=webhooks_on_message_update_method, - webhooks_on_message_remove_url=webhooks_on_message_remove_url, - webhooks_on_message_remove_method=webhooks_on_message_remove_method, - webhooks_on_channel_add_url=webhooks_on_channel_add_url, - webhooks_on_channel_add_method=webhooks_on_channel_add_method, - webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, - webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, - webhooks_on_channel_update_url=webhooks_on_channel_update_url, - webhooks_on_channel_update_method=webhooks_on_channel_update_method, - webhooks_on_member_add_url=webhooks_on_member_add_url, - webhooks_on_member_add_method=webhooks_on_member_add_method, - webhooks_on_member_remove_url=webhooks_on_member_remove_url, - webhooks_on_member_remove_method=webhooks_on_member_remove_method, - webhooks_on_message_sent_url=webhooks_on_message_sent_url, - webhooks_on_message_sent_method=webhooks_on_message_sent_method, - webhooks_on_message_updated_url=webhooks_on_message_updated_url, - webhooks_on_message_updated_method=webhooks_on_message_updated_method, - webhooks_on_message_removed_url=webhooks_on_message_removed_url, - webhooks_on_message_removed_method=webhooks_on_message_removed_method, - webhooks_on_channel_added_url=webhooks_on_channel_added_url, - webhooks_on_channel_added_method=webhooks_on_channel_added_method, - webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, - webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, - webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, - webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, - webhooks_on_member_added_url=webhooks_on_member_added_url, - webhooks_on_member_added_method=webhooks_on_member_added_method, - webhooks_on_member_removed_url=webhooks_on_member_removed_url, - webhooks_on_member_removed_method=webhooks_on_member_removed_method, - limits_channel_members=limits_channel_members, - limits_user_channels=limits_user_channels, - ) - @property - def channels(self): - """ - Access the channels +class ServiceListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.chat.v1.service.channel.ChannelList - :rtype: twilio.rest.chat.v1.service.channel.ChannelList - """ - return self._proxy.channels + # Path Solution + self._solution = { } + self._uri = '/Services' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def roles(self): - """ - Access the roles + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.chat.v1.service.role.RoleList - :rtype: twilio.rest.chat.v1.service.role.RoleList - """ - return self._proxy.roles + return ServiceInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def users(self): - """ - Access the users + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.chat.v1.service.user.UserList - :rtype: twilio.rest.chat.v1.service.user.UserList - """ - return self._proxy.users + return ServicePage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v1/service/channel.py b/twilio/rest/chat/v1/service/channel.py deleted file mode 100644 index 400960c4c3..0000000000 --- a/twilio/rest/chat/v1/service/channel.py +++ /dev/null @@ -1,191 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Chat - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.channel.invite import InviteListInstancefrom twilio.rest.channel.member import MemberListInstancefrom twilio.rest.channel.message import MessageListInstance - - -class ChannelContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Channels/${sid}' - - self._invites = None - self._members = None - self._messages = None - - def delete(self): - - - - """ - Deletes the ChannelInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ChannelInstance - - :returns: The fetched ChannelInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ChannelInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'unique_name' : payload.get('unique_name'), - 'attributes' : payload.get('attributes'), - 'type' : payload.get('type'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'created_by' : payload.get('created_by'), - 'members_count' : payload.get('members_count'), - 'messages_count' : payload.get('messages_count'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ChannelContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def invites(self): - return self._proxy.invites - @property - def members(self): - return self._proxy.members - @property - def messages(self): - return self._proxy.messages - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ChannelListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Channels' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, type, page_size): - - data = values.of({ - 'type': type,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ChannelPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/chat/v1/service/channel/__init__.py b/twilio/rest/chat/v1/service/channel/__init__.py index c08b74dcb3..400960c4c3 100644 --- a/twilio/rest/chat/v1/service/channel/__init__.py +++ b/twilio/rest/chat/v1/service/channel/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,251 +19,30 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.chat.v1.service.channel.invite import InviteList -from twilio.rest.chat.v1.service.channel.member import MemberList -from twilio.rest.chat.v1.service.channel.message import MessageList - - -class ChannelList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the ChannelList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.chat.v1.service.channel.ChannelList - :rtype: twilio.rest.chat.v1.service.channel.ChannelList - """ - super(ChannelList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Channels'.format(**self._solution) - - def create(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset, type=values.unset): - """ - Create the ChannelInstance - - :param unicode friendly_name: A string to describe the new resource - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode attributes: A valid JSON string that contains application-specific data - :param ChannelInstance.ChannelType type: The visibility of the channel - - :returns: The created ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Attributes': attributes, - 'Type': type, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, type=values.unset, limit=None, page_size=None): - """ - Streams ChannelInstance 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 list[ChannelInstance.ChannelType] type: The visibility of the channel to read - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.chat.v1.service.channel.ChannelInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(type=type, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, type=values.unset, limit=None, page_size=None): - """ - Lists ChannelInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param list[ChannelInstance.ChannelType] type: The visibility of the channel to read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.channel.ChannelInstance] - """ - return list(self.stream(type=type, limit=limit, page_size=page_size, )) +from twilio.base.version import Version - def page(self, type=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of ChannelInstance records from the API. - Request is executed immediately - - :param list[ChannelInstance.ChannelType] type: The visibility of the channel to read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelPage - """ - data = values.of({ - 'Type': serialize.map(type, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ChannelPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ChannelInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ChannelPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ChannelContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.channel.ChannelContext - :rtype: twilio.rest.chat.v1.service.channel.ChannelContext - """ - return ChannelContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ChannelContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.channel.ChannelContext - :rtype: twilio.rest.chat.v1.service.channel.ChannelContext - """ - return ChannelContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ChannelPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ChannelPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.chat.v1.service.channel.ChannelPage - :rtype: twilio.rest.chat.v1.service.channel.ChannelPage - """ - super(ChannelPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ChannelInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.channel.ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.channel.invite import InviteListInstancefrom twilio.rest.channel.member import MemberListInstancefrom twilio.rest.channel.message import MessageListInstance class ChannelContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the ChannelContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the resource from - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.channel.ChannelContext - :rtype: twilio.rest.chat.v1.service.channel.ChannelContext - """ - super(ChannelContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Channels/${sid}' + + self._invites = None self._members = None self._messages = None - self._invites = None - - def fetch(self): - """ - Fetch the ChannelInstance - - :returns: The fetched ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the ChannelInstance @@ -264,331 +50,142 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ChannelInstance - def update(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset): + :returns: The fetched ChannelInstance + #TODO: add rtype docs """ - Update the ChannelInstance + payload = self._version.fetch(method='GET', uri=self._uri, ) - :param unicode friendly_name: A string to describe the resource - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode attributes: A valid JSON string that contains application-specific data + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - :returns: The updated ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ + + + def update(self, body): data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Attributes': attributes, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return ChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def members(self): - """ - Access the members - - :returns: twilio.rest.chat.v1.service.channel.member.MemberList - :rtype: twilio.rest.chat.v1.service.channel.member.MemberList - """ - if self._members is None: - self._members = MemberList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._members - - @property - def messages(self): - """ - Access the messages - - :returns: twilio.rest.chat.v1.service.channel.message.MessageList - :rtype: twilio.rest.chat.v1.service.channel.message.MessageList - """ - if self._messages is None: - self._messages = MessageList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._messages + payload = self._version.update(method='post', uri=self._uri, data=data, ) - @property - def invites(self): - """ - Access the invites + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + - :returns: twilio.rest.chat.v1.service.channel.invite.InviteList - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteList - """ - if self._invites is None: - self._invites = InviteList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._invites + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ChannelInstance(InstanceResource): - - class ChannelType(object): - PUBLIC = "public" - PRIVATE = "private" - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the ChannelInstance - :returns: twilio.rest.chat.v1.service.channel.ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - super(ChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'friendly_name': payload.get('friendly_name'), - 'unique_name': payload.get('unique_name'), - 'attributes': payload.get('attributes'), - 'type': payload.get('type'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'created_by': payload.get('created_by'), - 'members_count': deserialize.integer(payload.get('members_count')), - 'messages_count': deserialize.integer(payload.get('messages_count')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ChannelInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'unique_name' : payload.get('unique_name'), + 'attributes' : payload.get('attributes'), + 'type' : payload.get('type'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'created_by' : payload.get('created_by'), + 'members_count' : payload.get('members_count'), + 'messages_count' : payload.get('messages_count'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ChannelContext for this ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelContext - """ if self._context is None: self._context = ChannelContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def attributes(self): - """ - :returns: The JSON string that stores application-specific data - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def type(self): - """ - :returns: The visibility of the channel. Can be: `public` or `private` - :rtype: ChannelInstance.ChannelType - """ - return self._properties['type'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The identity of the User that created the channel - :rtype: unicode - """ - return self._properties['created_by'] - - @property - def members_count(self): - """ - :returns: The number of Members in the Channel - :rtype: unicode - """ - return self._properties['members_count'] - - @property - def messages_count(self): - """ - :returns: The number of Messages in the Channel - :rtype: unicode - """ - return self._properties['messages_count'] - + def invites(self): + return self._proxy.invites @property - def url(self): - """ - :returns: The absolute URL of the Channel resource - :rtype: unicode - """ - return self._properties['url'] - + def members(self): + return self._proxy.members @property - def links(self): - """ - :returns: Absolute URLs to access the Members, Messages , Invites and, if it exists, the last Message for the Channel - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the ChannelInstance - - :returns: The fetched ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ChannelInstance + def messages(self): + return self._proxy.messages + - :returns: True if delete succeeds, False otherwise - :rtype: bool + def __repr__(self): """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the ChannelInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode friendly_name: A string to describe the resource - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode attributes: A valid JSON string that contains application-specific data - :returns: The updated ChannelInstance - :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - unique_name=unique_name, - attributes=attributes, - ) - @property - def members(self): - """ - Access the members +class ChannelListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.chat.v1.service.channel.member.MemberList - :rtype: twilio.rest.chat.v1.service.channel.member.MemberList - """ - return self._proxy.members + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Channels' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def messages(self): - """ - Access the messages + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.chat.v1.service.channel.message.MessageList - :rtype: twilio.rest.chat.v1.service.channel.message.MessageList - """ - return self._proxy.messages + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, type, page_size): + + data = values.of({ + 'type': type,'page_size': page_size, + }) - @property - def invites(self): - """ - Access the invites + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.chat.v1.service.channel.invite.InviteList - :rtype: twilio.rest.chat.v1.service.channel.invite.InviteList - """ - return self._proxy.invites + return ChannelPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v1/service/user.py b/twilio/rest/chat/v1/service/user.py deleted file mode 100644 index 44e843f5e4..0000000000 --- a/twilio/rest/chat/v1/service/user.py +++ /dev/null @@ -1,183 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Chat - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.user.user_channel import UserChannelListInstance - - -class UserContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Users/${sid}' - - self._user_channels = None - - def delete(self): - - - - """ - Deletes the UserInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the UserInstance - - :returns: The fetched UserInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class UserInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'attributes' : payload.get('attributes'), - 'friendly_name' : payload.get('friendly_name'), - 'role_sid' : payload.get('role_sid'), - 'identity' : payload.get('identity'), - 'is_online' : payload.get('is_online'), - 'is_notifiable' : payload.get('is_notifiable'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'joined_channels_count' : payload.get('joined_channels_count'), - 'links' : payload.get('links'), - 'url' : payload.get('url'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = UserContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def user_channels(self): - return self._proxy.user_channels - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class UserListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Users' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return UserPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/chat/v1/service/user/__init__.py b/twilio/rest/chat/v1/service/user/__init__.py index e921f47baa..44e843f5e4 100644 --- a/twilio/rest/chat/v1/service/user/__init__.py +++ b/twilio/rest/chat/v1/service/user/__init__.py @@ -1,249 +1,46 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.chat.v1.service.user.user_channel import UserChannelList - - -class UserList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the UserList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.chat.v1.service.user.UserList - :rtype: twilio.rest.chat.v1.service.user.UserList - """ - super(UserList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Users'.format(**self._solution) - - def create(self, identity, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): - """ - Create the UserInstance - - :param unicode identity: The `identity` value that identifies the new resource's User - :param unicode role_sid: The SID of the Role assigned to this user - :param unicode attributes: A valid JSON string that contains application-specific data - :param unicode friendly_name: A string to describe the new resource - - :returns: The created UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - data = values.of({ - 'Identity': identity, - 'RoleSid': role_sid, - 'Attributes': attributes, - 'FriendlyName': friendly_name, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams UserInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.chat.v1.service.user.UserInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists UserInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v1.service.user.UserInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return UserPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a UserContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.user.UserContext - :rtype: twilio.rest.chat.v1.service.user.UserContext - """ - return UserContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a UserContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.user.UserContext - :rtype: twilio.rest.chat.v1.service.user.UserContext - """ - return UserContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) +from twilio.base.version import Version - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class UserPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the UserPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.chat.v1.service.user.UserPage - :rtype: twilio.rest.chat.v1.service.user.UserPage - """ - super(UserPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v1.service.user.UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.user.user_channel import UserChannelListInstance class UserContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the UserContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the resource from - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.chat.v1.service.user.UserContext - :rtype: twilio.rest.chat.v1.service.user.UserContext - """ - super(UserContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Users/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Users/${sid}' + self._user_channels = None - - def fetch(self): - """ - Fetch the UserInstance - - :returns: The fetched UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return UserInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the UserInstance @@ -251,267 +48,136 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): + + def fetch(self): + """ - Update the UserInstance - - :param unicode role_sid: The SID id of the Role assigned to this user - :param unicode attributes: A valid JSON string that contains application-specific data - :param unicode friendly_name: A string to describe the resource + Fetch the UserInstance - :returns: The updated UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance + :returns: The fetched UserInstance + #TODO: add rtype docs """ - data = values.of({'RoleSid': role_sid, 'Attributes': attributes, 'FriendlyName': friendly_name, }) + payload = self._version.fetch(method='GET', uri=self._uri, ) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - return UserInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + + + def update(self, body): + data = values.of({ + 'body': body, + }) - @property - def user_channels(self): - """ - Access the user_channels + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.chat.v1.service.user.user_channel.UserChannelList - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelList - """ - if self._user_channels is None: - self._user_channels = UserChannelList( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['sid'], - ) - return self._user_channels + return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class UserInstance(InstanceResource): - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the UserInstance - - :returns: twilio.rest.chat.v1.service.user.UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - super(UserInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'attributes': payload.get('attributes'), - 'friendly_name': payload.get('friendly_name'), - 'role_sid': payload.get('role_sid'), - 'identity': payload.get('identity'), - 'is_online': payload.get('is_online'), - 'is_notifiable': payload.get('is_notifiable'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'joined_channels_count': deserialize.integer(payload.get('joined_channels_count')), - 'links': payload.get('links'), - 'url': payload.get('url'), +class UserInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'attributes' : payload.get('attributes'), + 'friendly_name' : payload.get('friendly_name'), + 'role_sid' : payload.get('role_sid'), + 'identity' : payload.get('identity'), + 'is_online' : payload.get('is_online'), + 'is_notifiable' : payload.get('is_notifiable'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'joined_channels_count' : payload.get('joined_channels_count'), + 'links' : payload.get('links'), + 'url' : payload.get('url'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserContext for this UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserContext - """ if self._context is None: self._context = UserContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def attributes(self): - """ - :returns: The JSON string that stores application-specific data - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def role_sid(self): - """ - :returns: The SID of the assigned to the user - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def identity(self): - """ - :returns: The string that identifies the resource's User - :rtype: unicode - """ - return self._properties['identity'] - - @property - def is_online(self): - """ - :returns: Whether the User is actively connected to the Service instance and online - :rtype: bool - """ - return self._properties['is_online'] - - @property - def is_notifiable(self): - """ - :returns: Whether the User has a potentially valid Push Notification registration for the Service instance - :rtype: bool - """ - return self._properties['is_notifiable'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def joined_channels_count(self): - """ - :returns: The number of Channels this User is a Member of - :rtype: unicode - """ - return self._properties['joined_channels_count'] - - @property - def links(self): - """ - :returns: The absolute URLs of the Channel and Binding resources related to the user - :rtype: unicode - """ - return self._properties['links'] + def user_channels(self): + return self._proxy.user_channels + - @property - def url(self): - """ - :returns: The absolute URL of the User resource - :rtype: unicode + def __repr__(self): """ - return self._properties['url'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the UserInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the UserInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() +class UserListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - def update(self, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): - """ - Update the UserInstance + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Users' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - :param unicode role_sid: The SID id of the Role assigned to this user - :param unicode attributes: A valid JSON string that contains application-specific data - :param unicode friendly_name: A string to describe the resource + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: The updated UserInstance - :rtype: twilio.rest.chat.v1.service.user.UserInstance - """ - return self._proxy.update(role_sid=role_sid, attributes=attributes, friendly_name=friendly_name, ) + return UserInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def user_channels(self): - """ - Access the user_channels + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.chat.v1.service.user.user_channel.UserChannelList - :rtype: twilio.rest.chat.v1.service.user.user_channel.UserChannelList - """ - return self._proxy.user_channels + return UserPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v2/service.py b/twilio/rest/chat/v2/service.py deleted file mode 100644 index 57ba32b757..0000000000 --- a/twilio/rest/chat/v2/service.py +++ /dev/null @@ -1,204 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Chat - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.service.binding import BindingListInstancefrom twilio.rest.service.channel import ChannelListInstancefrom twilio.rest.service.role import RoleListInstancefrom twilio.rest.service.user import UserListInstance - - -class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Services/${sid}' - - self._bindings = None - self._channels = None - self._roles = None - self._users = None - - def delete(self): - - - - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'default_service_role_sid' : payload.get('default_service_role_sid'), - 'default_channel_role_sid' : payload.get('default_channel_role_sid'), - 'default_channel_creator_role_sid' : payload.get('default_channel_creator_role_sid'), - 'read_status_enabled' : payload.get('read_status_enabled'), - 'reachability_enabled' : payload.get('reachability_enabled'), - 'typing_indicator_timeout' : payload.get('typing_indicator_timeout'), - 'consumption_report_interval' : payload.get('consumption_report_interval'), - 'limits' : payload.get('limits'), - 'pre_webhook_url' : payload.get('pre_webhook_url'), - 'post_webhook_url' : payload.get('post_webhook_url'), - 'webhook_method' : payload.get('webhook_method'), - 'webhook_filters' : payload.get('webhook_filters'), - 'pre_webhook_retry_count' : payload.get('pre_webhook_retry_count'), - 'post_webhook_retry_count' : payload.get('post_webhook_retry_count'), - 'notifications' : payload.get('notifications'), - 'media' : payload.get('media'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ServiceContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def bindings(self): - return self._proxy.bindings - @property - def channels(self): - return self._proxy.channels - @property - def roles(self): - return self._proxy.roles - @property - def users(self): - return self._proxy.users - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ServiceListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Services' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ServicePage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/chat/v2/service/__init__.py b/twilio/rest/chat/v2/service/__init__.py index fedcf8ff2e..57ba32b757 100644 --- a/twilio/rest/chat/v2/service/__init__.py +++ b/twilio/rest/chat/v2/service/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,802 +19,186 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.chat.v2.service.binding import BindingList -from twilio.rest.chat.v2.service.channel import ChannelList -from twilio.rest.chat.v2.service.role import RoleList -from twilio.rest.chat.v2.service.user import UserList - - -class ServiceList(ListResource): - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.chat.v2.service.ServiceList - :rtype: twilio.rest.chat.v2.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def create(self, friendly_name): - """ - Create the ServiceInstance - - :param unicode friendly_name: A string to describe the resource - - :returns: The created ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.chat.v2.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServicePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The SID of the Service resource to fetch - - :returns: twilio.rest.chat.v2.service.ServiceContext - :rtype: twilio.rest.chat.v2.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The SID of the Service resource to fetch - - :returns: twilio.rest.chat.v2.service.ServiceContext - :rtype: twilio.rest.chat.v2.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ServicePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.chat.v2.service.ServicePage - :rtype: twilio.rest.chat.v2.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API +from twilio.base.version import Version - :returns: twilio.rest.chat.v2.service.ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.service.binding import BindingListInstancefrom twilio.rest.service.channel import ChannelListInstancefrom twilio.rest.service.role import RoleListInstancefrom twilio.rest.service.user import UserListInstance class ServiceContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The SID of the Service resource to fetch - - :returns: twilio.rest.chat.v2.service.ServiceContext - :rtype: twilio.rest.chat.v2.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Services/${sid}' + + self._bindings = None self._channels = None self._roles = None self._users = None - self._bindings = None + + def delete(self): + + + """ + Deletes the ServiceInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the ServiceInstance :returns: The fetched ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, friendly_name=values.unset, - default_service_role_sid=values.unset, - default_channel_role_sid=values.unset, - default_channel_creator_role_sid=values.unset, - read_status_enabled=values.unset, reachability_enabled=values.unset, - typing_indicator_timeout=values.unset, - consumption_report_interval=values.unset, - notifications_new_message_enabled=values.unset, - notifications_new_message_template=values.unset, - notifications_new_message_sound=values.unset, - notifications_new_message_badge_count_enabled=values.unset, - notifications_added_to_channel_enabled=values.unset, - notifications_added_to_channel_template=values.unset, - notifications_added_to_channel_sound=values.unset, - notifications_removed_from_channel_enabled=values.unset, - notifications_removed_from_channel_template=values.unset, - notifications_removed_from_channel_sound=values.unset, - notifications_invited_to_channel_enabled=values.unset, - notifications_invited_to_channel_template=values.unset, - notifications_invited_to_channel_sound=values.unset, - pre_webhook_url=values.unset, post_webhook_url=values.unset, - webhook_method=values.unset, webhook_filters=values.unset, - limits_channel_members=values.unset, - limits_user_channels=values.unset, - media_compatibility_message=values.unset, - pre_webhook_retry_count=values.unset, - post_webhook_retry_count=values.unset, - notifications_log_enabled=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode default_service_role_sid: The service role assigned to users when they are added to the service - :param unicode default_channel_role_sid: The channel role assigned to users when they are added to a channel - :param unicode default_channel_creator_role_sid: The channel role assigned to a channel creator when they join a new channel - :param bool read_status_enabled: Whether to enable the Message Consumption Horizon feature - :param bool reachability_enabled: Whether to enable the Reachability Indicator feature for this Service instance - :param unicode typing_indicator_timeout: How long in seconds to wait before assuming the user is no longer typing - :param unicode consumption_report_interval: DEPRECATED - :param bool notifications_new_message_enabled: Whether to send a notification when a new message is added to a channel - :param unicode notifications_new_message_template: The template to use to create the notification text displayed when a new message is added to a channel - :param unicode notifications_new_message_sound: The name of the sound to play when a new message is added to a channel - :param bool notifications_new_message_badge_count_enabled: Whether the new message badge is enabled - :param bool notifications_added_to_channel_enabled: Whether to send a notification when a member is added to a channel - :param unicode notifications_added_to_channel_template: The template to use to create the notification text displayed when a member is added to a channel - :param unicode notifications_added_to_channel_sound: The name of the sound to play when a member is added to a channel - :param bool notifications_removed_from_channel_enabled: Whether to send a notification to a user when they are removed from a channel - :param unicode notifications_removed_from_channel_template: The template to use to create the notification text displayed to a user when they are removed - :param unicode notifications_removed_from_channel_sound: The name of the sound to play to a user when they are removed from a channel - :param bool notifications_invited_to_channel_enabled: Whether to send a notification when a user is invited to a channel - :param unicode notifications_invited_to_channel_template: The template to use to create the notification text displayed when a user is invited to a channel - :param unicode notifications_invited_to_channel_sound: The name of the sound to play when a user is invited to a channel - :param unicode pre_webhook_url: The webhook URL for pre-event webhooks - :param unicode post_webhook_url: The URL for post-event webhooks - :param unicode webhook_method: The HTTP method to use for both PRE and POST webhooks - :param list[unicode] webhook_filters: The list of webhook events that are enabled for this Service instance - :param unicode limits_channel_members: The maximum number of Members that can be added to Channels within this Service - :param unicode limits_user_channels: The maximum number of Channels Users can be a Member of within this Service - :param unicode media_compatibility_message: The message to send when a media message has no text - :param unicode pre_webhook_retry_count: Count of times webhook will be retried in case of timeout or 429/503/504 HTTP responses - :param unicode post_webhook_retry_count: The number of times calls to the `post_webhook_url` will be retried - :param bool notifications_log_enabled: Whether to log notifications - - :returns: The updated ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance - """ + + + def update(self, body): data = values.of({ - 'FriendlyName': friendly_name, - 'DefaultServiceRoleSid': default_service_role_sid, - 'DefaultChannelRoleSid': default_channel_role_sid, - 'DefaultChannelCreatorRoleSid': default_channel_creator_role_sid, - 'ReadStatusEnabled': read_status_enabled, - 'ReachabilityEnabled': reachability_enabled, - 'TypingIndicatorTimeout': typing_indicator_timeout, - 'ConsumptionReportInterval': consumption_report_interval, - 'Notifications.NewMessage.Enabled': notifications_new_message_enabled, - 'Notifications.NewMessage.Template': notifications_new_message_template, - 'Notifications.NewMessage.Sound': notifications_new_message_sound, - 'Notifications.NewMessage.BadgeCountEnabled': notifications_new_message_badge_count_enabled, - 'Notifications.AddedToChannel.Enabled': notifications_added_to_channel_enabled, - 'Notifications.AddedToChannel.Template': notifications_added_to_channel_template, - 'Notifications.AddedToChannel.Sound': notifications_added_to_channel_sound, - 'Notifications.RemovedFromChannel.Enabled': notifications_removed_from_channel_enabled, - 'Notifications.RemovedFromChannel.Template': notifications_removed_from_channel_template, - 'Notifications.RemovedFromChannel.Sound': notifications_removed_from_channel_sound, - 'Notifications.InvitedToChannel.Enabled': notifications_invited_to_channel_enabled, - 'Notifications.InvitedToChannel.Template': notifications_invited_to_channel_template, - 'Notifications.InvitedToChannel.Sound': notifications_invited_to_channel_sound, - 'PreWebhookUrl': pre_webhook_url, - 'PostWebhookUrl': post_webhook_url, - 'WebhookMethod': webhook_method, - 'WebhookFilters': serialize.map(webhook_filters, lambda e: e), - 'Limits.ChannelMembers': limits_channel_members, - 'Limits.UserChannels': limits_user_channels, - 'Media.CompatibilityMessage': media_compatibility_message, - 'PreWebhookRetryCount': pre_webhook_retry_count, - 'PostWebhookRetryCount': post_webhook_retry_count, - 'Notifications.LogEnabled': notifications_log_enabled, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def channels(self): - """ - Access the channels - - :returns: twilio.rest.chat.v2.service.channel.ChannelList - :rtype: twilio.rest.chat.v2.service.channel.ChannelList - """ - if self._channels is None: - self._channels = ChannelList(self._version, service_sid=self._solution['sid'], ) - return self._channels - - @property - def roles(self): - """ - Access the roles - - :returns: twilio.rest.chat.v2.service.role.RoleList - :rtype: twilio.rest.chat.v2.service.role.RoleList - """ - if self._roles is None: - self._roles = RoleList(self._version, service_sid=self._solution['sid'], ) - return self._roles - - @property - def users(self): - """ - Access the users - - :returns: twilio.rest.chat.v2.service.user.UserList - :rtype: twilio.rest.chat.v2.service.user.UserList - """ - if self._users is None: - self._users = UserList(self._version, service_sid=self._solution['sid'], ) - return self._users - - @property - def bindings(self): - """ - Access the bindings - - :returns: twilio.rest.chat.v2.service.binding.BindingList - :rtype: twilio.rest.chat.v2.service.binding.BindingList - """ - if self._bindings is None: - self._bindings = BindingList(self._version, service_sid=self._solution['sid'], ) - return self._bindings + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - :returns: twilio.rest.chat.v2.service.ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'default_service_role_sid': payload.get('default_service_role_sid'), - 'default_channel_role_sid': payload.get('default_channel_role_sid'), - 'default_channel_creator_role_sid': payload.get('default_channel_creator_role_sid'), - 'read_status_enabled': payload.get('read_status_enabled'), - 'reachability_enabled': payload.get('reachability_enabled'), - 'typing_indicator_timeout': deserialize.integer(payload.get('typing_indicator_timeout')), - 'consumption_report_interval': deserialize.integer(payload.get('consumption_report_interval')), - 'limits': payload.get('limits'), - 'pre_webhook_url': payload.get('pre_webhook_url'), - 'post_webhook_url': payload.get('post_webhook_url'), - 'webhook_method': payload.get('webhook_method'), - 'webhook_filters': payload.get('webhook_filters'), - 'pre_webhook_retry_count': deserialize.integer(payload.get('pre_webhook_retry_count')), - 'post_webhook_retry_count': deserialize.integer(payload.get('post_webhook_retry_count')), - 'notifications': payload.get('notifications'), - 'media': payload.get('media'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'default_service_role_sid' : payload.get('default_service_role_sid'), + 'default_channel_role_sid' : payload.get('default_channel_role_sid'), + 'default_channel_creator_role_sid' : payload.get('default_channel_creator_role_sid'), + 'read_status_enabled' : payload.get('read_status_enabled'), + 'reachability_enabled' : payload.get('reachability_enabled'), + 'typing_indicator_timeout' : payload.get('typing_indicator_timeout'), + 'consumption_report_interval' : payload.get('consumption_report_interval'), + 'limits' : payload.get('limits'), + 'pre_webhook_url' : payload.get('pre_webhook_url'), + 'post_webhook_url' : payload.get('post_webhook_url'), + 'webhook_method' : payload.get('webhook_method'), + 'webhook_filters' : payload.get('webhook_filters'), + 'pre_webhook_retry_count' : payload.get('pre_webhook_retry_count'), + 'post_webhook_retry_count' : payload.get('post_webhook_retry_count'), + 'notifications' : payload.get('notifications'), + 'media' : payload.get('media'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceContext - """ if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def default_service_role_sid(self): - """ - :returns: The service role assigned to users when they are added to the service - :rtype: unicode - """ - return self._properties['default_service_role_sid'] - - @property - def default_channel_role_sid(self): - """ - :returns: The channel role assigned to users when they are added to a channel - :rtype: unicode - """ - return self._properties['default_channel_role_sid'] - - @property - def default_channel_creator_role_sid(self): - """ - :returns: The channel role assigned to a channel creator when they join a new channel - :rtype: unicode - """ - return self._properties['default_channel_creator_role_sid'] - - @property - def read_status_enabled(self): - """ - :returns: Whether the Message Consumption Horizon feature is enabled - :rtype: bool - """ - return self._properties['read_status_enabled'] - - @property - def reachability_enabled(self): - """ - :returns: Whether the Reachability Indicator feature is enabled for this Service instance - :rtype: bool - """ - return self._properties['reachability_enabled'] - - @property - def typing_indicator_timeout(self): - """ - :returns: How long in seconds to wait before assuming the user is no longer typing - :rtype: unicode - """ - return self._properties['typing_indicator_timeout'] - - @property - def consumption_report_interval(self): - """ - :returns: DEPRECATED - :rtype: unicode - """ - return self._properties['consumption_report_interval'] - - @property - def limits(self): - """ - :returns: An object that describes the limits of the service instance - :rtype: dict - """ - return self._properties['limits'] - - @property - def pre_webhook_url(self): - """ - :returns: The webhook URL for pre-event webhooks - :rtype: unicode - """ - return self._properties['pre_webhook_url'] - - @property - def post_webhook_url(self): - """ - :returns: The URL for post-event webhooks - :rtype: unicode - """ - return self._properties['post_webhook_url'] - - @property - def webhook_method(self): - """ - :returns: The HTTP method to use for both PRE and POST webhooks - :rtype: unicode - """ - return self._properties['webhook_method'] - - @property - def webhook_filters(self): - """ - :returns: The list of webhook events that are enabled for this Service instance - :rtype: list[unicode] - """ - return self._properties['webhook_filters'] - - @property - def pre_webhook_retry_count(self): - """ - :returns: Count of times webhook will be retried in case of timeout or 429/503/504 HTTP responses - :rtype: unicode - """ - return self._properties['pre_webhook_retry_count'] - - @property - def post_webhook_retry_count(self): - """ - :returns: The number of times calls to the `post_webhook_url` will be retried - :rtype: unicode - """ - return self._properties['post_webhook_retry_count'] - - @property - def notifications(self): - """ - :returns: The notification configuration for the Service instance - :rtype: dict - """ - return self._properties['notifications'] - + def bindings(self): + return self._proxy.bindings @property - def media(self): - """ - :returns: The properties of the media that the service supports - :rtype: dict - """ - return self._properties['media'] - + def channels(self): + return self._proxy.channels @property - def url(self): - """ - :returns: The absolute URL of the Service resource - :rtype: unicode - """ - return self._properties['url'] - + def roles(self): + return self._proxy.roles @property - def links(self): - """ - :returns: The absolute URLs of the Service's Channels, Roles, and Users - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ServiceInstance + def users(self): + return self._proxy.users + - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, - default_service_role_sid=values.unset, - default_channel_role_sid=values.unset, - default_channel_creator_role_sid=values.unset, - read_status_enabled=values.unset, reachability_enabled=values.unset, - typing_indicator_timeout=values.unset, - consumption_report_interval=values.unset, - notifications_new_message_enabled=values.unset, - notifications_new_message_template=values.unset, - notifications_new_message_sound=values.unset, - notifications_new_message_badge_count_enabled=values.unset, - notifications_added_to_channel_enabled=values.unset, - notifications_added_to_channel_template=values.unset, - notifications_added_to_channel_sound=values.unset, - notifications_removed_from_channel_enabled=values.unset, - notifications_removed_from_channel_template=values.unset, - notifications_removed_from_channel_sound=values.unset, - notifications_invited_to_channel_enabled=values.unset, - notifications_invited_to_channel_template=values.unset, - notifications_invited_to_channel_sound=values.unset, - pre_webhook_url=values.unset, post_webhook_url=values.unset, - webhook_method=values.unset, webhook_filters=values.unset, - limits_channel_members=values.unset, - limits_user_channels=values.unset, - media_compatibility_message=values.unset, - pre_webhook_retry_count=values.unset, - post_webhook_retry_count=values.unset, - notifications_log_enabled=values.unset): + def __repr__(self): """ - Update the ServiceInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode default_service_role_sid: The service role assigned to users when they are added to the service - :param unicode default_channel_role_sid: The channel role assigned to users when they are added to a channel - :param unicode default_channel_creator_role_sid: The channel role assigned to a channel creator when they join a new channel - :param bool read_status_enabled: Whether to enable the Message Consumption Horizon feature - :param bool reachability_enabled: Whether to enable the Reachability Indicator feature for this Service instance - :param unicode typing_indicator_timeout: How long in seconds to wait before assuming the user is no longer typing - :param unicode consumption_report_interval: DEPRECATED - :param bool notifications_new_message_enabled: Whether to send a notification when a new message is added to a channel - :param unicode notifications_new_message_template: The template to use to create the notification text displayed when a new message is added to a channel - :param unicode notifications_new_message_sound: The name of the sound to play when a new message is added to a channel - :param bool notifications_new_message_badge_count_enabled: Whether the new message badge is enabled - :param bool notifications_added_to_channel_enabled: Whether to send a notification when a member is added to a channel - :param unicode notifications_added_to_channel_template: The template to use to create the notification text displayed when a member is added to a channel - :param unicode notifications_added_to_channel_sound: The name of the sound to play when a member is added to a channel - :param bool notifications_removed_from_channel_enabled: Whether to send a notification to a user when they are removed from a channel - :param unicode notifications_removed_from_channel_template: The template to use to create the notification text displayed to a user when they are removed - :param unicode notifications_removed_from_channel_sound: The name of the sound to play to a user when they are removed from a channel - :param bool notifications_invited_to_channel_enabled: Whether to send a notification when a user is invited to a channel - :param unicode notifications_invited_to_channel_template: The template to use to create the notification text displayed when a user is invited to a channel - :param unicode notifications_invited_to_channel_sound: The name of the sound to play when a user is invited to a channel - :param unicode pre_webhook_url: The webhook URL for pre-event webhooks - :param unicode post_webhook_url: The URL for post-event webhooks - :param unicode webhook_method: The HTTP method to use for both PRE and POST webhooks - :param list[unicode] webhook_filters: The list of webhook events that are enabled for this Service instance - :param unicode limits_channel_members: The maximum number of Members that can be added to Channels within this Service - :param unicode limits_user_channels: The maximum number of Channels Users can be a Member of within this Service - :param unicode media_compatibility_message: The message to send when a media message has no text - :param unicode pre_webhook_retry_count: Count of times webhook will be retried in case of timeout or 429/503/504 HTTP responses - :param unicode post_webhook_retry_count: The number of times calls to the `post_webhook_url` will be retried - :param bool notifications_log_enabled: Whether to log notifications - - :returns: The updated ServiceInstance - :rtype: twilio.rest.chat.v2.service.ServiceInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update( - friendly_name=friendly_name, - default_service_role_sid=default_service_role_sid, - default_channel_role_sid=default_channel_role_sid, - default_channel_creator_role_sid=default_channel_creator_role_sid, - read_status_enabled=read_status_enabled, - reachability_enabled=reachability_enabled, - typing_indicator_timeout=typing_indicator_timeout, - consumption_report_interval=consumption_report_interval, - notifications_new_message_enabled=notifications_new_message_enabled, - notifications_new_message_template=notifications_new_message_template, - notifications_new_message_sound=notifications_new_message_sound, - notifications_new_message_badge_count_enabled=notifications_new_message_badge_count_enabled, - notifications_added_to_channel_enabled=notifications_added_to_channel_enabled, - notifications_added_to_channel_template=notifications_added_to_channel_template, - notifications_added_to_channel_sound=notifications_added_to_channel_sound, - notifications_removed_from_channel_enabled=notifications_removed_from_channel_enabled, - notifications_removed_from_channel_template=notifications_removed_from_channel_template, - notifications_removed_from_channel_sound=notifications_removed_from_channel_sound, - notifications_invited_to_channel_enabled=notifications_invited_to_channel_enabled, - notifications_invited_to_channel_template=notifications_invited_to_channel_template, - notifications_invited_to_channel_sound=notifications_invited_to_channel_sound, - pre_webhook_url=pre_webhook_url, - post_webhook_url=post_webhook_url, - webhook_method=webhook_method, - webhook_filters=webhook_filters, - limits_channel_members=limits_channel_members, - limits_user_channels=limits_user_channels, - media_compatibility_message=media_compatibility_message, - pre_webhook_retry_count=pre_webhook_retry_count, - post_webhook_retry_count=post_webhook_retry_count, - notifications_log_enabled=notifications_log_enabled, - ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def channels(self): - """ - Access the channels - :returns: twilio.rest.chat.v2.service.channel.ChannelList - :rtype: twilio.rest.chat.v2.service.channel.ChannelList - """ - return self._proxy.channels - @property - def roles(self): - """ - Access the roles +class ServiceListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.chat.v2.service.role.RoleList - :rtype: twilio.rest.chat.v2.service.role.RoleList - """ - return self._proxy.roles + # Path Solution + self._solution = { } + self._uri = '/Services' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def users(self): - """ - Access the users + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.chat.v2.service.user.UserList - :rtype: twilio.rest.chat.v2.service.user.UserList - """ - return self._proxy.users + return ServiceInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def bindings(self): - """ - Access the bindings + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.chat.v2.service.binding.BindingList - :rtype: twilio.rest.chat.v2.service.binding.BindingList - """ - return self._proxy.bindings + return ServicePage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v2/service/channel.py b/twilio/rest/chat/v2/service/channel.py deleted file mode 100644 index 116f7bde59..0000000000 --- a/twilio/rest/chat/v2/service/channel.py +++ /dev/null @@ -1,195 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Chat - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.channel.invite import InviteListInstancefrom twilio.rest.channel.member import MemberListInstancefrom twilio.rest.channel.message import MessageListInstancefrom twilio.rest.channel.webhook import WebhookListInstance - - -class ChannelContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Channels/${sid}' - - self._invites = None - self._members = None - self._messages = None - self._webhooks = None - - def delete(self, x_twilio_webhook_enabled): - - - - """ - Deletes the ChannelInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ChannelInstance - - :returns: The fetched ChannelInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - def update(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ChannelInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'unique_name' : payload.get('unique_name'), - 'attributes' : payload.get('attributes'), - 'type' : payload.get('type'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'created_by' : payload.get('created_by'), - 'members_count' : payload.get('members_count'), - 'messages_count' : payload.get('messages_count'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ChannelContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def invites(self): - return self._proxy.invites - @property - def members(self): - return self._proxy.members - @property - def messages(self): - return self._proxy.messages - @property - def webhooks(self): - return self._proxy.webhooks - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ChannelListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Channels' - - - """ - def create(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, type, page_size): - - data = values.of({ - 'type': type,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ChannelPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/chat/v2/service/channel/__init__.py b/twilio/rest/chat/v2/service/channel/__init__.py index 729765dfde..116f7bde59 100644 --- a/twilio/rest/chat/v2/service/channel/__init__.py +++ b/twilio/rest/chat/v2/service/channel/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,651 +19,177 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.chat.v2.service.channel.invite import InviteList -from twilio.rest.chat.v2.service.channel.member import MemberList -from twilio.rest.chat.v2.service.channel.message import MessageList -from twilio.rest.chat.v2.service.channel.webhook import WebhookList - - -class ChannelList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the ChannelList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.chat.v2.service.channel.ChannelList - :rtype: twilio.rest.chat.v2.service.channel.ChannelList - """ - super(ChannelList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Channels'.format(**self._solution) - - def create(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset, type=values.unset, - date_created=values.unset, date_updated=values.unset, - created_by=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Create the ChannelInstance - - :param unicode friendly_name: A string to describe the new resource - :param unicode unique_name: An application-defined string that uniquely identifies the Channel resource - :param unicode attributes: A valid JSON string that contains application-specific data - :param ChannelInstance.ChannelType type: The visibility of the channel - :param datetime date_created: The ISO 8601 date and time in GMT when the resource was created - :param datetime date_updated: The ISO 8601 date and time in GMT when the resource was updated - :param unicode created_by: The identity of the User that created the Channel - :param ChannelInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The created ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Attributes': attributes, - 'Type': type, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'CreatedBy': created_by, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, headers=headers, ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, type=values.unset, limit=None, page_size=None): - """ - Streams ChannelInstance 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 list[ChannelInstance.ChannelType] type: The visibility of the channel to read - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.chat.v2.service.channel.ChannelInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(type=type, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, type=values.unset, limit=None, page_size=None): - """ - Lists ChannelInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param list[ChannelInstance.ChannelType] type: The visibility of the channel to read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.channel.ChannelInstance] - """ - return list(self.stream(type=type, limit=limit, page_size=page_size, )) - - def page(self, type=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of ChannelInstance records from the API. - Request is executed immediately - - :param list[ChannelInstance.ChannelType] type: The visibility of the channel to read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelPage - """ - data = values.of({ - 'Type': serialize.map(type, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ChannelPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ChannelInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ChannelPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ChannelContext - - :param sid: The SID of the resource - - :returns: twilio.rest.chat.v2.service.channel.ChannelContext - :rtype: twilio.rest.chat.v2.service.channel.ChannelContext - """ - return ChannelContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ChannelContext - - :param sid: The SID of the resource - - :returns: twilio.rest.chat.v2.service.channel.ChannelContext - :rtype: twilio.rest.chat.v2.service.channel.ChannelContext - """ - return ChannelContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ChannelPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ChannelPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.chat.v2.service.channel.ChannelPage - :rtype: twilio.rest.chat.v2.service.channel.ChannelPage - """ - super(ChannelPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ChannelInstance - - :param dict payload: Payload response from the API +from twilio.base.version import Version - :returns: twilio.rest.chat.v2.service.channel.ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance - """ - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.channel.invite import InviteListInstancefrom twilio.rest.channel.member import MemberListInstancefrom twilio.rest.channel.message import MessageListInstancefrom twilio.rest.channel.webhook import WebhookListInstance class ChannelContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the ChannelContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the resource from - :param sid: The SID of the resource - - :returns: twilio.rest.chat.v2.service.channel.ChannelContext - :rtype: twilio.rest.chat.v2.service.channel.ChannelContext - """ - super(ChannelContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Channels/${sid}' + + self._invites = None self._members = None self._messages = None - self._invites = None self._webhooks = None + + def delete(self, x_twilio_webhook_enabled): + + + + """ + Deletes the ChannelInstance + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the ChannelInstance :returns: The fetched ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return ChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - def delete(self, x_twilio_webhook_enabled=values.unset): - """ - Deletes the ChannelInstance - - :param ChannelInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) - - def update(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset, date_created=values.unset, - date_updated=values.unset, created_by=values.unset, - x_twilio_webhook_enabled=values.unset): - """ - Update the ChannelInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode attributes: A valid JSON string that contains application-specific data - :param datetime date_created: The ISO 8601 date and time in GMT when the resource was created - :param datetime date_updated: The ISO 8601 date and time in GMT when the resource was updated - :param unicode created_by: The identity of the User that created the Channel - :param ChannelInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance - """ + + + def update(self, x_twilio_webhook_enabled, body): data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Attributes': attributes, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'CreatedBy': created_by, + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) - - return ChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def members(self): - """ - Access the members - :returns: twilio.rest.chat.v2.service.channel.member.MemberList - :rtype: twilio.rest.chat.v2.service.channel.member.MemberList - """ - if self._members is None: - self._members = MemberList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._members - - @property - def messages(self): - """ - Access the messages + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.chat.v2.service.channel.message.MessageList - :rtype: twilio.rest.chat.v2.service.channel.message.MessageList - """ - if self._messages is None: - self._messages = MessageList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._messages + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + - @property - def invites(self): - """ - Access the invites - - :returns: twilio.rest.chat.v2.service.channel.invite.InviteList - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteList - """ - if self._invites is None: - self._invites = InviteList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._invites - - @property - def webhooks(self): - """ - Access the webhooks - - :returns: twilio.rest.chat.v2.service.channel.webhook.WebhookList - :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookList - """ - if self._webhooks is None: - self._webhooks = WebhookList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._webhooks + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class ChannelInstance(InstanceResource): - - class ChannelType(object): - PUBLIC = "public" - PRIVATE = "private" + return '' - class WebhookEnabledType(object): - TRUE = "true" - FALSE = "false" - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the ChannelInstance - :returns: twilio.rest.chat.v2.service.channel.ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance - """ - super(ChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'friendly_name': payload.get('friendly_name'), - 'unique_name': payload.get('unique_name'), - 'attributes': payload.get('attributes'), - 'type': payload.get('type'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'created_by': payload.get('created_by'), - 'members_count': deserialize.integer(payload.get('members_count')), - 'messages_count': deserialize.integer(payload.get('messages_count')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ChannelInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'unique_name' : payload.get('unique_name'), + 'attributes' : payload.get('attributes'), + 'type' : payload.get('type'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'created_by' : payload.get('created_by'), + 'members_count' : payload.get('members_count'), + 'messages_count' : payload.get('messages_count'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ChannelContext for this ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelContext - """ if self._context is None: self._context = ChannelContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def attributes(self): - """ - :returns: The JSON string that stores application-specific data - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def type(self): - """ - :returns: The visibility of the channel. Can be: `public` or `private` - :rtype: ChannelInstance.ChannelType - """ - return self._properties['type'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The identity of the User that created the channel - :rtype: unicode - """ - return self._properties['created_by'] - - @property - def members_count(self): - """ - :returns: The number of Members in the Channel - :rtype: unicode - """ - return self._properties['members_count'] - + def invites(self): + return self._proxy.invites @property - def messages_count(self): - """ - :returns: The number of Messages that have been passed in the Channel - :rtype: unicode - """ - return self._properties['messages_count'] - + def members(self): + return self._proxy.members @property - def url(self): - """ - :returns: The absolute URL of the Channel resource - :rtype: unicode - """ - return self._properties['url'] - + def messages(self): + return self._proxy.messages @property - def links(self): - """ - :returns: Absolute URLs to access the Members, Messages , Invites and, if it exists, the last Message for the Channel - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the ChannelInstance - - :returns: The fetched ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance - """ - return self._proxy.fetch() - - def delete(self, x_twilio_webhook_enabled=values.unset): - """ - Deletes the ChannelInstance - - :param ChannelInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete(x_twilio_webhook_enabled=x_twilio_webhook_enabled, ) + def webhooks(self): + return self._proxy.webhooks + - def update(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset, date_created=values.unset, - date_updated=values.unset, created_by=values.unset, - x_twilio_webhook_enabled=values.unset): + def __repr__(self): """ - Update the ChannelInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode attributes: A valid JSON string that contains application-specific data - :param datetime date_created: The ISO 8601 date and time in GMT when the resource was created - :param datetime date_updated: The ISO 8601 date and time in GMT when the resource was updated - :param unicode created_by: The identity of the User that created the Channel - :param ChannelInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated ChannelInstance - :rtype: twilio.rest.chat.v2.service.channel.ChannelInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update( - friendly_name=friendly_name, - unique_name=unique_name, - attributes=attributes, - date_created=date_created, - date_updated=date_updated, - created_by=created_by, - x_twilio_webhook_enabled=x_twilio_webhook_enabled, - ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def members(self): - """ - Access the members - :returns: twilio.rest.chat.v2.service.channel.member.MemberList - :rtype: twilio.rest.chat.v2.service.channel.member.MemberList - """ - return self._proxy.members - @property - def messages(self): - """ - Access the messages +class ChannelListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.chat.v2.service.channel.message.MessageList - :rtype: twilio.rest.chat.v2.service.channel.message.MessageList - """ - return self._proxy.messages + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Channels' + + + """ + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - @property - def invites(self): - """ - Access the invites + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.chat.v2.service.channel.invite.InviteList - :rtype: twilio.rest.chat.v2.service.channel.invite.InviteList - """ - return self._proxy.invites + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, type, page_size): + + data = values.of({ + 'type': type,'page_size': page_size, + }) - @property - def webhooks(self): - """ - Access the webhooks + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.chat.v2.service.channel.webhook.WebhookList - :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookList - """ - return self._proxy.webhooks + return ChannelPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/chat/v2/service/user.py b/twilio/rest/chat/v2/service/user.py deleted file mode 100644 index 37cf8dd6fd..0000000000 --- a/twilio/rest/chat/v2/service/user.py +++ /dev/null @@ -1,187 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Chat - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.user.user_binding import UserBindingListInstancefrom twilio.rest.user.user_channel import UserChannelListInstance - - -class UserContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Users/${sid}' - - self._user_bindings = None - self._user_channels = None - - def delete(self): - - - - """ - Deletes the UserInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the UserInstance - - :returns: The fetched UserInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - def update(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class UserInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'attributes' : payload.get('attributes'), - 'friendly_name' : payload.get('friendly_name'), - 'role_sid' : payload.get('role_sid'), - 'identity' : payload.get('identity'), - 'is_online' : payload.get('is_online'), - 'is_notifiable' : payload.get('is_notifiable'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'joined_channels_count' : payload.get('joined_channels_count'), - 'links' : payload.get('links'), - 'url' : payload.get('url'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = UserContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def user_bindings(self): - return self._proxy.user_bindings - @property - def user_channels(self): - return self._proxy.user_channels - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class UserListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Users' - - - """ - def create(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return UserPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/chat/v2/service/user/__init__.py b/twilio/rest/chat/v2/service/user/__init__.py index 065041550b..37cf8dd6fd 100644 --- a/twilio/rest/chat/v2/service/user/__init__.py +++ b/twilio/rest/chat/v2/service/user/__init__.py @@ -1,253 +1,47 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Chat + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.chat.v2.service.user.user_binding import UserBindingList -from twilio.rest.chat.v2.service.user.user_channel import UserChannelList - - -class UserList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the UserList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.chat.v2.service.user.UserList - :rtype: twilio.rest.chat.v2.service.user.UserList - """ - super(UserList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Users'.format(**self._solution) - - def create(self, identity, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Create the UserInstance - - :param unicode identity: The `identity` value that identifies the new resource's User - :param unicode role_sid: The SID of the Role assigned to this user - :param unicode attributes: A valid JSON string that contains application-specific data - :param unicode friendly_name: A string to describe the new resource - :param UserInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The created UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance - """ - data = values.of({ - 'Identity': identity, - 'RoleSid': role_sid, - 'Attributes': attributes, - 'FriendlyName': friendly_name, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, headers=headers, ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams UserInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.chat.v2.service.user.UserInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists UserInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.chat.v2.service.user.UserInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return UserPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a UserContext - - :param sid: The SID of the User resource to fetch - - :returns: twilio.rest.chat.v2.service.user.UserContext - :rtype: twilio.rest.chat.v2.service.user.UserContext - """ - return UserContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a UserContext - - :param sid: The SID of the User resource to fetch - - :returns: twilio.rest.chat.v2.service.user.UserContext - :rtype: twilio.rest.chat.v2.service.user.UserContext - """ - return UserContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.version import Version - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class UserPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the UserPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.chat.v2.service.user.UserPage - :rtype: twilio.rest.chat.v2.service.user.UserPage - """ - super(UserPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.chat.v2.service.user.UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance - """ - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.user.user_binding import UserBindingListInstancefrom twilio.rest.user.user_channel import UserChannelListInstance class UserContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the UserContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the resource from - :param sid: The SID of the User resource to fetch - - :returns: twilio.rest.chat.v2.service.user.UserContext - :rtype: twilio.rest.chat.v2.service.user.UserContext - """ - super(UserContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Users/{sid}'.format(**self._solution) - - # Dependents - self._user_channels = None + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Users/${sid}' + self._user_bindings = None - - def fetch(self): - """ - Fetch the UserInstance - - :returns: The fetched UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return UserInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - + self._user_channels = None + def delete(self): + + + """ Deletes the UserInstance @@ -255,305 +49,139 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset, x_twilio_webhook_enabled=values.unset): + + def fetch(self): + """ - Update the UserInstance - - :param unicode role_sid: The SID id of the Role assigned to this user - :param unicode attributes: A valid JSON string that contains application-specific data - :param unicode friendly_name: A string to describe the resource - :param UserInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header + Fetch the UserInstance - :returns: The updated UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance + :returns: The fetched UserInstance + #TODO: add rtype docs """ - data = values.of({'RoleSid': role_sid, 'Attributes': attributes, 'FriendlyName': friendly_name, }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) + payload = self._version.fetch(method='GET', uri=self._uri, ) - return UserInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - @property - def user_channels(self): - """ - Access the user_channels + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - :returns: twilio.rest.chat.v2.service.user.user_channel.UserChannelList - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelList - """ - if self._user_channels is None: - self._user_channels = UserChannelList( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['sid'], - ) - return self._user_channels + payload = self._version.update(method='post', uri=self._uri, data=data, ) - @property - def user_bindings(self): - """ - Access the user_bindings + return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingList - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingList - """ - if self._user_bindings is None: - self._user_bindings = UserBindingList( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['sid'], - ) - return self._user_bindings + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class UserInstance(InstanceResource): - - class WebhookEnabledType(object): - TRUE = "true" - FALSE = "false" - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the UserInstance - - :returns: twilio.rest.chat.v2.service.user.UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance - """ - super(UserInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'attributes': payload.get('attributes'), - 'friendly_name': payload.get('friendly_name'), - 'role_sid': payload.get('role_sid'), - 'identity': payload.get('identity'), - 'is_online': payload.get('is_online'), - 'is_notifiable': payload.get('is_notifiable'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'joined_channels_count': deserialize.integer(payload.get('joined_channels_count')), - 'links': payload.get('links'), - 'url': payload.get('url'), +class UserInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'attributes' : payload.get('attributes'), + 'friendly_name' : payload.get('friendly_name'), + 'role_sid' : payload.get('role_sid'), + 'identity' : payload.get('identity'), + 'is_online' : payload.get('is_online'), + 'is_notifiable' : payload.get('is_notifiable'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'joined_channels_count' : payload.get('joined_channels_count'), + 'links' : payload.get('links'), + 'url' : payload.get('url'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserContext for this UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserContext - """ if self._context is None: self._context = UserContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def attributes(self): - """ - :returns: The JSON string that stores application-specific data - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def role_sid(self): - """ - :returns: The SID of the Role assigned to the user - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def identity(self): - """ - :returns: The string that identifies the resource's User - :rtype: unicode - """ - return self._properties['identity'] - - @property - def is_online(self): - """ - :returns: Whether the User is actively connected to the Service instance and online - :rtype: bool - """ - return self._properties['is_online'] - - @property - def is_notifiable(self): - """ - :returns: Whether the User has a potentially valid Push Notification registration for the Service instance - :rtype: bool - """ - return self._properties['is_notifiable'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def joined_channels_count(self): - """ - :returns: The number of Channels the User is a Member of - :rtype: unicode - """ - return self._properties['joined_channels_count'] - - @property - def links(self): - """ - :returns: The absolute URLs of the Channel and Binding resources related to the user - :rtype: unicode - """ - return self._properties['links'] - + def user_bindings(self): + return self._proxy.user_bindings @property - def url(self): - """ - :returns: The absolute URL of the User resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the UserInstance + def user_channels(self): + return self._proxy.user_channels + - :returns: The fetched UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance + def __repr__(self): """ - return self._proxy.fetch() - - def delete(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the UserInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def update(self, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Update the UserInstance - :param unicode role_sid: The SID id of the Role assigned to this user - :param unicode attributes: A valid JSON string that contains application-specific data - :param unicode friendly_name: A string to describe the resource - :param UserInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header +class UserListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The updated UserInstance - :rtype: twilio.rest.chat.v2.service.user.UserInstance - """ - return self._proxy.update( - role_sid=role_sid, - attributes=attributes, - friendly_name=friendly_name, - x_twilio_webhook_enabled=x_twilio_webhook_enabled, - ) + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Users' + + + """ + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - @property - def user_channels(self): - """ - Access the user_channels + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.chat.v2.service.user.user_channel.UserChannelList - :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelList - """ - return self._proxy.user_channels + return UserInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def user_bindings(self): - """ - Access the user_bindings + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.chat.v2.service.user.user_binding.UserBindingList - :rtype: twilio.rest.chat.v2.service.user.user_binding.UserBindingList - """ - return self._proxy.user_bindings + return UserPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/content/v1/content.py b/twilio/rest/content/v1/content.py deleted file mode 100644 index 1fc8c7f688..0000000000 --- a/twilio/rest/content/v1/content.py +++ /dev/null @@ -1,154 +0,0 @@ -""" - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.approval_fetch import ApprovalFetchListInstance - - -class ContentContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Content/${sid}' - - self._approval_fetch = None - - def delete(self): - - - - """ - Deletes the ContentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ContentInstance - - :returns: The fetched ContentInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ContentInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ContentInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'language' : payload.get('language'), - 'variables' : payload.get('variables'), - 'types' : payload.get('types'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ContentContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def approval_fetch(self): - return self._proxy.approval_fetch - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ContentListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Content' - - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ContentPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/content/v1/content/__init__.py b/twilio/rest/content/v1/content/__init__.py index 630096f26d..1fc8c7f688 100644 --- a/twilio/rest/content/v1/content/__init__.py +++ b/twilio/rest/content/v1/content/__init__.py @@ -1,416 +1,154 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.content.v1.content.approval_fetch import ApprovalFetchList - - -class ContentList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the ContentList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.content.v1.content.ContentList - :rtype: twilio.rest.content.v1.content.ContentList - """ - super(ContentList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Content'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.content.v1.content.ContentInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - 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 int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.content.v1.content.ContentInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ContentInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ContentInstance - :rtype: twilio.rest.content.v1.content.ContentPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ContentPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ContentInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ContentInstance - :rtype: twilio.rest.content.v1.content.ContentPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ContentPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ContentContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.content.v1.content.ContentContext - :rtype: twilio.rest.content.v1.content.ContentContext - """ - return ContentContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ContentContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.content.v1.content.ContentContext - :rtype: twilio.rest.content.v1.content.ContentContext - """ - return ContentContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base.version import Version +from twilio.base.page import Page -class ContentPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the ContentPage +# from twilio.rest.content.approval_fetch import ApprovalFetchListInstance - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.content.v1.content.ContentPage - :rtype: twilio.rest.content.v1.content.ContentPage - """ - super(ContentPage, self).__init__(version, response) +class ContentContext(InstanceContext): + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ContentInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.content.v1.content.ContentInstance - :rtype: twilio.rest.content.v1.content.ContentInstance - """ - return ContentInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ContentContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ + self._solution = { 'sid': sid, } + self._uri = '/Content/${sid}' + + self._approval_fetch = None + + def delete(self): + + - def __init__(self, version, sid): """ - Initialize the ContentContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource + Deletes the ContentInstance - :returns: twilio.rest.content.v1.content.ContentContext - :rtype: twilio.rest.content.v1.content.ContentContext + :returns: True if delete succeeds, False otherwise + :rtype: bool """ - super(ContentContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Content/{sid}'.format(**self._solution) - - # Dependents - self._approval_fetch = None - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the ContentInstance :returns: The fetched ContentInstance - :rtype: twilio.rest.content.v1.content.ContentInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return ContentInstance(self._version, payload, sid=self._solution['sid'], ) + - def delete(self): - """ - Deletes the ContentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def approval_fetch(self): - """ - Access the approval_fetch - - :returns: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchList - :rtype: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchList - """ - if self._approval_fetch is None: - self._approval_fetch = ApprovalFetchList(self._version, sid=self._solution['sid'], ) - return self._approval_fetch + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ContentInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, sid=None): - """ - Initialize the ContentInstance - - :returns: twilio.rest.content.v1.content.ContentInstance - :rtype: twilio.rest.content.v1.content.ContentInstance - """ - super(ContentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'language': payload.get('language'), - 'variables': payload.get('variables'), - 'types': payload.get('types'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ContentInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'language' : payload.get('language'), + 'variables' : payload.get('variables'), + 'types' : payload.get('types'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - 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 - :rtype: twilio.rest.content.v1.content.ContentContext - """ if self._context is None: - self._context = ContentContext(self._version, sid=self._solution['sid'], ) + self._context = ContentContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT that the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: A string name used to describe the Content resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def language(self): - """ - :returns: Two-letter language code identifying the language the Content resource is in. - :rtype: unicode - """ - return self._properties['language'] - - @property - def variables(self): - """ - :returns: Defines the default placeholder values for variables included in the Content resource - :rtype: dict - """ - return self._properties['variables'] - - @property - def types(self): - """ - :returns: The Content types (e.g. twilio/text) for this Content resource - :rtype: dict - """ - return self._properties['types'] - - @property - def url(self): - """ - :returns: The URL of the resource, relative to `https://content.twilio.com` - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: A list of links related to the Content resource - :rtype: unicode - """ - return self._properties['links'] + def approval_fetch(self): + return self._proxy.approval_fetch + - def fetch(self): + def __repr__(self): """ - Fetch the ContentInstance - - :returns: The fetched ContentInstance - :rtype: twilio.rest.content.v1.content.ContentInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the ContentInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - @property - def approval_fetch(self): - """ - Access the approval_fetch +class ContentListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchList - :rtype: twilio.rest.content.v1.content.approval_fetch.ApprovalFetchList - """ - return self._proxy.approval_fetch + # Path Solution + self._solution = { } + self._uri = '/Content' + + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ContentPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/configuration.py b/twilio/rest/conversations/v1/configuration.py deleted file mode 100644 index 4cc0bc3a38..0000000000 --- a/twilio/rest/conversations/v1/configuration.py +++ /dev/null @@ -1,135 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Conversations - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.rest.configuration.webhook import WebhookListInstance - - -class ConfigurationContext(InstanceContext): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Configuration' - - - def fetch(self): - - """ - Fetch the ConfigurationInstance - - :returns: The fetched ConfigurationInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ConfigurationInstance(self._version, payload, ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ConfigurationInstance(self._version, payload, ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ConfigurationInstance(InstanceResource): - def __init__(self, version, payload): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'default_chat_service_sid' : payload.get('default_chat_service_sid'), - 'default_messaging_service_sid' : payload.get('default_messaging_service_sid'), - 'default_inactive_timer' : payload.get('default_inactive_timer'), - 'default_closed_timer' : payload.get('default_closed_timer'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - - } - - @property - def _proxy(self): - if self._context is None: - self._context = ConfigurationContext( - self._version, - - ) - return self._context - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ConfigurationListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '' - - self._webhooks = None - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/conversations/v1/configuration/__init__.py b/twilio/rest/conversations/v1/configuration/__init__.py index 01e15e782e..4cc0bc3a38 100644 --- a/twilio/rest/conversations/v1/configuration/__init__.py +++ b/twilio/rest/conversations/v1/configuration/__init__.py @@ -1,313 +1,135 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Conversations + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.conversations.v1.configuration.webhook import WebhookList - - -class ConfigurationList(ListResource): - - def __init__(self, version): - """ - Initialize the ConfigurationList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.conversations.v1.configuration.ConfigurationList - :rtype: twilio.rest.conversations.v1.configuration.ConfigurationList - """ - super(ConfigurationList, self).__init__(version) - - # Path Solution - self._solution = {} - - # Components - self._webhooks = None - - @property - def webhooks(self): - """ - Access the webhooks - - :returns: twilio.rest.conversations.v1.configuration.webhook.WebhookList - :rtype: twilio.rest.conversations.v1.configuration.webhook.WebhookList - """ - if self._webhooks is None: - self._webhooks = WebhookList(self._version, ) - return self._webhooks - - def get(self): - """ - Constructs a ConfigurationContext - - :returns: twilio.rest.conversations.v1.configuration.ConfigurationContext - :rtype: twilio.rest.conversations.v1.configuration.ConfigurationContext - """ - return ConfigurationContext(self._version, ) - - def __call__(self): - """ - Constructs a ConfigurationContext - - :returns: twilio.rest.conversations.v1.configuration.ConfigurationContext - :rtype: twilio.rest.conversations.v1.configuration.ConfigurationContext - """ - return ConfigurationContext(self._version, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ConfigurationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ConfigurationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.conversations.v1.configuration.ConfigurationPage - :rtype: twilio.rest.conversations.v1.configuration.ConfigurationPage - """ - super(ConfigurationPage, self).__init__(version, response) +from twilio.base.version import Version - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ConfigurationInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.conversations.v1.configuration.ConfigurationInstance - :rtype: twilio.rest.conversations.v1.configuration.ConfigurationInstance - """ - return ConfigurationInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.configuration.webhook import WebhookListInstance class ConfigurationContext(InstanceContext): - - def __init__(self, version): - """ - Initialize the ConfigurationContext - - :param Version version: Version that contains the resource - - :returns: twilio.rest.conversations.v1.configuration.ConfigurationContext - :rtype: twilio.rest.conversations.v1.configuration.ConfigurationContext - """ - super(ConfigurationContext, self).__init__(version) + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {} - self._uri = '/Configuration'.format(**self._solution) - + self._solution = { } + self._uri = '/Configuration' + + def fetch(self): + """ Fetch the ConfigurationInstance :returns: The fetched ConfigurationInstance - :rtype: twilio.rest.conversations.v1.configuration.ConfigurationInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return ConfigurationInstance(self._version, payload, ) + - def update(self, default_chat_service_sid=values.unset, - default_messaging_service_sid=values.unset, - default_inactive_timer=values.unset, - default_closed_timer=values.unset): - """ - Update the ConfigurationInstance - - :param unicode default_chat_service_sid: The SID of the default Conversation Service that every new conversation will be associated with. - :param unicode default_messaging_service_sid: The SID of the default Messaging Service that every new conversation will be associated with. - :param unicode default_inactive_timer: Default ISO8601 duration when conversation will be switched to `inactive` state. - :param unicode default_closed_timer: Default ISO8601 duration when conversation will be switched to `closed` state. - - :returns: The updated ConfigurationInstance - :rtype: twilio.rest.conversations.v1.configuration.ConfigurationInstance - """ + + + def update(self, body): data = values.of({ - 'DefaultChatServiceSid': default_chat_service_sid, - 'DefaultMessagingServiceSid': default_messaging_service_sid, - 'DefaultInactiveTimer': default_inactive_timer, - 'DefaultClosedTimer': default_closed_timer, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return ConfigurationInstance(self._version, payload, ) + + + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ConfigurationInstance(InstanceResource): +class ConfigurationInstance(InstanceResource): def __init__(self, version, payload): - """ - Initialize the ConfigurationInstance - - :returns: twilio.rest.conversations.v1.configuration.ConfigurationInstance - :rtype: twilio.rest.conversations.v1.configuration.ConfigurationInstance - """ - super(ConfigurationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'default_chat_service_sid': payload.get('default_chat_service_sid'), - 'default_messaging_service_sid': payload.get('default_messaging_service_sid'), - 'default_inactive_timer': payload.get('default_inactive_timer'), - 'default_closed_timer': payload.get('default_closed_timer'), - 'url': payload.get('url'), - 'links': payload.get('links'), + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'default_chat_service_sid' : payload.get('default_chat_service_sid'), + 'default_messaging_service_sid' : payload.get('default_messaging_service_sid'), + 'default_inactive_timer' : payload.get('default_inactive_timer'), + 'default_closed_timer' : payload.get('default_closed_timer'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {} + self._solution = { + + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ConfigurationContext for this ConfigurationInstance - :rtype: twilio.rest.conversations.v1.configuration.ConfigurationContext - """ if self._context is None: - self._context = ConfigurationContext(self._version, ) + self._context = ConfigurationContext( + self._version, + + ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account responsible for this configuration. - :rtype: unicode - """ - return self._properties['account_sid'] + - @property - def default_chat_service_sid(self): - """ - :returns: The SID of the default Conversation Service that every new conversation is associated with. - :rtype: unicode - """ - return self._properties['default_chat_service_sid'] - - @property - def default_messaging_service_sid(self): - """ - :returns: The SID of the default Messaging Service that every new conversation is associated with. - :rtype: unicode - """ - return self._properties['default_messaging_service_sid'] - - @property - def default_inactive_timer(self): - """ - :returns: Default ISO8601 duration when conversation will be switched to `inactive` state. - :rtype: unicode - """ - return self._properties['default_inactive_timer'] - - @property - def default_closed_timer(self): - """ - :returns: Default ISO8601 duration when conversation will be switched to `closed` state. - :rtype: unicode - """ - return self._properties['default_closed_timer'] - - @property - def url(self): - """ - :returns: An absolute URL for this global configuration. - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: Absolute URLs to access the webhook and default service configurations. - :rtype: unicode + def __repr__(self): """ - return self._properties['links'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the ConfigurationInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched ConfigurationInstance - :rtype: twilio.rest.conversations.v1.configuration.ConfigurationInstance - """ - return self._proxy.fetch() - def update(self, default_chat_service_sid=values.unset, - default_messaging_service_sid=values.unset, - default_inactive_timer=values.unset, - default_closed_timer=values.unset): - """ - Update the ConfigurationInstance - :param unicode default_chat_service_sid: The SID of the default Conversation Service that every new conversation will be associated with. - :param unicode default_messaging_service_sid: The SID of the default Messaging Service that every new conversation will be associated with. - :param unicode default_inactive_timer: Default ISO8601 duration when conversation will be switched to `inactive` state. - :param unicode default_closed_timer: Default ISO8601 duration when conversation will be switched to `closed` state. +class ConfigurationListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The updated ConfigurationInstance - :rtype: twilio.rest.conversations.v1.configuration.ConfigurationInstance - """ - return self._proxy.update( - default_chat_service_sid=default_chat_service_sid, - default_messaging_service_sid=default_messaging_service_sid, - default_inactive_timer=default_inactive_timer, - default_closed_timer=default_closed_timer, - ) + # Path Solution + self._solution = { } + self._uri = '' + + self._webhooks = None + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/conversation.py b/twilio/rest/conversations/v1/conversation.py deleted file mode 100644 index 673db29e22..0000000000 --- a/twilio/rest/conversations/v1/conversation.py +++ /dev/null @@ -1,191 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Conversations - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.conversation.message import MessageListInstancefrom twilio.rest.conversation.participant import ParticipantListInstancefrom twilio.rest.conversation.webhook import WebhookListInstance - - -class ConversationContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Conversations/${sid}' - - self._messages = None - self._participants = None - self._webhooks = None - - def delete(self, x_twilio_webhook_enabled): - - - - """ - Deletes the ConversationInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ConversationInstance - - :returns: The fetched ConversationInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ConversationInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ConversationInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ConversationInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'chat_service_sid' : payload.get('chat_service_sid'), - 'messaging_service_sid' : payload.get('messaging_service_sid'), - 'sid' : payload.get('sid'), - 'friendly_name' : payload.get('friendly_name'), - 'unique_name' : payload.get('unique_name'), - 'attributes' : payload.get('attributes'), - 'state' : payload.get('state'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'timers' : payload.get('timers'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - 'bindings' : payload.get('bindings'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ConversationContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def messages(self): - return self._proxy.messages - @property - def participants(self): - return self._proxy.participants - @property - def webhooks(self): - return self._proxy.webhooks - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ConversationListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Conversations' - - - """ - def create(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ConversationInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ConversationPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/conversations/v1/conversation/__init__.py b/twilio/rest/conversations/v1/conversation/__init__.py index 229f3288fe..673db29e22 100644 --- a/twilio/rest/conversations/v1/conversation/__init__.py +++ b/twilio/rest/conversations/v1/conversation/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,606 +19,173 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.conversations.v1.conversation.message import MessageList -from twilio.rest.conversations.v1.conversation.participant import ParticipantList -from twilio.rest.conversations.v1.conversation.webhook import WebhookList - - -class ConversationList(ListResource): - - def __init__(self, version): - """ - Initialize the ConversationList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.conversations.v1.conversation.ConversationList - :rtype: twilio.rest.conversations.v1.conversation.ConversationList - """ - super(ConversationList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Conversations'.format(**self._solution) - - def create(self, friendly_name=values.unset, unique_name=values.unset, - date_created=values.unset, date_updated=values.unset, - messaging_service_sid=values.unset, attributes=values.unset, - state=values.unset, timers_inactive=values.unset, - timers_closed=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Create the ConversationInstance - - :param unicode friendly_name: The human-readable name of this conversation. - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param datetime date_created: The date that this resource was created. - :param datetime date_updated: The date that this resource was last updated. - :param unicode messaging_service_sid: The unique ID of the Messaging Service this conversation belongs to. - :param unicode attributes: An optional string metadata field you can use to store any data you wish. - :param ConversationInstance.State state: Current state of this conversation. - :param unicode timers_inactive: ISO8601 duration when conversation will be switched to `inactive` state. - :param unicode timers_closed: ISO8601 duration when conversation will be switched to `closed` state. - :param ConversationInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The created ConversationInstance - :rtype: twilio.rest.conversations.v1.conversation.ConversationInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'MessagingServiceSid': messaging_service_sid, - 'Attributes': attributes, - 'State': state, - 'Timers.Inactive': timers_inactive, - 'Timers.Closed': timers_closed, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, headers=headers, ) - - return ConversationInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ConversationInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.conversations.v1.conversation.ConversationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ConversationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.conversations.v1.conversation.ConversationInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) +from twilio.base.version import Version - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ConversationInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ConversationInstance - :rtype: twilio.rest.conversations.v1.conversation.ConversationPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ConversationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ConversationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ConversationInstance - :rtype: twilio.rest.conversations.v1.conversation.ConversationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ConversationPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ConversationContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.conversation.ConversationContext - :rtype: twilio.rest.conversations.v1.conversation.ConversationContext - """ - return ConversationContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ConversationContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.conversation.ConversationContext - :rtype: twilio.rest.conversations.v1.conversation.ConversationContext - """ - return ConversationContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ConversationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ConversationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.conversations.v1.conversation.ConversationPage - :rtype: twilio.rest.conversations.v1.conversation.ConversationPage - """ - super(ConversationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ConversationInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.conversations.v1.conversation.ConversationInstance - :rtype: twilio.rest.conversations.v1.conversation.ConversationInstance - """ - return ConversationInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.conversation.message import MessageListInstancefrom twilio.rest.conversation.participant import ParticipantListInstancefrom twilio.rest.conversation.webhook import WebhookListInstance class ConversationContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the ConversationContext - - :param Version version: Version that contains the resource - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.conversation.ConversationContext - :rtype: twilio.rest.conversations.v1.conversation.ConversationContext - """ - super(ConversationContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Conversations/{sid}'.format(**self._solution) - - # Dependents - self._participants = None + self._solution = { 'sid': sid, } + self._uri = '/Conversations/${sid}' + self._messages = None + self._participants = None self._webhooks = None + + def delete(self, x_twilio_webhook_enabled): + + - def update(self, friendly_name=values.unset, date_created=values.unset, - date_updated=values.unset, attributes=values.unset, - messaging_service_sid=values.unset, state=values.unset, - timers_inactive=values.unset, timers_closed=values.unset, - unique_name=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Update the ConversationInstance - - :param unicode friendly_name: The human-readable name of this conversation. - :param datetime date_created: The date that this resource was created. - :param datetime date_updated: The date that this resource was last updated. - :param unicode attributes: An optional string metadata field you can use to store any data you wish. - :param unicode messaging_service_sid: The unique ID of the Messaging Service this conversation belongs to. - :param ConversationInstance.State state: Current state of this conversation. - :param unicode timers_inactive: ISO8601 duration when conversation will be switched to `inactive` state. - :param unicode timers_closed: ISO8601 duration when conversation will be switched to `closed` state. - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param ConversationInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated ConversationInstance - :rtype: twilio.rest.conversations.v1.conversation.ConversationInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'Attributes': attributes, - 'MessagingServiceSid': messaging_service_sid, - 'State': state, - 'Timers.Inactive': timers_inactive, - 'Timers.Closed': timers_closed, - 'UniqueName': unique_name, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) - - return ConversationInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self, x_twilio_webhook_enabled=values.unset): """ Deletes the ConversationInstance - :param ConversationInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - :returns: True if delete succeeds, False otherwise :rtype: bool """ - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the ConversationInstance :returns: The fetched ConversationInstance - :rtype: twilio.rest.conversations.v1.conversation.ConversationInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return ConversationInstance(self._version, payload, sid=self._solution['sid'], ) + - @property - def participants(self): - """ - Access the participants - - :returns: twilio.rest.conversations.v1.conversation.participant.ParticipantList - :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantList - """ - if self._participants is None: - self._participants = ParticipantList(self._version, conversation_sid=self._solution['sid'], ) - return self._participants - - @property - def messages(self): - """ - Access the messages + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - :returns: twilio.rest.conversations.v1.conversation.message.MessageList - :rtype: twilio.rest.conversations.v1.conversation.message.MessageList - """ - if self._messages is None: - self._messages = MessageList(self._version, conversation_sid=self._solution['sid'], ) - return self._messages + payload = self._version.update(method='post', uri=self._uri, data=data, ) - @property - def webhooks(self): - """ - Access the webhooks + return ConversationInstance(self._version, payload, sid=self._solution['sid'], ) + + - :returns: twilio.rest.conversations.v1.conversation.webhook.WebhookList - :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookList - """ - if self._webhooks is None: - self._webhooks = WebhookList(self._version, conversation_sid=self._solution['sid'], ) - return self._webhooks + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class ConversationInstance(InstanceResource): + return '' - class WebhookEnabledType(object): - TRUE = "true" - FALSE = "false" - class State(object): - INACTIVE = "inactive" - ACTIVE = "active" - CLOSED = "closed" - def __init__(self, version, payload, sid=None): - """ - Initialize the ConversationInstance - - :returns: twilio.rest.conversations.v1.conversation.ConversationInstance - :rtype: twilio.rest.conversations.v1.conversation.ConversationInstance - """ - super(ConversationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'chat_service_sid': payload.get('chat_service_sid'), - 'messaging_service_sid': payload.get('messaging_service_sid'), - 'sid': payload.get('sid'), - 'friendly_name': payload.get('friendly_name'), - 'unique_name': payload.get('unique_name'), - 'attributes': payload.get('attributes'), - 'state': payload.get('state'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'timers': payload.get('timers'), - 'url': payload.get('url'), - 'links': payload.get('links'), - 'bindings': payload.get('bindings'), +class ConversationInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'chat_service_sid' : payload.get('chat_service_sid'), + 'messaging_service_sid' : payload.get('messaging_service_sid'), + 'sid' : payload.get('sid'), + 'friendly_name' : payload.get('friendly_name'), + 'unique_name' : payload.get('unique_name'), + 'attributes' : payload.get('attributes'), + 'state' : payload.get('state'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'timers' : payload.get('timers'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), + 'bindings' : payload.get('bindings'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ConversationContext for this ConversationInstance - :rtype: twilio.rest.conversations.v1.conversation.ConversationContext - """ if self._context is None: - self._context = ConversationContext(self._version, sid=self._solution['sid'], ) + self._context = ConversationContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this conversation. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def chat_service_sid(self): - """ - :returns: The unique ID of the Conversation Service this conversation belongs to. - :rtype: unicode - """ - return self._properties['chat_service_sid'] - - @property - def messaging_service_sid(self): - """ - :returns: The unique ID of the Messaging Service this conversation belongs to. - :rtype: unicode - """ - return self._properties['messaging_service_sid'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def friendly_name(self): - """ - :returns: The human-readable name of this conversation. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def attributes(self): - """ - :returns: An optional string metadata field you can use to store any data you wish. - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def state(self): - """ - :returns: Current state of this conversation. - :rtype: ConversationInstance.State - """ - return self._properties['state'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def timers(self): - """ - :returns: Timer date values for this conversation. - :rtype: dict - """ - return self._properties['timers'] - - @property - def url(self): - """ - :returns: An absolute URL for this conversation. - :rtype: unicode - """ - return self._properties['url'] - + def messages(self): + return self._proxy.messages @property - def links(self): - """ - :returns: Absolute URLs to access the participants, messages and webhooks of this conversation. - :rtype: unicode - """ - return self._properties['links'] - + def participants(self): + return self._proxy.participants @property - def bindings(self): - """ - :returns: The bindings - :rtype: dict - """ - return self._properties['bindings'] + def webhooks(self): + return self._proxy.webhooks + - def update(self, friendly_name=values.unset, date_created=values.unset, - date_updated=values.unset, attributes=values.unset, - messaging_service_sid=values.unset, state=values.unset, - timers_inactive=values.unset, timers_closed=values.unset, - unique_name=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Update the ConversationInstance - - :param unicode friendly_name: The human-readable name of this conversation. - :param datetime date_created: The date that this resource was created. - :param datetime date_updated: The date that this resource was last updated. - :param unicode attributes: An optional string metadata field you can use to store any data you wish. - :param unicode messaging_service_sid: The unique ID of the Messaging Service this conversation belongs to. - :param ConversationInstance.State state: Current state of this conversation. - :param unicode timers_inactive: ISO8601 duration when conversation will be switched to `inactive` state. - :param unicode timers_closed: ISO8601 duration when conversation will be switched to `closed` state. - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param ConversationInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated ConversationInstance - :rtype: twilio.rest.conversations.v1.conversation.ConversationInstance + def __repr__(self): """ - return self._proxy.update( - friendly_name=friendly_name, - date_created=date_created, - date_updated=date_updated, - attributes=attributes, - messaging_service_sid=messaging_service_sid, - state=state, - timers_inactive=timers_inactive, - timers_closed=timers_closed, - unique_name=unique_name, - x_twilio_webhook_enabled=x_twilio_webhook_enabled, - ) - - def delete(self, x_twilio_webhook_enabled=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the ConversationInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param ConversationInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete(x_twilio_webhook_enabled=x_twilio_webhook_enabled, ) - def fetch(self): - """ - Fetch the ConversationInstance +class ConversationListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The fetched ConversationInstance - :rtype: twilio.rest.conversations.v1.conversation.ConversationInstance - """ - return self._proxy.fetch() - - @property - def participants(self): - """ - Access the participants - - :returns: twilio.rest.conversations.v1.conversation.participant.ParticipantList - :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantList - """ - return self._proxy.participants + # Path Solution + self._solution = { } + self._uri = '/Conversations' + + + """ + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - @property - def messages(self): - """ - Access the messages + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.conversations.v1.conversation.message.MessageList - :rtype: twilio.rest.conversations.v1.conversation.message.MessageList - """ - return self._proxy.messages + return ConversationInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def webhooks(self): - """ - Access the webhooks + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.conversations.v1.conversation.webhook.WebhookList - :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookList - """ - return self._proxy.webhooks + return ConversationPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/conversation/message.py b/twilio/rest/conversations/v1/conversation/message.py deleted file mode 100644 index bbb62a36ba..0000000000 --- a/twilio/rest/conversations/v1/conversation/message.py +++ /dev/null @@ -1,184 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Conversations - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.message.delivery_receipt import DeliveryReceiptListInstance - - -class MessageContext(InstanceContext): - def __init__(self, version: Version, conversation_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'conversation_sid': conversation_sid, 'sid': sid, } - self._uri = '/Conversations/${conversation_sid}/Messages/${sid}' - - self._delivery_receipts = None - - def delete(self, x_twilio_webhook_enabled): - - - - """ - Deletes the MessageInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the MessageInstance - - :returns: The fetched MessageInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return MessageInstance(self._version, payload, conversation_sid=self._solution['conversation_sid'], sid=self._solution['sid'], ) - - - - - def update(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return MessageInstance(self._version, payload, conversation_sid=self._solution['conversation_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class MessageInstance(InstanceResource): - def __init__(self, version, payload, conversation_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'conversation_sid' : payload.get('conversation_sid'), - 'sid' : payload.get('sid'), - 'index' : payload.get('index'), - 'author' : payload.get('author'), - 'body' : payload.get('body'), - 'media' : payload.get('media'), - 'attributes' : payload.get('attributes'), - 'participant_sid' : payload.get('participant_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'delivery' : payload.get('delivery'), - 'links' : payload.get('links'), - 'content_sid' : payload.get('content_sid'), - } - - self._context = None - self._solution = { - 'conversation_sid': conversation_sid or self._properties['conversation_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = MessageContext( - self._version, - conversation_sid=self._solution['conversation_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def delivery_receipts(self): - return self._proxy.delivery_receipts - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class MessageListInstance(ListResource): - def __init__(self, version: Version, conversation_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'conversation_sid': conversation_sid, } - self._uri = '/Conversations/${conversation_sid}/Messages' - - - """ - def create(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return MessageInstance(self._version, payload, conversation_sid=self._solution['conversation_sid']) - - """ - - """ - def page(self, order, page_size): - - data = values.of({ - 'order': order,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return MessagePage(self._version, payload, conversation_sid=self._solution['conversation_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/conversations/v1/conversation/message/__init__.py b/twilio/rest/conversations/v1/conversation/message/__init__.py index da2be8bd02..bbb62a36ba 100644 --- a/twilio/rest/conversations/v1/conversation/message/__init__.py +++ b/twilio/rest/conversations/v1/conversation/message/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,559 +19,166 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.conversations.v1.conversation.message.delivery_receipt import DeliveryReceiptList - - -class MessageList(ListResource): - - def __init__(self, version, conversation_sid): - """ - Initialize the MessageList - - :param Version version: Version that contains the resource - :param conversation_sid: The unique ID of the Conversation for this message. - - :returns: twilio.rest.conversations.v1.conversation.message.MessageList - :rtype: twilio.rest.conversations.v1.conversation.message.MessageList - """ - super(MessageList, self).__init__(version) - - # Path Solution - self._solution = {'conversation_sid': conversation_sid, } - self._uri = '/Conversations/{conversation_sid}/Messages'.format(**self._solution) - - def create(self, author=values.unset, body=values.unset, - date_created=values.unset, date_updated=values.unset, - attributes=values.unset, media_sid=values.unset, - x_twilio_webhook_enabled=values.unset): - """ - Create the MessageInstance - - :param unicode author: The channel specific identifier of the message's author. - :param unicode body: The content of the message. - :param datetime date_created: The date that this resource was created. - :param datetime date_updated: The date that this resource was last updated. - :param unicode attributes: A string metadata field you can use to store any data you wish. - :param unicode media_sid: The Media SID to be attached to the new Message. - :param MessageInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The created MessageInstance - :rtype: twilio.rest.conversations.v1.conversation.message.MessageInstance - """ - data = values.of({ - 'Author': author, - 'Body': body, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'Attributes': attributes, - 'MediaSid': media_sid, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, headers=headers, ) - - return MessageInstance(self._version, payload, conversation_sid=self._solution['conversation_sid'], ) - - def stream(self, order=values.unset, limit=None, page_size=None): - """ - Streams MessageInstance 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 MessageInstance.OrderType order: The sort order of the returned messages - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.conversations.v1.conversation.message.MessageInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(order=order, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, order=values.unset, limit=None, page_size=None): - """ - Lists MessageInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param MessageInstance.OrderType order: The sort order of the returned messages - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.conversations.v1.conversation.message.MessageInstance] - """ - return list(self.stream(order=order, limit=limit, page_size=page_size, )) - - def page(self, order=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MessageInstance records from the API. - Request is executed immediately - - :param MessageInstance.OrderType order: The sort order of the returned messages - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MessageInstance - :rtype: twilio.rest.conversations.v1.conversation.message.MessagePage - """ - data = values.of({ - 'Order': order, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return MessagePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MessageInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MessageInstance - :rtype: twilio.rest.conversations.v1.conversation.message.MessagePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MessagePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MessageContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.conversation.message.MessageContext - :rtype: twilio.rest.conversations.v1.conversation.message.MessageContext - """ - return MessageContext(self._version, conversation_sid=self._solution['conversation_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a MessageContext - - :param sid: A 34 character string that uniquely identifies this resource. +from twilio.base.version import Version - :returns: twilio.rest.conversations.v1.conversation.message.MessageContext - :rtype: twilio.rest.conversations.v1.conversation.message.MessageContext - """ - return MessageContext(self._version, conversation_sid=self._solution['conversation_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class MessagePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the MessagePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param conversation_sid: The unique ID of the Conversation for this message. - - :returns: twilio.rest.conversations.v1.conversation.message.MessagePage - :rtype: twilio.rest.conversations.v1.conversation.message.MessagePage - """ - super(MessagePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MessageInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.conversations.v1.conversation.message.MessageInstance - :rtype: twilio.rest.conversations.v1.conversation.message.MessageInstance - """ - return MessageInstance(self._version, payload, conversation_sid=self._solution['conversation_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.message.delivery_receipt import DeliveryReceiptListInstance class MessageContext(InstanceContext): - - def __init__(self, version, conversation_sid, sid): - """ - Initialize the MessageContext - - :param Version version: Version that contains the resource - :param conversation_sid: The unique ID of the Conversation for this message. - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.conversation.message.MessageContext - :rtype: twilio.rest.conversations.v1.conversation.message.MessageContext - """ - super(MessageContext, self).__init__(version) + def __init__(self, version: Version, conversation_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'conversation_sid': conversation_sid, 'sid': sid, } - self._uri = '/Conversations/{conversation_sid}/Messages/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'conversation_sid': conversation_sid, 'sid': sid, } + self._uri = '/Conversations/${conversation_sid}/Messages/${sid}' + self._delivery_receipts = None + + def delete(self, x_twilio_webhook_enabled): + + - def update(self, author=values.unset, body=values.unset, - date_created=values.unset, date_updated=values.unset, - attributes=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Update the MessageInstance - - :param unicode author: The channel specific identifier of the message's author. - :param unicode body: The content of the message. - :param datetime date_created: The date that this resource was created. - :param datetime date_updated: The date that this resource was last updated. - :param unicode attributes: A string metadata field you can use to store any data you wish. - :param MessageInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated MessageInstance - :rtype: twilio.rest.conversations.v1.conversation.message.MessageInstance - """ - data = values.of({ - 'Author': author, - 'Body': body, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'Attributes': attributes, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) - - return MessageInstance( - self._version, - payload, - conversation_sid=self._solution['conversation_sid'], - sid=self._solution['sid'], - ) - - def delete(self, x_twilio_webhook_enabled=values.unset): """ Deletes the MessageInstance - :param MessageInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - :returns: True if delete succeeds, False otherwise :rtype: bool """ - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the MessageInstance :returns: The fetched MessageInstance - :rtype: twilio.rest.conversations.v1.conversation.message.MessageInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return MessageInstance( - self._version, - payload, - conversation_sid=self._solution['conversation_sid'], - sid=self._solution['sid'], - ) + return MessageInstance(self._version, payload, conversation_sid=self._solution['conversation_sid'], sid=self._solution['sid'], ) + - @property - def delivery_receipts(self): - """ - Access the delivery_receipts + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - :returns: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptList - :rtype: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptList - """ - if self._delivery_receipts is None: - self._delivery_receipts = DeliveryReceiptList( - self._version, - conversation_sid=self._solution['conversation_sid'], - message_sid=self._solution['sid'], - ) - return self._delivery_receipts + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return MessageInstance(self._version, payload, conversation_sid=self._solution['conversation_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class MessageInstance(InstanceResource): - - class OrderType(object): - ASC = "asc" - DESC = "desc" + return '' - class WebhookEnabledType(object): - TRUE = "true" - FALSE = "false" - def __init__(self, version, payload, conversation_sid, sid=None): - """ - Initialize the MessageInstance - :returns: twilio.rest.conversations.v1.conversation.message.MessageInstance - :rtype: twilio.rest.conversations.v1.conversation.message.MessageInstance - """ - super(MessageInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'conversation_sid': payload.get('conversation_sid'), - 'sid': payload.get('sid'), - 'index': deserialize.integer(payload.get('index')), - 'author': payload.get('author'), - 'body': payload.get('body'), - 'media': payload.get('media'), - 'attributes': payload.get('attributes'), - 'participant_sid': payload.get('participant_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'delivery': payload.get('delivery'), - 'links': payload.get('links'), +class MessageInstance(InstanceResource): + def __init__(self, version, payload, conversation_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'conversation_sid' : payload.get('conversation_sid'), + 'sid' : payload.get('sid'), + 'index' : payload.get('index'), + 'author' : payload.get('author'), + 'body' : payload.get('body'), + 'media' : payload.get('media'), + 'attributes' : payload.get('attributes'), + 'participant_sid' : payload.get('participant_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'delivery' : payload.get('delivery'), + 'links' : payload.get('links'), + 'content_sid' : payload.get('content_sid'), } - # Context self._context = None - self._solution = {'conversation_sid': conversation_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'conversation_sid': conversation_sid or self._properties['conversation_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MessageContext for this MessageInstance - :rtype: twilio.rest.conversations.v1.conversation.message.MessageContext - """ if self._context is None: self._context = MessageContext( self._version, - conversation_sid=self._solution['conversation_sid'], - sid=self._solution['sid'], + conversation_sid=self._solution['conversation_sid'],sid=self._solution['sid'], ) return self._context @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this message. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def conversation_sid(self): - """ - :returns: The unique ID of the Conversation for this message. - :rtype: unicode - """ - return self._properties['conversation_sid'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def index(self): - """ - :returns: The index of the message within the Conversation. - :rtype: unicode - """ - return self._properties['index'] - - @property - def author(self): - """ - :returns: The channel specific identifier of the message's author. - :rtype: unicode - """ - return self._properties['author'] - - @property - def body(self): - """ - :returns: The content of the message. - :rtype: unicode - """ - return self._properties['body'] - - @property - def media(self): - """ - :returns: An array of objects that describe the Message's media if attached, otherwise, null. - :rtype: list[dict] - """ - return self._properties['media'] - - @property - def attributes(self): - """ - :returns: A string metadata field you can use to store any data you wish. - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def participant_sid(self): - """ - :returns: The unique ID of messages's author participant. - :rtype: unicode - """ - return self._properties['participant_sid'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: An absolute API URL for this message. - :rtype: unicode - """ - return self._properties['url'] - - @property - def delivery(self): - """ - :returns: An object that contains the summary of delivery statuses for the message to non-chat participants. - :rtype: dict - """ - return self._properties['delivery'] + def delivery_receipts(self): + return self._proxy.delivery_receipts + - @property - def links(self): - """ - :returns: Absolute URL to access the receipts of this message. - :rtype: unicode + def __repr__(self): """ - return self._properties['links'] - - def update(self, author=values.unset, body=values.unset, - date_created=values.unset, date_updated=values.unset, - attributes=values.unset, x_twilio_webhook_enabled=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the MessageInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode author: The channel specific identifier of the message's author. - :param unicode body: The content of the message. - :param datetime date_created: The date that this resource was created. - :param datetime date_updated: The date that this resource was last updated. - :param unicode attributes: A string metadata field you can use to store any data you wish. - :param MessageInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - :returns: The updated MessageInstance - :rtype: twilio.rest.conversations.v1.conversation.message.MessageInstance - """ - return self._proxy.update( - author=author, - body=body, - date_created=date_created, - date_updated=date_updated, - attributes=attributes, - x_twilio_webhook_enabled=x_twilio_webhook_enabled, - ) - - def delete(self, x_twilio_webhook_enabled=values.unset): - """ - Deletes the MessageInstance - :param MessageInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header +class MessageListInstance(ListResource): + def __init__(self, version: Version, conversation_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete(x_twilio_webhook_enabled=x_twilio_webhook_enabled, ) + # Path Solution + self._solution = { 'conversation_sid': conversation_sid, } + self._uri = '/Conversations/${conversation_sid}/Messages' + + + """ + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - def fetch(self): - """ - Fetch the MessageInstance + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: The fetched MessageInstance - :rtype: twilio.rest.conversations.v1.conversation.message.MessageInstance - """ - return self._proxy.fetch() + return MessageInstance(self._version, payload, conversation_sid=self._solution['conversation_sid']) + + """ + + """ + def page(self, order, page_size): + + data = values.of({ + 'order': order,'page_size': page_size, + }) - @property - def delivery_receipts(self): - """ - Access the delivery_receipts + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptList - :rtype: twilio.rest.conversations.v1.conversation.message.delivery_receipt.DeliveryReceiptList - """ - return self._proxy.delivery_receipts + return MessagePage(self._version, payload, conversation_sid=self._solution['conversation_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/service.py b/twilio/rest/conversations/v1/service.py deleted file mode 100644 index 40662e86f6..0000000000 --- a/twilio/rest/conversations/v1/service.py +++ /dev/null @@ -1,183 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Conversations - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.service.binding import BindingListInstancefrom twilio.rest.service.configuration import ConfigurationListInstancefrom twilio.rest.service.conversation import ConversationListInstancefrom twilio.rest.service.participant_conversation import ParticipantConversationListInstancefrom twilio.rest.service.role import RoleListInstancefrom twilio.rest.service.user import UserListInstance - - -class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Services/${sid}' - - self._bindings = None - self._configuration = None - self._conversations = None - self._participant_conversations = None - self._roles = None - self._users = None - - def delete(self): - - - - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'sid' : payload.get('sid'), - 'friendly_name' : payload.get('friendly_name'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ServiceContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def bindings(self): - return self._proxy.bindings - @property - def configuration(self): - return self._proxy.configuration - @property - def conversations(self): - return self._proxy.conversations - @property - def participant_conversations(self): - return self._proxy.participant_conversations - @property - def roles(self): - return self._proxy.roles - @property - def users(self): - return self._proxy.users - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ServiceListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Services' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ServicePage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/conversations/v1/service/__init__.py b/twilio/rest/conversations/v1/service/__init__.py index c03c5df151..40662e86f6 100644 --- a/twilio/rest/conversations/v1/service/__init__.py +++ b/twilio/rest/conversations/v1/service/__init__.py @@ -1,231 +1,51 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.conversations.v1.service.binding import BindingList -from twilio.rest.conversations.v1.service.configuration import ConfigurationList -from twilio.rest.conversations.v1.service.conversation import ConversationList -from twilio.rest.conversations.v1.service.participant_conversation import ParticipantConversationList -from twilio.rest.conversations.v1.service.role import RoleList -from twilio.rest.conversations.v1.service.user import UserList - - -class ServiceList(ListResource): - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.conversations.v1.service.ServiceList - :rtype: twilio.rest.conversations.v1.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def create(self, friendly_name): - """ - Create the ServiceInstance - - :param unicode friendly_name: The human-readable name of this service. - - :returns: The created ServiceInstance - :rtype: twilio.rest.conversations.v1.service.ServiceInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.conversations.v1.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.conversations.v1.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.conversations.v1.service.ServicePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.conversations.v1.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.ServiceContext - :rtype: twilio.rest.conversations.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.ServiceContext - :rtype: twilio.rest.conversations.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ServicePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.conversations.v1.service.ServicePage - :rtype: twilio.rest.conversations.v1.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.conversations.v1.service.ServiceInstance - :rtype: twilio.rest.conversations.v1.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) +from twilio.base.version import Version - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.service.binding import BindingListInstancefrom twilio.rest.service.configuration import ConfigurationListInstancefrom twilio.rest.service.conversation import ConversationListInstancefrom twilio.rest.service.participant_conversation import ParticipantConversationListInstancefrom twilio.rest.service.role import RoleListInstancefrom twilio.rest.service.user import UserListInstance class ServiceContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.ServiceContext - :rtype: twilio.rest.conversations.v1.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents - self._conversations = None + self._solution = { 'sid': sid, } + self._uri = '/Services/${sid}' + self._bindings = None - self._users = None - self._roles = None self._configuration = None + self._conversations = None self._participant_conversations = None - + self._roles = None + self._users = None + def delete(self): + + + """ Deletes the ServiceInstance @@ -233,283 +53,131 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - + def fetch(self): + """ Fetch the ServiceInstance :returns: The fetched ServiceInstance - :rtype: twilio.rest.conversations.v1.service.ServiceInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + - @property - def conversations(self): - """ - Access the conversations - - :returns: twilio.rest.conversations.v1.service.conversation.ConversationList - :rtype: twilio.rest.conversations.v1.service.conversation.ConversationList - """ - if self._conversations is None: - self._conversations = ConversationList(self._version, chat_service_sid=self._solution['sid'], ) - return self._conversations - - @property - def bindings(self): - """ - Access the bindings - - :returns: twilio.rest.conversations.v1.service.binding.BindingList - :rtype: twilio.rest.conversations.v1.service.binding.BindingList - """ - if self._bindings is None: - self._bindings = BindingList(self._version, chat_service_sid=self._solution['sid'], ) - return self._bindings - - @property - def users(self): - """ - Access the users - - :returns: twilio.rest.conversations.v1.service.user.UserList - :rtype: twilio.rest.conversations.v1.service.user.UserList - """ - if self._users is None: - self._users = UserList(self._version, chat_service_sid=self._solution['sid'], ) - return self._users - - @property - def roles(self): - """ - Access the roles - - :returns: twilio.rest.conversations.v1.service.role.RoleList - :rtype: twilio.rest.conversations.v1.service.role.RoleList - """ - if self._roles is None: - self._roles = RoleList(self._version, chat_service_sid=self._solution['sid'], ) - return self._roles - - @property - def configuration(self): - """ - Access the configuration - - :returns: twilio.rest.conversations.v1.service.configuration.ConfigurationList - :rtype: twilio.rest.conversations.v1.service.configuration.ConfigurationList - """ - if self._configuration is None: - self._configuration = ConfigurationList(self._version, chat_service_sid=self._solution['sid'], ) - return self._configuration - - @property - def participant_conversations(self): - """ - Access the participant_conversations - - :returns: twilio.rest.conversations.v1.service.participant_conversation.ParticipantConversationList - :rtype: twilio.rest.conversations.v1.service.participant_conversation.ParticipantConversationList - """ - if self._participant_conversations is None: - self._participant_conversations = ParticipantConversationList( - self._version, - chat_service_sid=self._solution['sid'], - ) - return self._participant_conversations + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ServiceInstance(InstanceResource): - - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - :returns: twilio.rest.conversations.v1.service.ServiceInstance - :rtype: twilio.rest.conversations.v1.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'sid': payload.get('sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'sid' : payload.get('sid'), + 'friendly_name' : payload.get('friendly_name'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.conversations.v1.service.ServiceContext - """ if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this service. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def friendly_name(self): - """ - :returns: The human-readable name of this service. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: An absolute URL for this service. - :rtype: unicode - """ - return self._properties['url'] - + def bindings(self): + return self._proxy.bindings @property - def links(self): - """ - :returns: Absolute URLs to access the conversations, users, roles, bindings and configuration of this service. - :rtype: unicode - """ - return self._properties['links'] - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - :rtype: twilio.rest.conversations.v1.service.ServiceInstance - """ - return self._proxy.fetch() - + def configuration(self): + return self._proxy.configuration @property def conversations(self): - """ - Access the conversations - - :returns: twilio.rest.conversations.v1.service.conversation.ConversationList - :rtype: twilio.rest.conversations.v1.service.conversation.ConversationList - """ return self._proxy.conversations - @property - def bindings(self): - """ - Access the bindings - - :returns: twilio.rest.conversations.v1.service.binding.BindingList - :rtype: twilio.rest.conversations.v1.service.binding.BindingList - """ - return self._proxy.bindings - + def participant_conversations(self): + return self._proxy.participant_conversations + @property + def roles(self): + return self._proxy.roles @property def users(self): - """ - Access the users - - :returns: twilio.rest.conversations.v1.service.user.UserList - :rtype: twilio.rest.conversations.v1.service.user.UserList - """ return self._proxy.users + - @property - def roles(self): + def __repr__(self): """ - Access the roles - - :returns: twilio.rest.conversations.v1.service.role.RoleList - :rtype: twilio.rest.conversations.v1.service.role.RoleList + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.roles + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def configuration(self): - """ - Access the configuration - :returns: twilio.rest.conversations.v1.service.configuration.ConfigurationList - :rtype: twilio.rest.conversations.v1.service.configuration.ConfigurationList - """ - return self._proxy.configuration - @property - def participant_conversations(self): - """ - Access the participant_conversations +class ServiceListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.conversations.v1.service.participant_conversation.ParticipantConversationList - :rtype: twilio.rest.conversations.v1.service.participant_conversation.ParticipantConversationList - """ - return self._proxy.participant_conversations + # Path Solution + self._solution = { } + self._uri = '/Services' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return ServiceInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ServicePage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/service/configuration.py b/twilio/rest/conversations/v1/service/configuration.py deleted file mode 100644 index 95d06fae82..0000000000 --- a/twilio/rest/conversations/v1/service/configuration.py +++ /dev/null @@ -1,136 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Conversations - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.rest.configuration.notification import NotificationListInstancefrom twilio.rest.configuration.webhook import WebhookListInstance - - -class ConfigurationContext(InstanceContext): - def __init__(self, version: Version, chat_service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'chat_service_sid': chat_service_sid, } - self._uri = '/Services/${chat_service_sid}/Configuration' - - - def fetch(self): - - """ - Fetch the ConfigurationInstance - - :returns: The fetched ConfigurationInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ConfigurationInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ConfigurationInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ConfigurationInstance(InstanceResource): - def __init__(self, version, payload, chat_service_sid: str): - super().__init__(version) - self._properties = { - 'chat_service_sid' : payload.get('chat_service_sid'), - 'default_conversation_creator_role_sid' : payload.get('default_conversation_creator_role_sid'), - 'default_conversation_role_sid' : payload.get('default_conversation_role_sid'), - 'default_chat_service_role_sid' : payload.get('default_chat_service_role_sid'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - 'reachability_enabled' : payload.get('reachability_enabled'), - } - - self._context = None - self._solution = { - 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ConfigurationContext( - self._version, - chat_service_sid=self._solution['chat_service_sid'], - ) - return self._context - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ConfigurationListInstance(ListResource): - def __init__(self, version: Version, chat_service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'chat_service_sid': chat_service_sid, } - self._uri = '' - - self._notifications = None - self._webhooks = None - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/conversations/v1/service/configuration/__init__.py b/twilio/rest/conversations/v1/service/configuration/__init__.py index f82dc36dc2..95d06fae82 100644 --- a/twilio/rest/conversations/v1/service/configuration/__init__.py +++ b/twilio/rest/conversations/v1/service/configuration/__init__.py @@ -1,248 +1,98 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Conversations + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.conversations.v1.service.configuration.notification import NotificationList -from twilio.rest.conversations.v1.service.configuration.webhook import WebhookList - - -class ConfigurationList(ListResource): - - def __init__(self, version, chat_service_sid): - """ - Initialize the ConfigurationList - - :param Version version: Version that contains the resource - :param chat_service_sid: The unique string that identifies the resource - - :returns: twilio.rest.conversations.v1.service.configuration.ConfigurationList - :rtype: twilio.rest.conversations.v1.service.configuration.ConfigurationList - """ - super(ConfigurationList, self).__init__(version) - - # Path Solution - self._solution = {'chat_service_sid': chat_service_sid, } - - # Components - self._notifications = None - self._webhooks = None - - @property - def notifications(self): - """ - Access the notifications - - :returns: twilio.rest.conversations.v1.service.configuration.notification.NotificationList - :rtype: twilio.rest.conversations.v1.service.configuration.notification.NotificationList - """ - if self._notifications is None: - self._notifications = NotificationList( - self._version, - chat_service_sid=self._solution['chat_service_sid'], - ) - return self._notifications - - @property - def webhooks(self): - """ - Access the webhooks - - :returns: twilio.rest.conversations.v1.service.configuration.webhook.WebhookList - :rtype: twilio.rest.conversations.v1.service.configuration.webhook.WebhookList - """ - if self._webhooks is None: - self._webhooks = WebhookList(self._version, chat_service_sid=self._solution['chat_service_sid'], ) - return self._webhooks - - def get(self): - """ - Constructs a ConfigurationContext - - :returns: twilio.rest.conversations.v1.service.configuration.ConfigurationContext - :rtype: twilio.rest.conversations.v1.service.configuration.ConfigurationContext - """ - return ConfigurationContext(self._version, chat_service_sid=self._solution['chat_service_sid'], ) +from twilio.base.version import Version - def __call__(self): - """ - Constructs a ConfigurationContext - - :returns: twilio.rest.conversations.v1.service.configuration.ConfigurationContext - :rtype: twilio.rest.conversations.v1.service.configuration.ConfigurationContext - """ - return ConfigurationContext(self._version, chat_service_sid=self._solution['chat_service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ConfigurationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ConfigurationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param chat_service_sid: The unique string that identifies the resource - - :returns: twilio.rest.conversations.v1.service.configuration.ConfigurationPage - :rtype: twilio.rest.conversations.v1.service.configuration.ConfigurationPage - """ - super(ConfigurationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ConfigurationInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.conversations.v1.service.configuration.ConfigurationInstance - :rtype: twilio.rest.conversations.v1.service.configuration.ConfigurationInstance - """ - return ConfigurationInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.configuration.notification import NotificationListInstancefrom twilio.rest.configuration.webhook import WebhookListInstance class ConfigurationContext(InstanceContext): - - def __init__(self, version, chat_service_sid): - """ - Initialize the ConfigurationContext - - :param Version version: Version that contains the resource - :param chat_service_sid: The SID of the Service configuration resource to fetch - - :returns: twilio.rest.conversations.v1.service.configuration.ConfigurationContext - :rtype: twilio.rest.conversations.v1.service.configuration.ConfigurationContext - """ - super(ConfigurationContext, self).__init__(version) + def __init__(self, version: Version, chat_service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'chat_service_sid': chat_service_sid, } - self._uri = '/Services/{chat_service_sid}/Configuration'.format(**self._solution) - + self._solution = { 'chat_service_sid': chat_service_sid, } + self._uri = '/Services/${chat_service_sid}/Configuration' + + def fetch(self): + """ Fetch the ConfigurationInstance :returns: The fetched ConfigurationInstance - :rtype: twilio.rest.conversations.v1.service.configuration.ConfigurationInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return ConfigurationInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - ) - - def update(self, default_conversation_creator_role_sid=values.unset, - default_conversation_role_sid=values.unset, - default_chat_service_role_sid=values.unset, - reachability_enabled=values.unset): - """ - Update the ConfigurationInstance - - :param unicode default_conversation_creator_role_sid: The role assigned to a conversation creator when they join a new conversation - :param unicode default_conversation_role_sid: The role assigned to users when they are added to a conversation - :param unicode default_chat_service_role_sid: The service role assigned to users when they are added to the service - :param bool reachability_enabled: Whether the Reachability Indicator feature is enabled for this Conversations Service + return ConfigurationInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], ) + - :returns: The updated ConfigurationInstance - :rtype: twilio.rest.conversations.v1.service.configuration.ConfigurationInstance - """ + + + def update(self, body): data = values.of({ - 'DefaultConversationCreatorRoleSid': default_conversation_creator_role_sid, - 'DefaultConversationRoleSid': default_conversation_role_sid, - 'DefaultChatServiceRoleSid': default_chat_service_role_sid, - 'ReachabilityEnabled': reachability_enabled, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return ConfigurationInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], ) + + - return ConfigurationInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - ) + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ConfigurationInstance(InstanceResource): - - def __init__(self, version, payload, chat_service_sid): - """ - Initialize the ConfigurationInstance - :returns: twilio.rest.conversations.v1.service.configuration.ConfigurationInstance - :rtype: twilio.rest.conversations.v1.service.configuration.ConfigurationInstance - """ - super(ConfigurationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'chat_service_sid': payload.get('chat_service_sid'), - 'default_conversation_creator_role_sid': payload.get('default_conversation_creator_role_sid'), - 'default_conversation_role_sid': payload.get('default_conversation_role_sid'), - 'default_chat_service_role_sid': payload.get('default_chat_service_role_sid'), - 'url': payload.get('url'), - 'links': payload.get('links'), - 'reachability_enabled': payload.get('reachability_enabled'), +class ConfigurationInstance(InstanceResource): + def __init__(self, version, payload, chat_service_sid: str): + super().__init__(version) + self._properties = { + 'chat_service_sid' : payload.get('chat_service_sid'), + 'default_conversation_creator_role_sid' : payload.get('default_conversation_creator_role_sid'), + 'default_conversation_role_sid' : payload.get('default_conversation_role_sid'), + 'default_chat_service_role_sid' : payload.get('default_chat_service_role_sid'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), + 'reachability_enabled' : payload.get('reachability_enabled'), } - # Context self._context = None - self._solution = {'chat_service_sid': chat_service_sid, } + self._solution = { + 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ConfigurationContext for this ConfigurationInstance - :rtype: twilio.rest.conversations.v1.service.configuration.ConfigurationContext - """ if self._context is None: self._context = ConfigurationContext( self._version, @@ -250,99 +100,37 @@ def _proxy(self): ) return self._context - @property - def chat_service_sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['chat_service_sid'] - - @property - def default_conversation_creator_role_sid(self): - """ - :returns: The role assigned to a conversation creator user when they join a new conversation - :rtype: unicode - """ - return self._properties['default_conversation_creator_role_sid'] - - @property - def default_conversation_role_sid(self): - """ - :returns: The role assigned to users when they are added to a conversation - :rtype: unicode - """ - return self._properties['default_conversation_role_sid'] - - @property - def default_chat_service_role_sid(self): - """ - :returns: The service role assigned to users when they are added to the service - :rtype: unicode - """ - return self._properties['default_chat_service_role_sid'] - - @property - def url(self): - """ - :returns: An absolute URL for this service configuration. - :rtype: unicode - """ - return self._properties['url'] + - @property - def links(self): - """ - :returns: Absolute URL to access the push notifications configuration of this service. - :rtype: unicode - """ - return self._properties['links'] - - @property - def reachability_enabled(self): - """ - :returns: Whether the Reachability Indicator feature is enabled for this Conversations Service - :rtype: bool + def __repr__(self): """ - return self._properties['reachability_enabled'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the ConfigurationInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched ConfigurationInstance - :rtype: twilio.rest.conversations.v1.service.configuration.ConfigurationInstance - """ - return self._proxy.fetch() - def update(self, default_conversation_creator_role_sid=values.unset, - default_conversation_role_sid=values.unset, - default_chat_service_role_sid=values.unset, - reachability_enabled=values.unset): - """ - Update the ConfigurationInstance - :param unicode default_conversation_creator_role_sid: The role assigned to a conversation creator when they join a new conversation - :param unicode default_conversation_role_sid: The role assigned to users when they are added to a conversation - :param unicode default_chat_service_role_sid: The service role assigned to users when they are added to the service - :param bool reachability_enabled: Whether the Reachability Indicator feature is enabled for this Conversations Service +class ConfigurationListInstance(ListResource): + def __init__(self, version: Version, chat_service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The updated ConfigurationInstance - :rtype: twilio.rest.conversations.v1.service.configuration.ConfigurationInstance - """ - return self._proxy.update( - default_conversation_creator_role_sid=default_conversation_creator_role_sid, - default_conversation_role_sid=default_conversation_role_sid, - default_chat_service_role_sid=default_chat_service_role_sid, - reachability_enabled=reachability_enabled, - ) + # Path Solution + self._solution = { 'chat_service_sid': chat_service_sid, } + self._uri = '' + + self._notifications = None + self._webhooks = None + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/service/conversation.py b/twilio/rest/conversations/v1/service/conversation.py deleted file mode 100644 index de2120bbb2..0000000000 --- a/twilio/rest/conversations/v1/service/conversation.py +++ /dev/null @@ -1,191 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Conversations - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.conversation.message import MessageListInstancefrom twilio.rest.conversation.participant import ParticipantListInstancefrom twilio.rest.conversation.webhook import WebhookListInstance - - -class ConversationContext(InstanceContext): - def __init__(self, version: Version, chat_service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'chat_service_sid': chat_service_sid, 'sid': sid, } - self._uri = '/Services/${chat_service_sid}/Conversations/${sid}' - - self._messages = None - self._participants = None - self._webhooks = None - - def delete(self, x_twilio_webhook_enabled): - - - - """ - Deletes the ConversationInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ConversationInstance - - :returns: The fetched ConversationInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ConversationInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], sid=self._solution['sid'], ) - - - - - def update(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ConversationInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ConversationInstance(InstanceResource): - def __init__(self, version, payload, chat_service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'chat_service_sid' : payload.get('chat_service_sid'), - 'messaging_service_sid' : payload.get('messaging_service_sid'), - 'sid' : payload.get('sid'), - 'friendly_name' : payload.get('friendly_name'), - 'unique_name' : payload.get('unique_name'), - 'attributes' : payload.get('attributes'), - 'state' : payload.get('state'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'timers' : payload.get('timers'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - 'bindings' : payload.get('bindings'), - } - - self._context = None - self._solution = { - 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ConversationContext( - self._version, - chat_service_sid=self._solution['chat_service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def messages(self): - return self._proxy.messages - @property - def participants(self): - return self._proxy.participants - @property - def webhooks(self): - return self._proxy.webhooks - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ConversationListInstance(ListResource): - def __init__(self, version: Version, chat_service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'chat_service_sid': chat_service_sid, } - self._uri = '/Services/${chat_service_sid}/Conversations' - - - """ - def create(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ConversationInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ConversationPage(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/conversations/v1/service/conversation/__init__.py b/twilio/rest/conversations/v1/service/conversation/__init__.py index 07c34b4a0f..de2120bbb2 100644 --- a/twilio/rest/conversations/v1/service/conversation/__init__.py +++ b/twilio/rest/conversations/v1/service/conversation/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,651 +19,173 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.conversations.v1.service.conversation.message import MessageList -from twilio.rest.conversations.v1.service.conversation.participant import ParticipantList -from twilio.rest.conversations.v1.service.conversation.webhook import WebhookList - - -class ConversationList(ListResource): - - def __init__(self, version, chat_service_sid): - """ - Initialize the ConversationList - - :param Version version: Version that contains the resource - :param chat_service_sid: The unique ID of the Conversation Service this conversation belongs to. - - :returns: twilio.rest.conversations.v1.service.conversation.ConversationList - :rtype: twilio.rest.conversations.v1.service.conversation.ConversationList - """ - super(ConversationList, self).__init__(version) - - # Path Solution - self._solution = {'chat_service_sid': chat_service_sid, } - self._uri = '/Services/{chat_service_sid}/Conversations'.format(**self._solution) - - def create(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset, messaging_service_sid=values.unset, - date_created=values.unset, date_updated=values.unset, - state=values.unset, timers_inactive=values.unset, - timers_closed=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Create the ConversationInstance - - :param unicode friendly_name: The human-readable name of this conversation. - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode attributes: An optional string metadata field you can use to store any data you wish. - :param unicode messaging_service_sid: The unique ID of the Messaging Service this conversation belongs to. - :param datetime date_created: The date that this resource was created. - :param datetime date_updated: The date that this resource was last updated. - :param ConversationInstance.State state: Current state of this conversation. - :param unicode timers_inactive: ISO8601 duration when conversation will be switched to `inactive` state. - :param unicode timers_closed: ISO8601 duration when conversation will be switched to `closed` state. - :param ConversationInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The created ConversationInstance - :rtype: twilio.rest.conversations.v1.service.conversation.ConversationInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Attributes': attributes, - 'MessagingServiceSid': messaging_service_sid, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'State': state, - 'Timers.Inactive': timers_inactive, - 'Timers.Closed': timers_closed, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, headers=headers, ) - - return ConversationInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - ) - - def stream(self, limit=None, page_size=None): - """ - Streams ConversationInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.conversations.v1.service.conversation.ConversationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ConversationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.conversations.v1.service.conversation.ConversationInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ConversationInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ConversationInstance - :rtype: twilio.rest.conversations.v1.service.conversation.ConversationPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ConversationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ConversationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ConversationInstance - :rtype: twilio.rest.conversations.v1.service.conversation.ConversationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ConversationPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ConversationContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.conversation.ConversationContext - :rtype: twilio.rest.conversations.v1.service.conversation.ConversationContext - """ - return ConversationContext( - self._version, - chat_service_sid=self._solution['chat_service_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a ConversationContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.conversation.ConversationContext - :rtype: twilio.rest.conversations.v1.service.conversation.ConversationContext - """ - return ConversationContext( - self._version, - chat_service_sid=self._solution['chat_service_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ConversationPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ConversationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param chat_service_sid: The unique ID of the Conversation Service this conversation belongs to. - - :returns: twilio.rest.conversations.v1.service.conversation.ConversationPage - :rtype: twilio.rest.conversations.v1.service.conversation.ConversationPage - """ - super(ConversationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ConversationInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.conversations.v1.service.conversation.ConversationInstance - :rtype: twilio.rest.conversations.v1.service.conversation.ConversationInstance - """ - return ConversationInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - ) +from twilio.base.version import Version - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.conversation.message import MessageListInstancefrom twilio.rest.conversation.participant import ParticipantListInstancefrom twilio.rest.conversation.webhook import WebhookListInstance class ConversationContext(InstanceContext): - - def __init__(self, version, chat_service_sid, sid): - """ - Initialize the ConversationContext - - :param Version version: Version that contains the resource - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with. - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.conversation.ConversationContext - :rtype: twilio.rest.conversations.v1.service.conversation.ConversationContext - """ - super(ConversationContext, self).__init__(version) + def __init__(self, version: Version, chat_service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'chat_service_sid': chat_service_sid, 'sid': sid, } - self._uri = '/Services/{chat_service_sid}/Conversations/{sid}'.format(**self._solution) - - # Dependents - self._participants = None + self._solution = { 'chat_service_sid': chat_service_sid, 'sid': sid, } + self._uri = '/Services/${chat_service_sid}/Conversations/${sid}' + self._messages = None + self._participants = None self._webhooks = None + + def delete(self, x_twilio_webhook_enabled): + + - def update(self, friendly_name=values.unset, date_created=values.unset, - date_updated=values.unset, attributes=values.unset, - messaging_service_sid=values.unset, state=values.unset, - timers_inactive=values.unset, timers_closed=values.unset, - unique_name=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Update the ConversationInstance - - :param unicode friendly_name: The human-readable name of this conversation. - :param datetime date_created: The date that this resource was created. - :param datetime date_updated: The date that this resource was last updated. - :param unicode attributes: An optional string metadata field you can use to store any data you wish. - :param unicode messaging_service_sid: The unique ID of the Messaging Service this conversation belongs to. - :param ConversationInstance.State state: Current state of this conversation. - :param unicode timers_inactive: ISO8601 duration when conversation will be switched to `inactive` state. - :param unicode timers_closed: ISO8601 duration when conversation will be switched to `closed` state. - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param ConversationInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated ConversationInstance - :rtype: twilio.rest.conversations.v1.service.conversation.ConversationInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'Attributes': attributes, - 'MessagingServiceSid': messaging_service_sid, - 'State': state, - 'Timers.Inactive': timers_inactive, - 'Timers.Closed': timers_closed, - 'UniqueName': unique_name, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) - - return ConversationInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - sid=self._solution['sid'], - ) - - def delete(self, x_twilio_webhook_enabled=values.unset): """ Deletes the ConversationInstance - :param ConversationInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - :returns: True if delete succeeds, False otherwise :rtype: bool """ - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the ConversationInstance :returns: The fetched ConversationInstance - :rtype: twilio.rest.conversations.v1.service.conversation.ConversationInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return ConversationInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - sid=self._solution['sid'], - ) - - @property - def participants(self): - """ - Access the participants + return ConversationInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], sid=self._solution['sid'], ) + - :returns: twilio.rest.conversations.v1.service.conversation.participant.ParticipantList - :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantList - """ - if self._participants is None: - self._participants = ParticipantList( - self._version, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['sid'], - ) - return self._participants + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - @property - def messages(self): - """ - Access the messages + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.conversations.v1.service.conversation.message.MessageList - :rtype: twilio.rest.conversations.v1.service.conversation.message.MessageList - """ - if self._messages is None: - self._messages = MessageList( - self._version, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['sid'], - ) - return self._messages + return ConversationInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], sid=self._solution['sid'], ) + + - @property - def webhooks(self): - """ - Access the webhooks - - :returns: twilio.rest.conversations.v1.service.conversation.webhook.WebhookList - :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookList - """ - if self._webhooks is None: - self._webhooks = WebhookList( - self._version, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['sid'], - ) - return self._webhooks + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ConversationInstance(InstanceResource): - - class WebhookEnabledType(object): - TRUE = "true" - FALSE = "false" - class State(object): - INACTIVE = "inactive" - ACTIVE = "active" - CLOSED = "closed" - - def __init__(self, version, payload, chat_service_sid, sid=None): - """ - Initialize the ConversationInstance - - :returns: twilio.rest.conversations.v1.service.conversation.ConversationInstance - :rtype: twilio.rest.conversations.v1.service.conversation.ConversationInstance - """ - super(ConversationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'chat_service_sid': payload.get('chat_service_sid'), - 'messaging_service_sid': payload.get('messaging_service_sid'), - 'sid': payload.get('sid'), - 'friendly_name': payload.get('friendly_name'), - 'unique_name': payload.get('unique_name'), - 'attributes': payload.get('attributes'), - 'state': payload.get('state'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'timers': payload.get('timers'), - 'url': payload.get('url'), - 'links': payload.get('links'), - 'bindings': payload.get('bindings'), +class ConversationInstance(InstanceResource): + def __init__(self, version, payload, chat_service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'chat_service_sid' : payload.get('chat_service_sid'), + 'messaging_service_sid' : payload.get('messaging_service_sid'), + 'sid' : payload.get('sid'), + 'friendly_name' : payload.get('friendly_name'), + 'unique_name' : payload.get('unique_name'), + 'attributes' : payload.get('attributes'), + 'state' : payload.get('state'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'timers' : payload.get('timers'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), + 'bindings' : payload.get('bindings'), } - # Context self._context = None - self._solution = {'chat_service_sid': chat_service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ConversationContext for this ConversationInstance - :rtype: twilio.rest.conversations.v1.service.conversation.ConversationContext - """ if self._context is None: self._context = ConversationContext( self._version, - chat_service_sid=self._solution['chat_service_sid'], - sid=self._solution['sid'], + chat_service_sid=self._solution['chat_service_sid'],sid=self._solution['sid'], ) return self._context @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this conversation. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def chat_service_sid(self): - """ - :returns: The unique ID of the Conversation Service this conversation belongs to. - :rtype: unicode - """ - return self._properties['chat_service_sid'] - - @property - def messaging_service_sid(self): - """ - :returns: The unique ID of the Messaging Service this conversation belongs to. - :rtype: unicode - """ - return self._properties['messaging_service_sid'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def friendly_name(self): - """ - :returns: The human-readable name of this conversation. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def attributes(self): - """ - :returns: An optional string metadata field you can use to store any data you wish. - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def state(self): - """ - :returns: Current state of this conversation. - :rtype: ConversationInstance.State - """ - return self._properties['state'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def timers(self): - """ - :returns: Timer date values for this conversation. - :rtype: dict - """ - return self._properties['timers'] - + def messages(self): + return self._proxy.messages @property - def url(self): - """ - :returns: An absolute URL for this conversation. - :rtype: unicode - """ - return self._properties['url'] - + def participants(self): + return self._proxy.participants @property - def links(self): - """ - :returns: Absolute URLs to access the participants, messages and webhooks of this conversation. - :rtype: unicode - """ - return self._properties['links'] + def webhooks(self): + return self._proxy.webhooks + - @property - def bindings(self): + def __repr__(self): """ - :returns: The bindings - :rtype: dict + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['bindings'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def update(self, friendly_name=values.unset, date_created=values.unset, - date_updated=values.unset, attributes=values.unset, - messaging_service_sid=values.unset, state=values.unset, - timers_inactive=values.unset, timers_closed=values.unset, - unique_name=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Update the ConversationInstance - - :param unicode friendly_name: The human-readable name of this conversation. - :param datetime date_created: The date that this resource was created. - :param datetime date_updated: The date that this resource was last updated. - :param unicode attributes: An optional string metadata field you can use to store any data you wish. - :param unicode messaging_service_sid: The unique ID of the Messaging Service this conversation belongs to. - :param ConversationInstance.State state: Current state of this conversation. - :param unicode timers_inactive: ISO8601 duration when conversation will be switched to `inactive` state. - :param unicode timers_closed: ISO8601 duration when conversation will be switched to `closed` state. - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param ConversationInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated ConversationInstance - :rtype: twilio.rest.conversations.v1.service.conversation.ConversationInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - date_created=date_created, - date_updated=date_updated, - attributes=attributes, - messaging_service_sid=messaging_service_sid, - state=state, - timers_inactive=timers_inactive, - timers_closed=timers_closed, - unique_name=unique_name, - x_twilio_webhook_enabled=x_twilio_webhook_enabled, - ) - - def delete(self, x_twilio_webhook_enabled=values.unset): - """ - Deletes the ConversationInstance - :param ConversationInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete(x_twilio_webhook_enabled=x_twilio_webhook_enabled, ) +class ConversationListInstance(ListResource): + def __init__(self, version: Version, chat_service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - def fetch(self): - """ - Fetch the ConversationInstance - - :returns: The fetched ConversationInstance - :rtype: twilio.rest.conversations.v1.service.conversation.ConversationInstance - """ - return self._proxy.fetch() - - @property - def participants(self): - """ - Access the participants - - :returns: twilio.rest.conversations.v1.service.conversation.participant.ParticipantList - :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantList - """ - return self._proxy.participants + # Path Solution + self._solution = { 'chat_service_sid': chat_service_sid, } + self._uri = '/Services/${chat_service_sid}/Conversations' + + + """ + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - @property - def messages(self): - """ - Access the messages + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.conversations.v1.service.conversation.message.MessageList - :rtype: twilio.rest.conversations.v1.service.conversation.message.MessageList - """ - return self._proxy.messages + return ConversationInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def webhooks(self): - """ - Access the webhooks + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.conversations.v1.service.conversation.webhook.WebhookList - :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookList - """ - return self._proxy.webhooks + return ConversationPage(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/service/conversation/message.py b/twilio/rest/conversations/v1/service/conversation/message.py deleted file mode 100644 index 4c812a981d..0000000000 --- a/twilio/rest/conversations/v1/service/conversation/message.py +++ /dev/null @@ -1,185 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Conversations - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.message.delivery_receipt import DeliveryReceiptListInstance - - -class MessageContext(InstanceContext): - def __init__(self, version: Version, chat_service_sid: str, conversation_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'chat_service_sid': chat_service_sid, 'conversation_sid': conversation_sid, 'sid': sid, } - self._uri = '/Services/${chat_service_sid}/Conversations/${conversation_sid}/Messages/${sid}' - - self._delivery_receipts = None - - def delete(self, x_twilio_webhook_enabled): - - - - """ - Deletes the MessageInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the MessageInstance - - :returns: The fetched MessageInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return MessageInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], conversation_sid=self._solution['conversation_sid'], sid=self._solution['sid'], ) - - - - - def update(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return MessageInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], conversation_sid=self._solution['conversation_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class MessageInstance(InstanceResource): - def __init__(self, version, payload, chat_service_sid: str, conversation_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'chat_service_sid' : payload.get('chat_service_sid'), - 'conversation_sid' : payload.get('conversation_sid'), - 'sid' : payload.get('sid'), - 'index' : payload.get('index'), - 'author' : payload.get('author'), - 'body' : payload.get('body'), - 'media' : payload.get('media'), - 'attributes' : payload.get('attributes'), - 'participant_sid' : payload.get('participant_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'delivery' : payload.get('delivery'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - 'content_sid' : payload.get('content_sid'), - } - - self._context = None - self._solution = { - 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid'],'conversation_sid': conversation_sid or self._properties['conversation_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = MessageContext( - self._version, - chat_service_sid=self._solution['chat_service_sid'],conversation_sid=self._solution['conversation_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def delivery_receipts(self): - return self._proxy.delivery_receipts - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class MessageListInstance(ListResource): - def __init__(self, version: Version, chat_service_sid: str, conversation_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'chat_service_sid': chat_service_sid, 'conversation_sid': conversation_sid, } - self._uri = '/Services/${chat_service_sid}/Conversations/${conversation_sid}/Messages' - - - """ - def create(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return MessageInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid']conversation_sid=self._solution['conversation_sid']) - - """ - - """ - def page(self, order, page_size): - - data = values.of({ - 'order': order,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return MessagePage(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], conversation_sid=self._solution['conversation_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/conversations/v1/service/conversation/message/__init__.py b/twilio/rest/conversations/v1/service/conversation/message/__init__.py index e27b415738..4c812a981d 100644 --- a/twilio/rest/conversations/v1/service/conversation/message/__init__.py +++ b/twilio/rest/conversations/v1/service/conversation/message/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,604 +19,167 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.conversations.v1.service.conversation.message.delivery_receipt import DeliveryReceiptList - - -class MessageList(ListResource): - - def __init__(self, version, chat_service_sid, conversation_sid): - """ - Initialize the MessageList - - :param Version version: Version that contains the resource - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with. - :param conversation_sid: The unique ID of the Conversation for this message. - - :returns: twilio.rest.conversations.v1.service.conversation.message.MessageList - :rtype: twilio.rest.conversations.v1.service.conversation.message.MessageList - """ - super(MessageList, self).__init__(version) - - # Path Solution - self._solution = {'chat_service_sid': chat_service_sid, 'conversation_sid': conversation_sid, } - self._uri = '/Services/{chat_service_sid}/Conversations/{conversation_sid}/Messages'.format(**self._solution) - - def create(self, author=values.unset, body=values.unset, - date_created=values.unset, date_updated=values.unset, - attributes=values.unset, media_sid=values.unset, - x_twilio_webhook_enabled=values.unset): - """ - Create the MessageInstance - - :param unicode author: The channel specific identifier of the message's author. - :param unicode body: The content of the message. - :param datetime date_created: The date that this resource was created. - :param datetime date_updated: The date that this resource was last updated. - :param unicode attributes: A string metadata field you can use to store any data you wish. - :param unicode media_sid: The Media SID to be attached to the new Message. - :param MessageInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The created MessageInstance - :rtype: twilio.rest.conversations.v1.service.conversation.message.MessageInstance - """ - data = values.of({ - 'Author': author, - 'Body': body, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'Attributes': attributes, - 'MediaSid': media_sid, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, headers=headers, ) - - return MessageInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - ) - - def stream(self, order=values.unset, limit=None, page_size=None): - """ - Streams MessageInstance 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 MessageInstance.OrderType order: The sort order of the returned messages - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.conversations.v1.service.conversation.message.MessageInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(order=order, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, order=values.unset, limit=None, page_size=None): - """ - Lists MessageInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param MessageInstance.OrderType order: The sort order of the returned messages - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.conversations.v1.service.conversation.message.MessageInstance] - """ - return list(self.stream(order=order, limit=limit, page_size=page_size, )) - - def page(self, order=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of MessageInstance records from the API. - Request is executed immediately - - :param MessageInstance.OrderType order: The sort order of the returned messages - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MessageInstance - :rtype: twilio.rest.conversations.v1.service.conversation.message.MessagePage - """ - data = values.of({ - 'Order': order, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return MessagePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MessageInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MessageInstance - :rtype: twilio.rest.conversations.v1.service.conversation.message.MessagePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MessagePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MessageContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.conversation.message.MessageContext - :rtype: twilio.rest.conversations.v1.service.conversation.message.MessageContext - """ - return MessageContext( - self._version, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a MessageContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.conversation.message.MessageContext - :rtype: twilio.rest.conversations.v1.service.conversation.message.MessageContext - """ - return MessageContext( - self._version, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - sid=sid, - ) +from twilio.base.version import Version - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class MessagePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the MessagePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with. - :param conversation_sid: The unique ID of the Conversation for this message. - - :returns: twilio.rest.conversations.v1.service.conversation.message.MessagePage - :rtype: twilio.rest.conversations.v1.service.conversation.message.MessagePage - """ - super(MessagePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MessageInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - - :returns: twilio.rest.conversations.v1.service.conversation.message.MessageInstance - :rtype: twilio.rest.conversations.v1.service.conversation.message.MessageInstance - """ - return MessageInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.message.delivery_receipt import DeliveryReceiptListInstance class MessageContext(InstanceContext): - - def __init__(self, version, chat_service_sid, conversation_sid, sid): - """ - Initialize the MessageContext - - :param Version version: Version that contains the resource - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with. - :param conversation_sid: The unique ID of the Conversation for this message. - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.conversations.v1.service.conversation.message.MessageContext - :rtype: twilio.rest.conversations.v1.service.conversation.message.MessageContext - """ - super(MessageContext, self).__init__(version) + def __init__(self, version: Version, chat_service_sid: str, conversation_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = { - 'chat_service_sid': chat_service_sid, - 'conversation_sid': conversation_sid, - 'sid': sid, - } - self._uri = '/Services/{chat_service_sid}/Conversations/{conversation_sid}/Messages/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'chat_service_sid': chat_service_sid, 'conversation_sid': conversation_sid, 'sid': sid, } + self._uri = '/Services/${chat_service_sid}/Conversations/${conversation_sid}/Messages/${sid}' + self._delivery_receipts = None + + def delete(self, x_twilio_webhook_enabled): + + - def update(self, author=values.unset, body=values.unset, - date_created=values.unset, date_updated=values.unset, - attributes=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Update the MessageInstance - - :param unicode author: The channel specific identifier of the message's author. - :param unicode body: The content of the message. - :param datetime date_created: The date that this resource was created. - :param datetime date_updated: The date that this resource was last updated. - :param unicode attributes: A string metadata field you can use to store any data you wish. - :param MessageInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated MessageInstance - :rtype: twilio.rest.conversations.v1.service.conversation.message.MessageInstance - """ - data = values.of({ - 'Author': author, - 'Body': body, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'Attributes': attributes, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) - - return MessageInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - sid=self._solution['sid'], - ) - - def delete(self, x_twilio_webhook_enabled=values.unset): """ Deletes the MessageInstance - :param MessageInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - :returns: True if delete succeeds, False otherwise :rtype: bool """ - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the MessageInstance :returns: The fetched MessageInstance - :rtype: twilio.rest.conversations.v1.service.conversation.message.MessageInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return MessageInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - sid=self._solution['sid'], - ) + return MessageInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], conversation_sid=self._solution['conversation_sid'], sid=self._solution['sid'], ) + - @property - def delivery_receipts(self): - """ - Access the delivery_receipts + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - :returns: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptList - :rtype: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptList - """ - if self._delivery_receipts is None: - self._delivery_receipts = DeliveryReceiptList( - self._version, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - message_sid=self._solution['sid'], - ) - return self._delivery_receipts + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return MessageInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], conversation_sid=self._solution['conversation_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class MessageInstance(InstanceResource): + return '' - class OrderType(object): - ASC = "asc" - DESC = "desc" - class WebhookEnabledType(object): - TRUE = "true" - FALSE = "false" - def __init__(self, version, payload, chat_service_sid, conversation_sid, - sid=None): - """ - Initialize the MessageInstance - - :returns: twilio.rest.conversations.v1.service.conversation.message.MessageInstance - :rtype: twilio.rest.conversations.v1.service.conversation.message.MessageInstance - """ - super(MessageInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'chat_service_sid': payload.get('chat_service_sid'), - 'conversation_sid': payload.get('conversation_sid'), - 'sid': payload.get('sid'), - 'index': deserialize.integer(payload.get('index')), - 'author': payload.get('author'), - 'body': payload.get('body'), - 'media': payload.get('media'), - 'attributes': payload.get('attributes'), - 'participant_sid': payload.get('participant_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'delivery': payload.get('delivery'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class MessageInstance(InstanceResource): + def __init__(self, version, payload, chat_service_sid: str, conversation_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'chat_service_sid' : payload.get('chat_service_sid'), + 'conversation_sid' : payload.get('conversation_sid'), + 'sid' : payload.get('sid'), + 'index' : payload.get('index'), + 'author' : payload.get('author'), + 'body' : payload.get('body'), + 'media' : payload.get('media'), + 'attributes' : payload.get('attributes'), + 'participant_sid' : payload.get('participant_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'delivery' : payload.get('delivery'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), + 'content_sid' : payload.get('content_sid'), } - # Context self._context = None self._solution = { - 'chat_service_sid': chat_service_sid, - 'conversation_sid': conversation_sid, - 'sid': sid or self._properties['sid'], + 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid'],'conversation_sid': conversation_sid or self._properties['conversation_sid'],'sid': sid or self._properties['sid'], } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MessageContext for this MessageInstance - :rtype: twilio.rest.conversations.v1.service.conversation.message.MessageContext - """ if self._context is None: self._context = MessageContext( self._version, - chat_service_sid=self._solution['chat_service_sid'], - conversation_sid=self._solution['conversation_sid'], - sid=self._solution['sid'], + chat_service_sid=self._solution['chat_service_sid'],conversation_sid=self._solution['conversation_sid'],sid=self._solution['sid'], ) return self._context @property - def account_sid(self): - """ - :returns: The unique ID of the Account responsible for this message. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def chat_service_sid(self): - """ - :returns: The SID of the Conversation Service that the resource is associated with. - :rtype: unicode - """ - return self._properties['chat_service_sid'] - - @property - def conversation_sid(self): - """ - :returns: The unique ID of the Conversation for this message. - :rtype: unicode - """ - return self._properties['conversation_sid'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def index(self): - """ - :returns: The index of the message within the Conversation. - :rtype: unicode - """ - return self._properties['index'] - - @property - def author(self): - """ - :returns: The channel specific identifier of the message's author. - :rtype: unicode - """ - return self._properties['author'] - - @property - def body(self): - """ - :returns: The content of the message. - :rtype: unicode - """ - return self._properties['body'] - - @property - def media(self): - """ - :returns: An array of objects that describe the Message's media if attached, otherwise, null. - :rtype: list[dict] - """ - return self._properties['media'] - - @property - def attributes(self): - """ - :returns: A string metadata field you can use to store any data you wish. - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def participant_sid(self): - """ - :returns: The unique ID of messages's author participant. - :rtype: unicode - """ - return self._properties['participant_sid'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def delivery(self): - """ - :returns: An object that contains the summary of delivery statuses for the message to non-chat participants. - :rtype: dict - """ - return self._properties['delivery'] - - @property - def url(self): - """ - :returns: An absolute URL for this message. - :rtype: unicode - """ - return self._properties['url'] + def delivery_receipts(self): + return self._proxy.delivery_receipts + - @property - def links(self): - """ - :returns: Absolute URL to access the receipts of this message. - :rtype: unicode + def __repr__(self): """ - return self._properties['links'] - - def update(self, author=values.unset, body=values.unset, - date_created=values.unset, date_updated=values.unset, - attributes=values.unset, x_twilio_webhook_enabled=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the MessageInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode author: The channel specific identifier of the message's author. - :param unicode body: The content of the message. - :param datetime date_created: The date that this resource was created. - :param datetime date_updated: The date that this resource was last updated. - :param unicode attributes: A string metadata field you can use to store any data you wish. - :param MessageInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - :returns: The updated MessageInstance - :rtype: twilio.rest.conversations.v1.service.conversation.message.MessageInstance - """ - return self._proxy.update( - author=author, - body=body, - date_created=date_created, - date_updated=date_updated, - attributes=attributes, - x_twilio_webhook_enabled=x_twilio_webhook_enabled, - ) - - def delete(self, x_twilio_webhook_enabled=values.unset): - """ - Deletes the MessageInstance - :param MessageInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header +class MessageListInstance(ListResource): + def __init__(self, version: Version, chat_service_sid: str, conversation_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete(x_twilio_webhook_enabled=x_twilio_webhook_enabled, ) + # Path Solution + self._solution = { 'chat_service_sid': chat_service_sid, 'conversation_sid': conversation_sid, } + self._uri = '/Services/${chat_service_sid}/Conversations/${conversation_sid}/Messages' + + + """ + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - def fetch(self): - """ - Fetch the MessageInstance + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: The fetched MessageInstance - :rtype: twilio.rest.conversations.v1.service.conversation.message.MessageInstance - """ - return self._proxy.fetch() + return MessageInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid']conversation_sid=self._solution['conversation_sid']) + + """ + + """ + def page(self, order, page_size): + + data = values.of({ + 'order': order,'page_size': page_size, + }) - @property - def delivery_receipts(self): - """ - Access the delivery_receipts + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptList - :rtype: twilio.rest.conversations.v1.service.conversation.message.delivery_receipt.DeliveryReceiptList - """ - return self._proxy.delivery_receipts + return MessagePage(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], conversation_sid=self._solution['conversation_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/service/user.py b/twilio/rest/conversations/v1/service/user.py deleted file mode 100644 index 2155dc15f0..0000000000 --- a/twilio/rest/conversations/v1/service/user.py +++ /dev/null @@ -1,182 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Conversations - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.user.user_conversation import UserConversationListInstance - - -class UserContext(InstanceContext): - def __init__(self, version: Version, chat_service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'chat_service_sid': chat_service_sid, 'sid': sid, } - self._uri = '/Services/${chat_service_sid}/Users/${sid}' - - self._user_conversations = None - - def delete(self, x_twilio_webhook_enabled): - - - - """ - Deletes the UserInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the UserInstance - - :returns: The fetched UserInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return UserInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], sid=self._solution['sid'], ) - - - - - def update(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return UserInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class UserInstance(InstanceResource): - def __init__(self, version, payload, chat_service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'chat_service_sid' : payload.get('chat_service_sid'), - 'role_sid' : payload.get('role_sid'), - 'identity' : payload.get('identity'), - 'friendly_name' : payload.get('friendly_name'), - 'attributes' : payload.get('attributes'), - 'is_online' : payload.get('is_online'), - 'is_notifiable' : payload.get('is_notifiable'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = UserContext( - self._version, - chat_service_sid=self._solution['chat_service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def user_conversations(self): - return self._proxy.user_conversations - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class UserListInstance(ListResource): - def __init__(self, version: Version, chat_service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'chat_service_sid': chat_service_sid, } - self._uri = '/Services/${chat_service_sid}/Users' - - - """ - def create(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return UserInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return UserPage(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/conversations/v1/service/user/__init__.py b/twilio/rest/conversations/v1/service/user/__init__.py index fb45304824..2155dc15f0 100644 --- a/twilio/rest/conversations/v1/service/user/__init__.py +++ b/twilio/rest/conversations/v1/service/user/__init__.py @@ -1,528 +1,182 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.conversations.v1.service.user.user_conversation import UserConversationList - - -class UserList(ListResource): - - def __init__(self, version, chat_service_sid): - """ - Initialize the UserList - - :param Version version: Version that contains the resource - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with - - :returns: twilio.rest.conversations.v1.service.user.UserList - :rtype: twilio.rest.conversations.v1.service.user.UserList - """ - super(UserList, self).__init__(version) - - # Path Solution - self._solution = {'chat_service_sid': chat_service_sid, } - self._uri = '/Services/{chat_service_sid}/Users'.format(**self._solution) - - def create(self, identity, friendly_name=values.unset, attributes=values.unset, - role_sid=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Create the UserInstance - - :param unicode identity: The string that identifies the resource's User - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode attributes: The JSON Object string that stores application-specific data - :param unicode role_sid: The SID of a service-level Role to assign to the user - :param UserInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The created UserInstance - :rtype: twilio.rest.conversations.v1.service.user.UserInstance - """ - data = values.of({ - 'Identity': identity, - 'FriendlyName': friendly_name, - 'Attributes': attributes, - 'RoleSid': role_sid, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, headers=headers, ) - - return UserInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams UserInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.conversations.v1.service.user.UserInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists UserInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.conversations.v1.service.user.UserInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UserInstance - :rtype: twilio.rest.conversations.v1.service.user.UserPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return UserPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserInstance - :rtype: twilio.rest.conversations.v1.service.user.UserPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a UserContext - - :param sid: The SID of the User resource to fetch - - :returns: twilio.rest.conversations.v1.service.user.UserContext - :rtype: twilio.rest.conversations.v1.service.user.UserContext - """ - return UserContext(self._version, chat_service_sid=self._solution['chat_service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a UserContext +from twilio.base.version import Version - :param sid: The SID of the User resource to fetch - - :returns: twilio.rest.conversations.v1.service.user.UserContext - :rtype: twilio.rest.conversations.v1.service.user.UserContext - """ - return UserContext(self._version, chat_service_sid=self._solution['chat_service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class UserPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the UserPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param chat_service_sid: The SID of the Conversation Service that the resource is associated with - - :returns: twilio.rest.conversations.v1.service.user.UserPage - :rtype: twilio.rest.conversations.v1.service.user.UserPage - """ - super(UserPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.conversations.v1.service.user.UserInstance - :rtype: twilio.rest.conversations.v1.service.user.UserInstance - """ - return UserInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.user.user_conversation import UserConversationListInstance class UserContext(InstanceContext): - - def __init__(self, version, chat_service_sid, sid): - """ - Initialize the UserContext - - :param Version version: Version that contains the resource - :param chat_service_sid: The SID of the Conversation Service to fetch the resource from - :param sid: The SID of the User resource to fetch - - :returns: twilio.rest.conversations.v1.service.user.UserContext - :rtype: twilio.rest.conversations.v1.service.user.UserContext - """ - super(UserContext, self).__init__(version) + def __init__(self, version: Version, chat_service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'chat_service_sid': chat_service_sid, 'sid': sid, } - self._uri = '/Services/{chat_service_sid}/Users/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'chat_service_sid': chat_service_sid, 'sid': sid, } + self._uri = '/Services/${chat_service_sid}/Users/${sid}' + self._user_conversations = None + + def delete(self, x_twilio_webhook_enabled): + + - def update(self, friendly_name=values.unset, attributes=values.unset, - role_sid=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Update the UserInstance - - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode attributes: The JSON Object string that stores application-specific data - :param unicode role_sid: The SID of a service-level Role to assign to the user - :param UserInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated UserInstance - :rtype: twilio.rest.conversations.v1.service.user.UserInstance - """ - data = values.of({'FriendlyName': friendly_name, 'Attributes': attributes, 'RoleSid': role_sid, }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) - - return UserInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - sid=self._solution['sid'], - ) - - def delete(self, x_twilio_webhook_enabled=values.unset): """ Deletes the UserInstance - :param UserInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - :returns: True if delete succeeds, False otherwise :rtype: bool """ - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the UserInstance :returns: The fetched UserInstance - :rtype: twilio.rest.conversations.v1.service.user.UserInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return UserInstance( - self._version, - payload, - chat_service_sid=self._solution['chat_service_sid'], - sid=self._solution['sid'], - ) + return UserInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], sid=self._solution['sid'], ) + - @property - def user_conversations(self): - """ - Access the user_conversations + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - :returns: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationList - :rtype: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationList - """ - if self._user_conversations is None: - self._user_conversations = UserConversationList( - self._version, - chat_service_sid=self._solution['chat_service_sid'], - user_sid=self._solution['sid'], - ) - return self._user_conversations + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return UserInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class UserInstance(InstanceResource): - - class WebhookEnabledType(object): - TRUE = "true" - FALSE = "false" - def __init__(self, version, payload, chat_service_sid, sid=None): - """ - Initialize the UserInstance - :returns: twilio.rest.conversations.v1.service.user.UserInstance - :rtype: twilio.rest.conversations.v1.service.user.UserInstance - """ - super(UserInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'chat_service_sid': payload.get('chat_service_sid'), - 'role_sid': payload.get('role_sid'), - 'identity': payload.get('identity'), - 'friendly_name': payload.get('friendly_name'), - 'attributes': payload.get('attributes'), - 'is_online': payload.get('is_online'), - 'is_notifiable': payload.get('is_notifiable'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class UserInstance(InstanceResource): + def __init__(self, version, payload, chat_service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'chat_service_sid' : payload.get('chat_service_sid'), + 'role_sid' : payload.get('role_sid'), + 'identity' : payload.get('identity'), + 'friendly_name' : payload.get('friendly_name'), + 'attributes' : payload.get('attributes'), + 'is_online' : payload.get('is_online'), + 'is_notifiable' : payload.get('is_notifiable'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'chat_service_sid': chat_service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'chat_service_sid': chat_service_sid or self._properties['chat_service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserContext for this UserInstance - :rtype: twilio.rest.conversations.v1.service.user.UserContext - """ if self._context is None: self._context = UserContext( self._version, - chat_service_sid=self._solution['chat_service_sid'], - sid=self._solution['sid'], + chat_service_sid=self._solution['chat_service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def chat_service_sid(self): - """ - :returns: The SID of the Conversation Service that the resource is associated with - :rtype: unicode - """ - return self._properties['chat_service_sid'] - - @property - def role_sid(self): - """ - :returns: The SID of a service-level Role assigned to the user - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def identity(self): - """ - :returns: The string that identifies the resource's User - :rtype: unicode - """ - return self._properties['identity'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def attributes(self): - """ - :returns: The JSON Object string that stores application-specific data - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def is_online(self): - """ - :returns: Whether the User is actively connected to this Conversations Service and online - :rtype: bool - """ - return self._properties['is_online'] - - @property - def is_notifiable(self): - """ - :returns: Whether the User has a potentially valid Push Notification registration for this Conversations Service - :rtype: bool - """ - return self._properties['is_notifiable'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: An absolute URL for this user. - :rtype: unicode - """ - return self._properties['url'] + def user_conversations(self): + return self._proxy.user_conversations + - @property - def links(self): - """ - :returns: The links - :rtype: unicode + def __repr__(self): """ - return self._properties['links'] - - def update(self, friendly_name=values.unset, attributes=values.unset, - role_sid=values.unset, x_twilio_webhook_enabled=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the UserInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode attributes: The JSON Object string that stores application-specific data - :param unicode role_sid: The SID of a service-level Role to assign to the user - :param UserInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - :returns: The updated UserInstance - :rtype: twilio.rest.conversations.v1.service.user.UserInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - attributes=attributes, - role_sid=role_sid, - x_twilio_webhook_enabled=x_twilio_webhook_enabled, - ) - - def delete(self, x_twilio_webhook_enabled=values.unset): - """ - Deletes the UserInstance - :param UserInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header +class UserListInstance(ListResource): + def __init__(self, version: Version, chat_service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete(x_twilio_webhook_enabled=x_twilio_webhook_enabled, ) + # Path Solution + self._solution = { 'chat_service_sid': chat_service_sid, } + self._uri = '/Services/${chat_service_sid}/Users' + + + """ + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - def fetch(self): - """ - Fetch the UserInstance + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: The fetched UserInstance - :rtype: twilio.rest.conversations.v1.service.user.UserInstance - """ - return self._proxy.fetch() + return UserInstance(self._version, payload, chat_service_sid=self._solution['chat_service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def user_conversations(self): - """ - Access the user_conversations + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationList - :rtype: twilio.rest.conversations.v1.service.user.user_conversation.UserConversationList - """ - return self._proxy.user_conversations + return UserPage(self._version, payload, chat_service_sid=self._solution['chat_service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/conversations/v1/user.py b/twilio/rest/conversations/v1/user.py deleted file mode 100644 index fe914a6b4a..0000000000 --- a/twilio/rest/conversations/v1/user.py +++ /dev/null @@ -1,182 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Conversations - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.user.user_conversation import UserConversationListInstance - - -class UserContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Users/${sid}' - - self._user_conversations = None - - def delete(self, x_twilio_webhook_enabled): - - - - """ - Deletes the UserInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the UserInstance - - :returns: The fetched UserInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return UserInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return UserInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class UserInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'chat_service_sid' : payload.get('chat_service_sid'), - 'role_sid' : payload.get('role_sid'), - 'identity' : payload.get('identity'), - 'friendly_name' : payload.get('friendly_name'), - 'attributes' : payload.get('attributes'), - 'is_online' : payload.get('is_online'), - 'is_notifiable' : payload.get('is_notifiable'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = UserContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def user_conversations(self): - return self._proxy.user_conversations - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class UserListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Users' - - - """ - def create(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return UserInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return UserPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/conversations/v1/user/__init__.py b/twilio/rest/conversations/v1/user/__init__.py index 58d5c16002..fe914a6b4a 100644 --- a/twilio/rest/conversations/v1/user/__init__.py +++ b/twilio/rest/conversations/v1/user/__init__.py @@ -1,507 +1,182 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Conversations + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.conversations.v1.user.user_conversation import UserConversationList - - -class UserList(ListResource): - - def __init__(self, version): - """ - Initialize the UserList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.conversations.v1.user.UserList - :rtype: twilio.rest.conversations.v1.user.UserList - """ - super(UserList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Users'.format(**self._solution) - - def create(self, identity, friendly_name=values.unset, attributes=values.unset, - role_sid=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Create the UserInstance - - :param unicode identity: The string that identifies the resource's User - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode attributes: The JSON Object string that stores application-specific data - :param unicode role_sid: The SID of a service-level Role to assign to the user - :param UserInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The created UserInstance - :rtype: twilio.rest.conversations.v1.user.UserInstance - """ - data = values.of({ - 'Identity': identity, - 'FriendlyName': friendly_name, - 'Attributes': attributes, - 'RoleSid': role_sid, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, headers=headers, ) - - return UserInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams UserInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.conversations.v1.user.UserInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists UserInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.conversations.v1.user.UserInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UserInstance - :rtype: twilio.rest.conversations.v1.user.UserPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return UserPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserInstance - :rtype: twilio.rest.conversations.v1.user.UserPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a UserContext - - :param sid: The SID of the User resource to fetch - - :returns: twilio.rest.conversations.v1.user.UserContext - :rtype: twilio.rest.conversations.v1.user.UserContext - """ - return UserContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a UserContext +from twilio.base.version import Version - :param sid: The SID of the User resource to fetch - - :returns: twilio.rest.conversations.v1.user.UserContext - :rtype: twilio.rest.conversations.v1.user.UserContext - """ - return UserContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class UserPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the UserPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.conversations.v1.user.UserPage - :rtype: twilio.rest.conversations.v1.user.UserPage - """ - super(UserPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.conversations.v1.user.UserInstance - :rtype: twilio.rest.conversations.v1.user.UserInstance - """ - return UserInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.user.user_conversation import UserConversationListInstance class UserContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the UserContext - - :param Version version: Version that contains the resource - :param sid: The SID of the User resource to fetch - - :returns: twilio.rest.conversations.v1.user.UserContext - :rtype: twilio.rest.conversations.v1.user.UserContext - """ - super(UserContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Users/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Users/${sid}' + self._user_conversations = None + + def delete(self, x_twilio_webhook_enabled): + + - def update(self, friendly_name=values.unset, attributes=values.unset, - role_sid=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Update the UserInstance - - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode attributes: The JSON Object string that stores application-specific data - :param unicode role_sid: The SID of a service-level Role to assign to the user - :param UserInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated UserInstance - :rtype: twilio.rest.conversations.v1.user.UserInstance - """ - data = values.of({'FriendlyName': friendly_name, 'Attributes': attributes, 'RoleSid': role_sid, }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) - - return UserInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self, x_twilio_webhook_enabled=values.unset): """ Deletes the UserInstance - :param UserInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - :returns: True if delete succeeds, False otherwise :rtype: bool """ - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the UserInstance :returns: The fetched UserInstance - :rtype: twilio.rest.conversations.v1.user.UserInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return UserInstance(self._version, payload, sid=self._solution['sid'], ) + - @property - def user_conversations(self): - """ - Access the user_conversations + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - :returns: twilio.rest.conversations.v1.user.user_conversation.UserConversationList - :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationList - """ - if self._user_conversations is None: - self._user_conversations = UserConversationList(self._version, user_sid=self._solution['sid'], ) - return self._user_conversations + payload = self._version.update(method='post', uri=self._uri, data=data, ) + + return UserInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class UserInstance(InstanceResource): + return '' - class WebhookEnabledType(object): - TRUE = "true" - FALSE = "false" - def __init__(self, version, payload, sid=None): - """ - Initialize the UserInstance - :returns: twilio.rest.conversations.v1.user.UserInstance - :rtype: twilio.rest.conversations.v1.user.UserInstance - """ - super(UserInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'chat_service_sid': payload.get('chat_service_sid'), - 'role_sid': payload.get('role_sid'), - 'identity': payload.get('identity'), - 'friendly_name': payload.get('friendly_name'), - 'attributes': payload.get('attributes'), - 'is_online': payload.get('is_online'), - 'is_notifiable': payload.get('is_notifiable'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class UserInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'chat_service_sid' : payload.get('chat_service_sid'), + 'role_sid' : payload.get('role_sid'), + 'identity' : payload.get('identity'), + 'friendly_name' : payload.get('friendly_name'), + 'attributes' : payload.get('attributes'), + 'is_online' : payload.get('is_online'), + 'is_notifiable' : payload.get('is_notifiable'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserContext for this UserInstance - :rtype: twilio.rest.conversations.v1.user.UserContext - """ if self._context is None: - self._context = UserContext(self._version, sid=self._solution['sid'], ) + self._context = UserContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def chat_service_sid(self): - """ - :returns: The SID of the Conversation Service that the resource is associated with - :rtype: unicode - """ - return self._properties['chat_service_sid'] - - @property - def role_sid(self): - """ - :returns: The SID of a service-level Role assigned to the user - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def identity(self): - """ - :returns: The string that identifies the resource's User - :rtype: unicode - """ - return self._properties['identity'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def attributes(self): - """ - :returns: The JSON Object string that stores application-specific data - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def is_online(self): - """ - :returns: Whether the User is actively connected to this Conversations Service and online - :rtype: bool - """ - return self._properties['is_online'] - - @property - def is_notifiable(self): - """ - :returns: Whether the User has a potentially valid Push Notification registration for this Conversations Service - :rtype: bool - """ - return self._properties['is_notifiable'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] + def user_conversations(self): + return self._proxy.user_conversations + - @property - def url(self): + def __repr__(self): """ - :returns: An absolute URL for this user. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - def update(self, friendly_name=values.unset, attributes=values.unset, - role_sid=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Update the UserInstance - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode attributes: The JSON Object string that stores application-specific data - :param unicode role_sid: The SID of a service-level Role to assign to the user - :param UserInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header +class UserListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The updated UserInstance - :rtype: twilio.rest.conversations.v1.user.UserInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - attributes=attributes, - role_sid=role_sid, - x_twilio_webhook_enabled=x_twilio_webhook_enabled, - ) - - def delete(self, x_twilio_webhook_enabled=values.unset): - """ - Deletes the UserInstance - - :param UserInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete(x_twilio_webhook_enabled=x_twilio_webhook_enabled, ) + # Path Solution + self._solution = { } + self._uri = '/Users' + + + """ + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - def fetch(self): - """ - Fetch the UserInstance + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: The fetched UserInstance - :rtype: twilio.rest.conversations.v1.user.UserInstance - """ - return self._proxy.fetch() + return UserInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def user_conversations(self): - """ - Access the user_conversations + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.conversations.v1.user.user_conversation.UserConversationList - :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationList - """ - return self._proxy.user_conversations + return UserPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/events/v1/schema.py b/twilio/rest/events/v1/schema.py deleted file mode 100644 index 9268ebc72e..0000000000 --- a/twilio/rest/events/v1/schema.py +++ /dev/null @@ -1,123 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Events - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.rest.schema.schema_version import SchemaVersionListInstance - - -class SchemaContext(InstanceContext): - def __init__(self, version: Version, id: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'id': id, } - self._uri = '/Schemas/${id}' - - self._versions = None - - def fetch(self): - - """ - Fetch the SchemaInstance - - :returns: The fetched SchemaInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SchemaInstance(self._version, payload, id=self._solution['id'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class SchemaInstance(InstanceResource): - def __init__(self, version, payload, id: str): - super().__init__(version) - self._properties = { - 'id' : payload.get('id'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - 'latest_version_date_created' : payload.get('latest_version_date_created'), - 'latest_version' : payload.get('latest_version'), - } - - self._context = None - self._solution = { - 'id': id or self._properties['id'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = SchemaContext( - self._version, - id=self._solution['id'], - ) - return self._context - - @property - def versions(self): - return self._proxy.versions - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class SchemaListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '' - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/events/v1/schema/__init__.py b/twilio/rest/events/v1/schema/__init__.py index f5a17b8848..9268ebc72e 100644 --- a/twilio/rest/events/v1/schema/__init__.py +++ b/twilio/rest/events/v1/schema/__init__.py @@ -1,271 +1,123 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Events + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.events.v1.schema.version import SchemaVersionList - - -class SchemaList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the SchemaList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.events.v1.schema.SchemaList - :rtype: twilio.rest.events.v1.schema.SchemaList - """ - super(SchemaList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, id): - """ - Constructs a SchemaContext - - :param id: The unique identifier of the schema. - - :returns: twilio.rest.events.v1.schema.SchemaContext - :rtype: twilio.rest.events.v1.schema.SchemaContext - """ - return SchemaContext(self._version, id=id, ) - - def __call__(self, id): - """ - Constructs a SchemaContext - - :param id: The unique identifier of the schema. - - :returns: twilio.rest.events.v1.schema.SchemaContext - :rtype: twilio.rest.events.v1.schema.SchemaContext - """ - return SchemaContext(self._version, id=id, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SchemaPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the SchemaPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.events.v1.schema.SchemaPage - :rtype: twilio.rest.events.v1.schema.SchemaPage - """ - super(SchemaPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SchemaInstance +from twilio.base.version import Version - :param dict payload: Payload response from the API - - :returns: twilio.rest.events.v1.schema.SchemaInstance - :rtype: twilio.rest.events.v1.schema.SchemaInstance - """ - return SchemaInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.schema.schema_version import SchemaVersionListInstance class SchemaContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, id): - """ - Initialize the SchemaContext - - :param Version version: Version that contains the resource - :param id: The unique identifier of the schema. - - :returns: twilio.rest.events.v1.schema.SchemaContext - :rtype: twilio.rest.events.v1.schema.SchemaContext - """ - super(SchemaContext, self).__init__(version) + def __init__(self, version: Version, id: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'id': id, } - self._uri = '/Schemas/{id}'.format(**self._solution) - - # Dependents + self._solution = { 'id': id, } + self._uri = '/Schemas/${id}' + self._versions = None - + def fetch(self): + """ Fetch the SchemaInstance :returns: The fetched SchemaInstance - :rtype: twilio.rest.events.v1.schema.SchemaInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return SchemaInstance(self._version, payload, id=self._solution['id'], ) + - @property - def versions(self): - """ - Access the versions - - :returns: twilio.rest.events.v1.schema.version.SchemaVersionList - :rtype: twilio.rest.events.v1.schema.version.SchemaVersionList - """ - if self._versions is None: - self._versions = SchemaVersionList(self._version, id=self._solution['id'], ) - return self._versions + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class SchemaInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, id=None): - """ - Initialize the SchemaInstance - :returns: twilio.rest.events.v1.schema.SchemaInstance - :rtype: twilio.rest.events.v1.schema.SchemaInstance - """ - super(SchemaInstance, self).__init__(version) - # Marshaled Properties - self._properties = { - 'id': payload.get('id'), - 'url': payload.get('url'), - 'links': payload.get('links'), - 'latest_version_date_created': deserialize.iso8601_datetime(payload.get('latest_version_date_created')), - 'latest_version': deserialize.integer(payload.get('latest_version')), +class SchemaInstance(InstanceResource): + def __init__(self, version, payload, id: str): + super().__init__(version) + self._properties = { + 'id' : payload.get('id'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), + 'latest_version_date_created' : payload.get('latest_version_date_created'), + 'latest_version' : payload.get('latest_version'), } - # Context self._context = None - self._solution = {'id': id or self._properties['id'], } + self._solution = { + 'id': id or self._properties['id'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SchemaContext for this SchemaInstance - :rtype: twilio.rest.events.v1.schema.SchemaContext - """ if self._context is None: - self._context = SchemaContext(self._version, id=self._solution['id'], ) + self._context = SchemaContext( + self._version, + id=self._solution['id'], + ) return self._context @property - def id(self): - """ - :returns: Schema Identifier. - :rtype: unicode - """ - return self._properties['id'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: Nested resource URLs. - :rtype: unicode - """ - return self._properties['links'] - - @property - def latest_version_date_created(self): - """ - :returns: The date that the latest schema version was created. - :rtype: datetime - """ - return self._properties['latest_version_date_created'] + def versions(self): + return self._proxy.versions + - @property - def latest_version(self): + def __repr__(self): """ - :returns: Latest schema version. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['latest_version'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the SchemaInstance - :returns: The fetched SchemaInstance - :rtype: twilio.rest.events.v1.schema.SchemaInstance - """ - return self._proxy.fetch() - @property - def versions(self): - """ - Access the versions +class SchemaListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.events.v1.schema.version.SchemaVersionList - :rtype: twilio.rest.events.v1.schema.version.SchemaVersionList - """ - return self._proxy.versions + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/events/v1/schema/version.py b/twilio/rest/events/v1/schema/version.py deleted file mode 100644 index d78d322df1..0000000000 --- a/twilio/rest/events/v1/schema/version.py +++ /dev/null @@ -1,335 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SchemaVersionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, id): - """ - Initialize the SchemaVersionList - - :param Version version: Version that contains the resource - :param id: The unique identifier of the schema. - - :returns: twilio.rest.events.v1.schema.version.SchemaVersionList - :rtype: twilio.rest.events.v1.schema.version.SchemaVersionList - """ - super(SchemaVersionList, self).__init__(version) - - # Path Solution - self._solution = {'id': id, } - self._uri = '/Schemas/{id}/Versions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams SchemaVersionInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.events.v1.schema.version.SchemaVersionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SchemaVersionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.events.v1.schema.version.SchemaVersionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SchemaVersionInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SchemaVersionInstance - :rtype: twilio.rest.events.v1.schema.version.SchemaVersionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SchemaVersionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SchemaVersionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SchemaVersionInstance - :rtype: twilio.rest.events.v1.schema.version.SchemaVersionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SchemaVersionPage(self._version, response, self._solution) - - def get(self, schema_version): - """ - Constructs a SchemaVersionContext - - :param schema_version: The version of the schema - - :returns: twilio.rest.events.v1.schema.version.SchemaVersionContext - :rtype: twilio.rest.events.v1.schema.version.SchemaVersionContext - """ - return SchemaVersionContext(self._version, id=self._solution['id'], schema_version=schema_version, ) - - def __call__(self, schema_version): - """ - Constructs a SchemaVersionContext - - :param schema_version: The version of the schema - - :returns: twilio.rest.events.v1.schema.version.SchemaVersionContext - :rtype: twilio.rest.events.v1.schema.version.SchemaVersionContext - """ - return SchemaVersionContext(self._version, id=self._solution['id'], schema_version=schema_version, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SchemaVersionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the SchemaVersionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param id: The unique identifier of the schema. - - :returns: twilio.rest.events.v1.schema.version.SchemaVersionPage - :rtype: twilio.rest.events.v1.schema.version.SchemaVersionPage - """ - super(SchemaVersionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SchemaVersionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.events.v1.schema.version.SchemaVersionInstance - :rtype: twilio.rest.events.v1.schema.version.SchemaVersionInstance - """ - return SchemaVersionInstance(self._version, payload, id=self._solution['id'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SchemaVersionContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, id, schema_version): - """ - Initialize the SchemaVersionContext - - :param Version version: Version that contains the resource - :param id: The unique identifier of the schema. - :param schema_version: The version of the schema - - :returns: twilio.rest.events.v1.schema.version.SchemaVersionContext - :rtype: twilio.rest.events.v1.schema.version.SchemaVersionContext - """ - super(SchemaVersionContext, self).__init__(version) - - # Path Solution - self._solution = {'id': id, 'schema_version': schema_version, } - self._uri = '/Schemas/{id}/Versions/{schema_version}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SchemaVersionInstance - - :returns: The fetched SchemaVersionInstance - :rtype: twilio.rest.events.v1.schema.version.SchemaVersionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SchemaVersionInstance( - self._version, - payload, - id=self._solution['id'], - schema_version=self._solution['schema_version'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class SchemaVersionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, id, schema_version=None): - """ - Initialize the SchemaVersionInstance - - :returns: twilio.rest.events.v1.schema.version.SchemaVersionInstance - :rtype: twilio.rest.events.v1.schema.version.SchemaVersionInstance - """ - super(SchemaVersionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'id': payload.get('id'), - 'schema_version': deserialize.integer(payload.get('schema_version')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'url': payload.get('url'), - 'raw': payload.get('raw'), - } - - # Context - self._context = None - self._solution = {'id': id, 'schema_version': schema_version or self._properties['schema_version'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SchemaVersionContext for this SchemaVersionInstance - :rtype: twilio.rest.events.v1.schema.version.SchemaVersionContext - """ - if self._context is None: - self._context = SchemaVersionContext( - self._version, - id=self._solution['id'], - schema_version=self._solution['schema_version'], - ) - return self._context - - @property - def id(self): - """ - :returns: The unique identifier of the schema. - :rtype: unicode - """ - return self._properties['id'] - - @property - def schema_version(self): - """ - :returns: The version of this schema. - :rtype: unicode - """ - return self._properties['schema_version'] - - @property - def date_created(self): - """ - :returns: The date the schema version was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - @property - def raw(self): - """ - :returns: The raw - :rtype: unicode - """ - return self._properties['raw'] - - def fetch(self): - """ - Fetch the SchemaVersionInstance - - :returns: The fetched SchemaVersionInstance - :rtype: twilio.rest.events.v1.schema.version.SchemaVersionInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) diff --git a/twilio/rest/events/v1/sink.py b/twilio/rest/events/v1/sink.py deleted file mode 100644 index d2cb15bf47..0000000000 --- a/twilio/rest/events/v1/sink.py +++ /dev/null @@ -1,182 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Events - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.sink.sink_test import SinkTestListInstancefrom twilio.rest.sink.sink_validate import SinkValidateListInstance - - -class SinkContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Sinks/${sid}' - - self._sink_test = None - self._sink_validate = None - - def delete(self): - - - - """ - Deletes the SinkInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the SinkInstance - - :returns: The fetched SinkInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SinkInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return SinkInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class SinkInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'description' : payload.get('description'), - 'sid' : payload.get('sid'), - 'sink_configuration' : payload.get('sink_configuration'), - 'sink_type' : payload.get('sink_type'), - 'status' : payload.get('status'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = SinkContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def sink_test(self): - return self._proxy.sink_test - @property - def sink_validate(self): - return self._proxy.sink_validate - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class SinkListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Sinks' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return SinkInstance(self._version, payload, ) - - """ - - """ - def page(self, in_use, status, page_size): - - data = values.of({ - 'in_use': in_use,'status': status,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return SinkPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/events/v1/sink/__init__.py b/twilio/rest/events/v1/sink/__init__.py index a8122c6c11..d2cb15bf47 100644 --- a/twilio/rest/events/v1/sink/__init__.py +++ b/twilio/rest/events/v1/sink/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Events + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,251 +19,29 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.events.v1.sink.sink_test import SinkTestList -from twilio.rest.events.v1.sink.sink_validate import SinkValidateList - - -class SinkList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the SinkList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.events.v1.sink.SinkList - :rtype: twilio.rest.events.v1.sink.SinkList - """ - super(SinkList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Sinks'.format(**self._solution) - - def create(self, description, sink_configuration, sink_type): - """ - Create the SinkInstance - - :param unicode description: Sink Description. - :param dict sink_configuration: JSON Sink configuration. - :param SinkInstance.SinkType sink_type: Sink type. - - :returns: The created SinkInstance - :rtype: twilio.rest.events.v1.sink.SinkInstance - """ - data = values.of({ - 'Description': description, - 'SinkConfiguration': serialize.object(sink_configuration), - 'SinkType': sink_type, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return SinkInstance(self._version, payload, ) - - def stream(self, in_use=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Streams SinkInstance 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 bool in_use: A boolean to return sinks used/not used by a subscription. - :param unicode status: A string to filter sinks by status. - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.events.v1.sink.SinkInstance] - """ - limits = self._version.read_limits(limit, page_size) +from twilio.base.version import Version - page = self.page(in_use=in_use, status=status, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, in_use=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Lists SinkInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param bool in_use: A boolean to return sinks used/not used by a subscription. - :param unicode status: A string to filter sinks by status. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.events.v1.sink.SinkInstance] - """ - return list(self.stream(in_use=in_use, status=status, limit=limit, page_size=page_size, )) - - def page(self, in_use=values.unset, status=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SinkInstance records from the API. - Request is executed immediately - - :param bool in_use: A boolean to return sinks used/not used by a subscription. - :param unicode status: A string to filter sinks by status. - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SinkInstance - :rtype: twilio.rest.events.v1.sink.SinkPage - """ - data = values.of({ - 'InUse': in_use, - 'Status': status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SinkPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SinkInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SinkInstance - :rtype: twilio.rest.events.v1.sink.SinkPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SinkPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SinkContext - - :param sid: A string that uniquely identifies this Sink. - - :returns: twilio.rest.events.v1.sink.SinkContext - :rtype: twilio.rest.events.v1.sink.SinkContext - """ - return SinkContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SinkContext - - :param sid: A string that uniquely identifies this Sink. - - :returns: twilio.rest.events.v1.sink.SinkContext - :rtype: twilio.rest.events.v1.sink.SinkContext - """ - return SinkContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SinkPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the SinkPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.events.v1.sink.SinkPage - :rtype: twilio.rest.events.v1.sink.SinkPage - """ - super(SinkPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SinkInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.events.v1.sink.SinkInstance - :rtype: twilio.rest.events.v1.sink.SinkInstance - """ - return SinkInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.sink.sink_test import SinkTestListInstancefrom twilio.rest.sink.sink_validate import SinkValidateListInstance class SinkContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the SinkContext - - :param Version version: Version that contains the resource - :param sid: A string that uniquely identifies this Sink. - - :returns: twilio.rest.events.v1.sink.SinkContext - :rtype: twilio.rest.events.v1.sink.SinkContext - """ - super(SinkContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Sinks/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Sinks/${sid}' + self._sink_test = None self._sink_validate = None - - def fetch(self): - """ - Fetch the SinkInstance - - :returns: The fetched SinkInstance - :rtype: twilio.rest.events.v1.sink.SinkInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SinkInstance(self._version, payload, sid=self._solution['sid'], ) - + def delete(self): + + + """ Deletes the SinkInstance @@ -264,238 +49,134 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, description): + + def fetch(self): + """ - Update the SinkInstance - - :param unicode description: Sink Description + Fetch the SinkInstance - :returns: The updated SinkInstance - :rtype: twilio.rest.events.v1.sink.SinkInstance + :returns: The fetched SinkInstance + #TODO: add rtype docs """ - data = values.of({'Description': description, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.fetch(method='GET', uri=self._uri, ) return SinkInstance(self._version, payload, sid=self._solution['sid'], ) + - @property - def sink_test(self): - """ - Access the sink_test + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: twilio.rest.events.v1.sink.sink_test.SinkTestList - :rtype: twilio.rest.events.v1.sink.sink_test.SinkTestList - """ - if self._sink_test is None: - self._sink_test = SinkTestList(self._version, sid=self._solution['sid'], ) - return self._sink_test + payload = self._version.update(method='post', uri=self._uri, data=data, ) - @property - def sink_validate(self): - """ - Access the sink_validate + return SinkInstance(self._version, payload, sid=self._solution['sid'], ) + + - :returns: twilio.rest.events.v1.sink.sink_validate.SinkValidateList - :rtype: twilio.rest.events.v1.sink.sink_validate.SinkValidateList - """ - if self._sink_validate is None: - self._sink_validate = SinkValidateList(self._version, sid=self._solution['sid'], ) - return self._sink_validate + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class SinkInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - class Status(object): - INITIALIZED = "initialized" - VALIDATING = "validating" - ACTIVE = "active" - FAILED = "failed" - - class SinkType(object): - KINESIS = "kinesis" - WEBHOOK = "webhook" - SEGMENT = "segment" - - def __init__(self, version, payload, sid=None): - """ - Initialize the SinkInstance - - :returns: twilio.rest.events.v1.sink.SinkInstance - :rtype: twilio.rest.events.v1.sink.SinkInstance - """ - super(SinkInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'description': payload.get('description'), - 'sid': payload.get('sid'), - 'sink_configuration': payload.get('sink_configuration'), - 'sink_type': payload.get('sink_type'), - 'status': payload.get('status'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class SinkInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'description' : payload.get('description'), + 'sid' : payload.get('sid'), + 'sink_configuration' : payload.get('sink_configuration'), + 'sink_type' : payload.get('sink_type'), + 'status' : payload.get('status'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SinkContext for this SinkInstance - :rtype: twilio.rest.events.v1.sink.SinkContext - """ if self._context is None: - self._context = SinkContext(self._version, sid=self._solution['sid'], ) + self._context = SinkContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def date_created(self): - """ - :returns: The date this Sink was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Sink was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def description(self): - """ - :returns: Sink Description - :rtype: unicode - """ - return self._properties['description'] - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Sink. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def sink_configuration(self): - """ - :returns: JSON Sink configuration. - :rtype: dict - """ - return self._properties['sink_configuration'] - - @property - def sink_type(self): - """ - :returns: Sink type. - :rtype: SinkInstance.SinkType - """ - return self._properties['sink_type'] - - @property - def status(self): - """ - :returns: The Status of this Sink - :rtype: SinkInstance.Status - """ - return self._properties['status'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - + def sink_test(self): + return self._proxy.sink_test @property - def links(self): - """ - :returns: Nested resource URLs. - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the SinkInstance + def sink_validate(self): + return self._proxy.sink_validate + - :returns: The fetched SinkInstance - :rtype: twilio.rest.events.v1.sink.SinkInstance + def __repr__(self): """ - return self._proxy.fetch() - - def delete(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the SinkInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def update(self, description): - """ - Update the SinkInstance - :param unicode description: Sink Description +class SinkListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The updated SinkInstance - :rtype: twilio.rest.events.v1.sink.SinkInstance - """ - return self._proxy.update(description, ) + # Path Solution + self._solution = { } + self._uri = '/Sinks' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def sink_test(self): - """ - Access the sink_test + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.events.v1.sink.sink_test.SinkTestList - :rtype: twilio.rest.events.v1.sink.sink_test.SinkTestList - """ - return self._proxy.sink_test + return SinkInstance(self._version, payload, ) + + """ + + """ + def page(self, in_use, status, page_size): + + data = values.of({ + 'in_use': in_use,'status': status,'page_size': page_size, + }) - @property - def sink_validate(self): - """ - Access the sink_validate + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.events.v1.sink.sink_validate.SinkValidateList - :rtype: twilio.rest.events.v1.sink.sink_validate.SinkValidateList - """ - return self._proxy.sink_validate + return SinkPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/events/v1/subscription.py b/twilio/rest/events/v1/subscription.py deleted file mode 100644 index 5a2ffe2673..0000000000 --- a/twilio/rest/events/v1/subscription.py +++ /dev/null @@ -1,177 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Events - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.subscription.subscribed_event import SubscribedEventListInstance - - -class SubscriptionContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Subscriptions/${sid}' - - self._subscribed_events = None - - def delete(self): - - - - """ - Deletes the SubscriptionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the SubscriptionInstance - - :returns: The fetched SubscriptionInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SubscriptionInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return SubscriptionInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class SubscriptionInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'sid' : payload.get('sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'description' : payload.get('description'), - 'sink_sid' : payload.get('sink_sid'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = SubscriptionContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def subscribed_events(self): - return self._proxy.subscribed_events - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class SubscriptionListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Subscriptions' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return SubscriptionInstance(self._version, payload, ) - - """ - - """ - def page(self, sink_sid, page_size): - - data = values.of({ - 'sink_sid': sink_sid,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return SubscriptionPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/events/v1/subscription/__init__.py b/twilio/rest/events/v1/subscription/__init__.py index 4d8ee876d2..5a2ffe2673 100644 --- a/twilio/rest/events/v1/subscription/__init__.py +++ b/twilio/rest/events/v1/subscription/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Events + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,441 +19,159 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.events.v1.subscription.subscribed_event import SubscribedEventList - - -class SubscriptionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the SubscriptionList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.events.v1.subscription.SubscriptionList - :rtype: twilio.rest.events.v1.subscription.SubscriptionList - """ - super(SubscriptionList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Subscriptions'.format(**self._solution) - - def stream(self, sink_sid=values.unset, limit=None, page_size=None): - """ - Streams SubscriptionInstance 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 unicode sink_sid: Sink SID. - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.events.v1.subscription.SubscriptionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(sink_sid=sink_sid, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, sink_sid=values.unset, limit=None, page_size=None): - """ - Lists SubscriptionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode sink_sid: Sink SID. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.events.v1.subscription.SubscriptionInstance] - """ - return list(self.stream(sink_sid=sink_sid, limit=limit, page_size=page_size, )) - - def page(self, sink_sid=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of SubscriptionInstance records from the API. - Request is executed immediately - - :param unicode sink_sid: Sink SID. - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SubscriptionInstance - :rtype: twilio.rest.events.v1.subscription.SubscriptionPage - """ - data = values.of({ - 'SinkSid': sink_sid, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SubscriptionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SubscriptionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SubscriptionInstance - :rtype: twilio.rest.events.v1.subscription.SubscriptionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SubscriptionPage(self._version, response, self._solution) - - def create(self, description, sink_sid, types): - """ - Create the SubscriptionInstance - - :param unicode description: Subscription description - :param unicode sink_sid: Sink SID. - :param list[dict] types: Subscribed Event Types - - :returns: The created SubscriptionInstance - :rtype: twilio.rest.events.v1.subscription.SubscriptionInstance - """ - data = values.of({ - 'Description': description, - 'SinkSid': sink_sid, - 'Types': serialize.map(types, lambda e: serialize.object(e)), - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return SubscriptionInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a SubscriptionContext - - :param sid: A string that uniquely identifies this Subscription. - - :returns: twilio.rest.events.v1.subscription.SubscriptionContext - :rtype: twilio.rest.events.v1.subscription.SubscriptionContext - """ - return SubscriptionContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SubscriptionContext - - :param sid: A string that uniquely identifies this Subscription. - - :returns: twilio.rest.events.v1.subscription.SubscriptionContext - :rtype: twilio.rest.events.v1.subscription.SubscriptionContext - """ - return SubscriptionContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - +from twilio.base.version import Version -class SubscriptionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ +from twilio.base.page import Page - def __init__(self, version, response, solution): - """ - Initialize the SubscriptionPage +# from twilio.rest.subscription.subscribed_event import SubscribedEventListInstance - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.events.v1.subscription.SubscriptionPage - :rtype: twilio.rest.events.v1.subscription.SubscriptionPage - """ - super(SubscriptionPage, self).__init__(version, response) +class SubscriptionContext(InstanceContext): + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SubscriptionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.events.v1.subscription.SubscriptionInstance - :rtype: twilio.rest.events.v1.subscription.SubscriptionInstance - """ - return SubscriptionInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SubscriptionContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ + self._solution = { 'sid': sid, } + self._uri = '/Subscriptions/${sid}' + + self._subscribed_events = None + + def delete(self): + + - def __init__(self, version, sid): """ - Initialize the SubscriptionContext - - :param Version version: Version that contains the resource - :param sid: A string that uniquely identifies this Subscription. + Deletes the SubscriptionInstance - :returns: twilio.rest.events.v1.subscription.SubscriptionContext - :rtype: twilio.rest.events.v1.subscription.SubscriptionContext + :returns: True if delete succeeds, False otherwise + :rtype: bool """ - super(SubscriptionContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Subscriptions/{sid}'.format(**self._solution) - - # Dependents - self._subscribed_events = None - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the SubscriptionInstance :returns: The fetched SubscriptionInstance - :rtype: twilio.rest.events.v1.subscription.SubscriptionInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return SubscriptionInstance(self._version, payload, sid=self._solution['sid'], ) + - def update(self, description=values.unset, sink_sid=values.unset): - """ - Update the SubscriptionInstance - - :param unicode description: Subscription description. - :param unicode sink_sid: Sink SID. - - :returns: The updated SubscriptionInstance - :rtype: twilio.rest.events.v1.subscription.SubscriptionInstance - """ - data = values.of({'Description': description, 'SinkSid': sink_sid, }) + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return SubscriptionInstance(self._version, payload, sid=self._solution['sid'], ) + + - def delete(self): - """ - Deletes the SubscriptionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def subscribed_events(self): - """ - Access the subscribed_events - - :returns: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventList - :rtype: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventList - """ - if self._subscribed_events is None: - self._subscribed_events = SubscribedEventList(self._version, subscription_sid=self._solution['sid'], ) - return self._subscribed_events + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class SubscriptionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, payload, sid=None): - """ - Initialize the SubscriptionInstance - :returns: twilio.rest.events.v1.subscription.SubscriptionInstance - :rtype: twilio.rest.events.v1.subscription.SubscriptionInstance - """ - super(SubscriptionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'sid': payload.get('sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'description': payload.get('description'), - 'sink_sid': payload.get('sink_sid'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class SubscriptionInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'sid' : payload.get('sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'description' : payload.get('description'), + 'sink_sid' : payload.get('sink_sid'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SubscriptionContext for this SubscriptionInstance - :rtype: twilio.rest.events.v1.subscription.SubscriptionContext - """ if self._context is None: - self._context = SubscriptionContext(self._version, sid=self._solution['sid'], ) + self._context = SubscriptionContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def account_sid(self): - """ - :returns: Account SID. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sid(self): - """ - :returns: A string that uniquely identifies this Subscription. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def date_created(self): - """ - :returns: The date this Subscription was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Subscription was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def description(self): - """ - :returns: Subscription description - :rtype: unicode - """ - return self._properties['description'] - - @property - def sink_sid(self): - """ - :returns: Sink SID. - :rtype: unicode - """ - return self._properties['sink_sid'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] + def subscribed_events(self): + return self._proxy.subscribed_events + - @property - def links(self): - """ - :returns: Nested resource URLs. - :rtype: unicode + def __repr__(self): """ - return self._properties['links'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the SubscriptionInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched SubscriptionInstance - :rtype: twilio.rest.events.v1.subscription.SubscriptionInstance - """ - return self._proxy.fetch() - def update(self, description=values.unset, sink_sid=values.unset): - """ - Update the SubscriptionInstance - :param unicode description: Subscription description. - :param unicode sink_sid: Sink SID. +class SubscriptionListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The updated SubscriptionInstance - :rtype: twilio.rest.events.v1.subscription.SubscriptionInstance - """ - return self._proxy.update(description=description, sink_sid=sink_sid, ) + # Path Solution + self._solution = { } + self._uri = '/Subscriptions' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - def delete(self): - """ - Deletes the SubscriptionInstance + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + return SubscriptionInstance(self._version, payload, ) + + """ + + """ + def page(self, sink_sid, page_size): + + data = values.of({ + 'sink_sid': sink_sid,'page_size': page_size, + }) - @property - def subscribed_events(self): - """ - Access the subscribed_events + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventList - :rtype: twilio.rest.events.v1.subscription.subscribed_event.SubscribedEventList - """ - return self._proxy.subscribed_events + return SubscriptionPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/flex_api/v1/good_data.py b/twilio/rest/flex_api/v1/good_data.py deleted file mode 100644 index 5166810280..0000000000 --- a/twilio/rest/flex_api/v1/good_data.py +++ /dev/null @@ -1,110 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Flex - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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 GoodDataContext(InstanceContext): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Insights/Session' - - - def create(self, token): - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class GoodDataInstance(InstanceResource): - def __init__(self, version, payload): - super().__init__(version) - self._properties = { - 'workspace_id' : payload.get('workspace_id'), - 'session_expiry' : payload.get('session_expiry'), - 'session_id' : payload.get('session_id'), - 'base_url' : payload.get('base_url'), - 'url' : payload.get('url'), - } - - self._context = None - self._solution = { - - } - - @property - def _proxy(self): - if self._context is None: - self._context = GoodDataContext( - self._version, - - ) - return self._context - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class GoodDataListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '' - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/flex_api/v1/interaction.py b/twilio/rest/flex_api/v1/interaction.py deleted file mode 100644 index d43acf8606..0000000000 --- a/twilio/rest/flex_api/v1/interaction.py +++ /dev/null @@ -1,135 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Flex - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.rest.interaction.interaction_channel import InteractionChannelListInstance - - -class InteractionContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Interactions/${sid}' - - self._channels = None - - def fetch(self): - - """ - Fetch the InteractionInstance - - :returns: The fetched InteractionInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return InteractionInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class InteractionInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'channel' : payload.get('channel'), - 'routing' : payload.get('routing'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = InteractionContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def channels(self): - return self._proxy.channels - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class InteractionListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Interactions' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return InteractionInstance(self._version, payload, ) - - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/flex_api/v1/interaction/__init__.py b/twilio/rest/flex_api/v1/interaction/__init__.py index 1d10f9dec8..d43acf8606 100644 --- a/twilio/rest/flex_api/v1/interaction/__init__.py +++ b/twilio/rest/flex_api/v1/interaction/__init__.py @@ -1,280 +1,135 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Flex + 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 twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.flex_api.v1.interaction.interaction_channel import InteractionChannelList - - -class InteractionList(ListResource): - - def __init__(self, version): - """ - Initialize the InteractionList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.flex_api.v1.interaction.InteractionList - :rtype: twilio.rest.flex_api.v1.interaction.InteractionList - """ - super(InteractionList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Interactions'.format(**self._solution) - - def create(self, channel, routing): - """ - Create the InteractionInstance - - :param dict channel: The Interaction's channel - :param dict routing: The Interaction's routing logic - - :returns: The created InteractionInstance - :rtype: twilio.rest.flex_api.v1.interaction.InteractionInstance - """ - data = values.of({'Channel': serialize.object(channel), 'Routing': serialize.object(routing), }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return InteractionInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a InteractionContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.flex_api.v1.interaction.InteractionContext - :rtype: twilio.rest.flex_api.v1.interaction.InteractionContext - """ - return InteractionContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a InteractionContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.flex_api.v1.interaction.InteractionContext - :rtype: twilio.rest.flex_api.v1.interaction.InteractionContext - """ - return InteractionContext(self._version, sid=sid, ) +from twilio.base.version import Version - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class InteractionPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the InteractionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.flex_api.v1.interaction.InteractionPage - :rtype: twilio.rest.flex_api.v1.interaction.InteractionPage - """ - super(InteractionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of InteractionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.flex_api.v1.interaction.InteractionInstance - :rtype: twilio.rest.flex_api.v1.interaction.InteractionInstance - """ - return InteractionInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.interaction.interaction_channel import InteractionChannelListInstance class InteractionContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the InteractionContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.flex_api.v1.interaction.InteractionContext - :rtype: twilio.rest.flex_api.v1.interaction.InteractionContext - """ - super(InteractionContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Interactions/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Interactions/${sid}' + self._channels = None - + def fetch(self): + """ Fetch the InteractionInstance :returns: The fetched InteractionInstance - :rtype: twilio.rest.flex_api.v1.interaction.InteractionInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return InteractionInstance(self._version, payload, sid=self._solution['sid'], ) + - @property - def channels(self): - """ - Access the channels - - :returns: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelList - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelList - """ - if self._channels is None: - self._channels = InteractionChannelList(self._version, interaction_sid=self._solution['sid'], ) - return self._channels + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class InteractionInstance(InstanceResource): - - def __init__(self, version, payload, sid=None): - """ - Initialize the InteractionInstance - :returns: twilio.rest.flex_api.v1.interaction.InteractionInstance - :rtype: twilio.rest.flex_api.v1.interaction.InteractionInstance - """ - super(InteractionInstance, self).__init__(version) - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'channel': payload.get('channel'), - 'routing': payload.get('routing'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class InteractionInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'channel' : payload.get('channel'), + 'routing' : payload.get('routing'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: InteractionContext for this InteractionInstance - :rtype: twilio.rest.flex_api.v1.interaction.InteractionContext - """ if self._context is None: - self._context = InteractionContext(self._version, sid=self._solution['sid'], ) + self._context = InteractionContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def channel(self): - """ - :returns: The Interaction's channel - :rtype: dict - """ - return self._properties['channel'] - - @property - def routing(self): - """ - :returns: A JSON Object representing the routing rules for the Interaction Channel - :rtype: dict - """ - return self._properties['routing'] + def channels(self): + return self._proxy.channels + - @property - def url(self): + def __repr__(self): """ - :returns: The url - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - def fetch(self): - """ - Fetch the InteractionInstance - :returns: The fetched InteractionInstance - :rtype: twilio.rest.flex_api.v1.interaction.InteractionInstance - """ - return self._proxy.fetch() +class InteractionListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - @property - def channels(self): - """ - Access the channels + # Path Solution + self._solution = { } + self._uri = '/Interactions' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelList - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelList - """ - return self._proxy.channels + return InteractionInstance(self._version, payload, ) + + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/flex_api/v1/interaction/interaction_channel.py b/twilio/rest/flex_api/v1/interaction/interaction_channel.py deleted file mode 100644 index c35fe26ce0..0000000000 --- a/twilio/rest/flex_api/v1/interaction/interaction_channel.py +++ /dev/null @@ -1,157 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Flex - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.interaction_channel.interaction_channel_invite import InteractionChannelInviteListInstancefrom twilio.rest.interaction_channel.interaction_channel_participant import InteractionChannelParticipantListInstance - - -class InteractionChannelContext(InstanceContext): - def __init__(self, version: Version, interaction_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'interaction_sid': interaction_sid, 'sid': sid, } - self._uri = '/Interactions/${interaction_sid}/Channels/${sid}' - - self._invites = None - self._participants = None - - def fetch(self): - - """ - Fetch the InteractionChannelInstance - - :returns: The fetched InteractionChannelInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return InteractionChannelInstance(self._version, payload, interaction_sid=self._solution['interaction_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return InteractionChannelInstance(self._version, payload, interaction_sid=self._solution['interaction_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class InteractionChannelInstance(InstanceResource): - def __init__(self, version, payload, interaction_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'interaction_sid' : payload.get('interaction_sid'), - 'type' : payload.get('type'), - 'status' : payload.get('status'), - 'error_code' : payload.get('error_code'), - 'error_message' : payload.get('error_message'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'interaction_sid': interaction_sid or self._properties['interaction_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = InteractionChannelContext( - self._version, - interaction_sid=self._solution['interaction_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def invites(self): - return self._proxy.invites - @property - def participants(self): - return self._proxy.participants - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class InteractionChannelListInstance(ListResource): - def __init__(self, version: Version, interaction_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'interaction_sid': interaction_sid, } - self._uri = '/Interactions/${interaction_sid}/Channels' - - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return InteractionChannelPage(self._version, payload, interaction_sid=self._solution['interaction_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py b/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py index bd54f6ad62..c35fe26ce0 100644 --- a/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py +++ b/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Flex + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,467 +19,139 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.flex_api.v1.interaction.interaction_channel.interaction_channel_invite import InteractionChannelInviteList -from twilio.rest.flex_api.v1.interaction.interaction_channel.interaction_channel_participant import InteractionChannelParticipantList - - -class InteractionChannelList(ListResource): - - def __init__(self, version, interaction_sid): - """ - Initialize the InteractionChannelList - - :param Version version: Version that contains the resource - :param interaction_sid: The unique string that identifies the resource. - - :returns: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelList - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelList - """ - super(InteractionChannelList, self).__init__(version) - - # Path Solution - self._solution = {'interaction_sid': interaction_sid, } - self._uri = '/Interactions/{interaction_sid}/Channels'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams InteractionChannelInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists InteractionChannelInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of InteractionChannelInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of InteractionChannelInstance - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return InteractionChannelPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of InteractionChannelInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of InteractionChannelInstance - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return InteractionChannelPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a InteractionChannelContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelContext - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelContext - """ - return InteractionChannelContext( - self._version, - interaction_sid=self._solution['interaction_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a InteractionChannelContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelContext - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelContext - """ - return InteractionChannelContext( - self._version, - interaction_sid=self._solution['interaction_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class InteractionChannelPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the InteractionChannelPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param interaction_sid: The unique string that identifies the resource. - - :returns: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelPage - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelPage - """ - super(InteractionChannelPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of InteractionChannelInstance +from twilio.base.version import Version - :param dict payload: Payload response from the API - - :returns: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelInstance - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelInstance - """ - return InteractionChannelInstance( - self._version, - payload, - interaction_sid=self._solution['interaction_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.interaction_channel.interaction_channel_invite import InteractionChannelInviteListInstancefrom twilio.rest.interaction_channel.interaction_channel_participant import InteractionChannelParticipantListInstance class InteractionChannelContext(InstanceContext): - - def __init__(self, version, interaction_sid, sid): - """ - Initialize the InteractionChannelContext - - :param Version version: Version that contains the resource - :param interaction_sid: The unique string that identifies the resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelContext - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelContext - """ - super(InteractionChannelContext, self).__init__(version) + def __init__(self, version: Version, interaction_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'interaction_sid': interaction_sid, 'sid': sid, } - self._uri = '/Interactions/{interaction_sid}/Channels/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'interaction_sid': interaction_sid, 'sid': sid, } + self._uri = '/Interactions/${interaction_sid}/Channels/${sid}' + self._invites = None self._participants = None - + def fetch(self): + """ Fetch the InteractionChannelInstance :returns: The fetched InteractionChannelInstance - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return InteractionChannelInstance( - self._version, - payload, - interaction_sid=self._solution['interaction_sid'], - sid=self._solution['sid'], - ) - - def update(self, status, routing=values.unset): - """ - Update the InteractionChannelInstance - - :param InteractionChannelInstance.Status status: Required. The Interaction channels's status - :param dict routing: Optional. The state of associated tasks. - - :returns: The updated InteractionChannelInstance - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelInstance - """ - data = values.of({'Status': status, 'Routing': serialize.object(routing), }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + return InteractionChannelInstance(self._version, payload, interaction_sid=self._solution['interaction_sid'], sid=self._solution['sid'], ) + - return InteractionChannelInstance( - self._version, - payload, - interaction_sid=self._solution['interaction_sid'], - sid=self._solution['sid'], - ) + + + def update(self, body): + data = values.of({ + 'body': body, + }) - @property - def invites(self): - """ - Access the invites + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.flex_api.v1.interaction.interaction_channel.interaction_channel_invite.InteractionChannelInviteList - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.interaction_channel_invite.InteractionChannelInviteList - """ - if self._invites is None: - self._invites = InteractionChannelInviteList( - self._version, - interaction_sid=self._solution['interaction_sid'], - channel_sid=self._solution['sid'], - ) - return self._invites + return InteractionChannelInstance(self._version, payload, interaction_sid=self._solution['interaction_sid'], sid=self._solution['sid'], ) + + - @property - def participants(self): - """ - Access the participants - - :returns: twilio.rest.flex_api.v1.interaction.interaction_channel.interaction_channel_participant.InteractionChannelParticipantList - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.interaction_channel_participant.InteractionChannelParticipantList - """ - if self._participants is None: - self._participants = InteractionChannelParticipantList( - self._version, - interaction_sid=self._solution['interaction_sid'], - channel_sid=self._solution['sid'], - ) - return self._participants + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class InteractionChannelInstance(InstanceResource): - class Status(object): - CLOSED = "closed" - WRAPUP = "wrapup" - class Type(object): - VOICE = "voice" - SMS = "sms" - EMAIL = "email" - WEB = "web" - WHATSAPP = "whatsapp" - CHAT = "chat" - MESSENGER = "messenger" - GBM = "gbm" - - class ChannelStatus(object): - SETUP = "setup" - ACTIVE = "active" - FAILED = "failed" - CLOSED = "closed" - - def __init__(self, version, payload, interaction_sid, sid=None): - """ - Initialize the InteractionChannelInstance - - :returns: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelInstance - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelInstance - """ - super(InteractionChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'interaction_sid': payload.get('interaction_sid'), - 'type': payload.get('type'), - 'status': payload.get('status'), - 'error_code': deserialize.integer(payload.get('error_code')), - 'error_message': payload.get('error_message'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class InteractionChannelInstance(InstanceResource): + def __init__(self, version, payload, interaction_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'interaction_sid' : payload.get('interaction_sid'), + 'type' : payload.get('type'), + 'status' : payload.get('status'), + 'error_code' : payload.get('error_code'), + 'error_message' : payload.get('error_message'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'interaction_sid': interaction_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'interaction_sid': interaction_sid or self._properties['interaction_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: InteractionChannelContext for this InteractionChannelInstance - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelContext - """ if self._context is None: self._context = InteractionChannelContext( self._version, - interaction_sid=self._solution['interaction_sid'], - sid=self._solution['sid'], + interaction_sid=self._solution['interaction_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def interaction_sid(self): - """ - :returns: The unique string that identifies the resource. - :rtype: unicode - """ - return self._properties['interaction_sid'] - - @property - def type(self): - """ - :returns: The Interaction Channel's type. - :rtype: InteractionChannelInstance.Type - """ - return self._properties['type'] - - @property - def status(self): - """ - :returns: The status of this channel. - :rtype: InteractionChannelInstance.ChannelStatus - """ - return self._properties['status'] - - @property - def error_code(self): - """ - :returns: The Twilio error code for a failed channel. - :rtype: unicode - """ - return self._properties['error_code'] - - @property - def error_message(self): - """ - :returns: The error message for a failed channel. - :rtype: unicode - """ - return self._properties['error_message'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - + def invites(self): + return self._proxy.invites @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the InteractionChannelInstance - - :returns: The fetched InteractionChannelInstance - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelInstance - """ - return self._proxy.fetch() + def participants(self): + return self._proxy.participants + - def update(self, status, routing=values.unset): + def __repr__(self): """ - Update the InteractionChannelInstance - - :param InteractionChannelInstance.Status status: Required. The Interaction channels's status - :param dict routing: Optional. The state of associated tasks. - - :returns: The updated InteractionChannelInstance - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.InteractionChannelInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update(status, routing=routing, ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def invites(self): - """ - Access the invites - :returns: twilio.rest.flex_api.v1.interaction.interaction_channel.interaction_channel_invite.InteractionChannelInviteList - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.interaction_channel_invite.InteractionChannelInviteList - """ - return self._proxy.invites - @property - def participants(self): - """ - Access the participants +class InteractionChannelListInstance(ListResource): + def __init__(self, version: Version, interaction_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.flex_api.v1.interaction.interaction_channel.interaction_channel_participant.InteractionChannelParticipantList - :rtype: twilio.rest.flex_api.v1.interaction.interaction_channel.interaction_channel_participant.InteractionChannelParticipantList - """ - return self._proxy.participants + # Path Solution + self._solution = { 'interaction_sid': interaction_sid, } + self._uri = '/Interactions/${interaction_sid}/Channels' + + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return InteractionChannelPage(self._version, payload, interaction_sid=self._solution['interaction_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/flex_api/v1/user_roles.py b/twilio/rest/flex_api/v1/user_roles.py deleted file mode 100644 index 8555ed9a6b..0000000000 --- a/twilio/rest/flex_api/v1/user_roles.py +++ /dev/null @@ -1,116 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Flex - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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 UserRolesContext(InstanceContext): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Insights/UserRoles' - - - def fetch(self, token): - - """ - Fetch the UserRolesInstance - - :returns: The fetched UserRolesInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return UserRolesInstance(self._version, payload, ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class UserRolesInstance(InstanceResource): - def __init__(self, version, payload): - super().__init__(version) - self._properties = { - 'roles' : payload.get('roles'), - 'url' : payload.get('url'), - } - - self._context = None - self._solution = { - - } - - @property - def _proxy(self): - if self._context is None: - self._context = UserRolesContext( - self._version, - - ) - return self._context - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class UserRolesListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '' - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/insights/v1/call.py b/twilio/rest/insights/v1/call.py deleted file mode 100644 index eaa46a210a..0000000000 --- a/twilio/rest/insights/v1/call.py +++ /dev/null @@ -1,133 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Insights - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.rest.call.annotation import AnnotationListInstancefrom twilio.rest.call.call_summary import CallSummaryListInstancefrom twilio.rest.call.event import EventListInstancefrom twilio.rest.call.metric import MetricListInstance - - -class CallContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Voice/${sid}' - - self._annotation = None - self._summary = None - self._events = None - self._metrics = None - - def fetch(self): - - """ - Fetch the CallInstance - - :returns: The fetched CallInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CallInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class CallInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = CallContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def annotation(self): - return self._proxy.annotation - @property - def summary(self): - return self._proxy.summary - @property - def events(self): - return self._proxy.events - @property - def metrics(self): - return self._proxy.metrics - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class CallListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '' - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/insights/v1/call/__init__.py b/twilio/rest/insights/v1/call/__init__.py index 2be278b80e..eaa46a210a 100644 --- a/twilio/rest/insights/v1/call/__init__.py +++ b/twilio/rest/insights/v1/call/__init__.py @@ -1,316 +1,133 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Insights + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.insights.v1.call.annotation import AnnotationList -from twilio.rest.insights.v1.call.event import EventList -from twilio.rest.insights.v1.call.metric import MetricList -from twilio.rest.insights.v1.call.summary import CallSummaryList - +from twilio.base.version import Version -class CallList(ListResource): - - def __init__(self, version): - """ - Initialize the CallList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.insights.v1.call.CallList - :rtype: twilio.rest.insights.v1.call.CallList - """ - super(CallList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, sid): - """ - Constructs a CallContext - - :param sid: The sid - - :returns: twilio.rest.insights.v1.call.CallContext - :rtype: twilio.rest.insights.v1.call.CallContext - """ - return CallContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CallContext - - :param sid: The sid - - :returns: twilio.rest.insights.v1.call.CallContext - :rtype: twilio.rest.insights.v1.call.CallContext - """ - return CallContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CallPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CallPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.insights.v1.call.CallPage - :rtype: twilio.rest.insights.v1.call.CallPage - """ - super(CallPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CallInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.insights.v1.call.CallInstance - :rtype: twilio.rest.insights.v1.call.CallInstance - """ - return CallInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.call.annotation import AnnotationListInstancefrom twilio.rest.call.call_summary import CallSummaryListInstancefrom twilio.rest.call.event import EventListInstancefrom twilio.rest.call.metric import MetricListInstance class CallContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the CallContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.insights.v1.call.CallContext - :rtype: twilio.rest.insights.v1.call.CallContext - """ - super(CallContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Voice/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Voice/${sid}' + + self._annotation = None + self._summary = None self._events = None self._metrics = None - self._summary = None - self._annotation = None - + def fetch(self): + """ Fetch the CallInstance :returns: The fetched CallInstance - :rtype: twilio.rest.insights.v1.call.CallInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return CallInstance(self._version, payload, sid=self._solution['sid'], ) + - @property - def events(self): - """ - Access the events - - :returns: twilio.rest.insights.v1.call.event.EventList - :rtype: twilio.rest.insights.v1.call.event.EventList - """ - if self._events is None: - self._events = EventList(self._version, call_sid=self._solution['sid'], ) - return self._events - - @property - def metrics(self): - """ - Access the metrics - - :returns: twilio.rest.insights.v1.call.metric.MetricList - :rtype: twilio.rest.insights.v1.call.metric.MetricList - """ - if self._metrics is None: - self._metrics = MetricList(self._version, call_sid=self._solution['sid'], ) - return self._metrics - - @property - def summary(self): - """ - Access the summary - - :returns: twilio.rest.insights.v1.call.summary.CallSummaryList - :rtype: twilio.rest.insights.v1.call.summary.CallSummaryList - """ - if self._summary is None: - self._summary = CallSummaryList(self._version, call_sid=self._solution['sid'], ) - return self._summary - - @property - def annotation(self): - """ - Access the annotation - - :returns: twilio.rest.insights.v1.call.annotation.AnnotationList - :rtype: twilio.rest.insights.v1.call.annotation.AnnotationList - """ - if self._annotation is None: - self._annotation = AnnotationList(self._version, call_sid=self._solution['sid'], ) - return self._annotation + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class CallInstance(InstanceResource): - - def __init__(self, version, payload, sid=None): - """ - Initialize the CallInstance - :returns: twilio.rest.insights.v1.call.CallInstance - :rtype: twilio.rest.insights.v1.call.CallInstance - """ - super(CallInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class CallInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CallContext for this CallInstance - :rtype: twilio.rest.insights.v1.call.CallContext - """ if self._context is None: - self._context = CallContext(self._version, sid=self._solution['sid'], ) + self._context = CallContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - + def annotation(self): + return self._proxy.annotation @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the CallInstance - - :returns: The fetched CallInstance - :rtype: twilio.rest.insights.v1.call.CallInstance - """ - return self._proxy.fetch() - + def summary(self): + return self._proxy.summary @property def events(self): - """ - Access the events - - :returns: twilio.rest.insights.v1.call.event.EventList - :rtype: twilio.rest.insights.v1.call.event.EventList - """ return self._proxy.events - @property def metrics(self): - """ - Access the metrics - - :returns: twilio.rest.insights.v1.call.metric.MetricList - :rtype: twilio.rest.insights.v1.call.metric.MetricList - """ return self._proxy.metrics + - @property - def summary(self): + def __repr__(self): """ - Access the summary - - :returns: twilio.rest.insights.v1.call.summary.CallSummaryList - :rtype: twilio.rest.insights.v1.call.summary.CallSummaryList + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.summary + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def annotation(self): - """ - Access the annotation - :returns: twilio.rest.insights.v1.call.annotation.AnnotationList - :rtype: twilio.rest.insights.v1.call.annotation.AnnotationList - """ - return self._proxy.annotation + +class CallListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) + + # Path Solution + self._solution = { } + self._uri = '' + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/insights/v1/call/summary.py b/twilio/rest/insights/v1/call/summary.py deleted file mode 100644 index 71e14797f8..0000000000 --- a/twilio/rest/insights/v1/call/summary.py +++ /dev/null @@ -1,432 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CallSummaryList(ListResource): - - def __init__(self, version, call_sid): - """ - Initialize the CallSummaryList - - :param Version version: Version that contains the resource - :param call_sid: The call_sid - - :returns: twilio.rest.insights.v1.call.summary.CallSummaryList - :rtype: twilio.rest.insights.v1.call.summary.CallSummaryList - """ - super(CallSummaryList, self).__init__(version) - - # Path Solution - self._solution = {'call_sid': call_sid, } - - def get(self): - """ - Constructs a CallSummaryContext - - :returns: twilio.rest.insights.v1.call.summary.CallSummaryContext - :rtype: twilio.rest.insights.v1.call.summary.CallSummaryContext - """ - return CallSummaryContext(self._version, call_sid=self._solution['call_sid'], ) - - def __call__(self): - """ - Constructs a CallSummaryContext - - :returns: twilio.rest.insights.v1.call.summary.CallSummaryContext - :rtype: twilio.rest.insights.v1.call.summary.CallSummaryContext - """ - return CallSummaryContext(self._version, call_sid=self._solution['call_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CallSummaryPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CallSummaryPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param call_sid: The call_sid - - :returns: twilio.rest.insights.v1.call.summary.CallSummaryPage - :rtype: twilio.rest.insights.v1.call.summary.CallSummaryPage - """ - super(CallSummaryPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CallSummaryInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.insights.v1.call.summary.CallSummaryInstance - :rtype: twilio.rest.insights.v1.call.summary.CallSummaryInstance - """ - return CallSummaryInstance(self._version, payload, call_sid=self._solution['call_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CallSummaryContext(InstanceContext): - - def __init__(self, version, call_sid): - """ - Initialize the CallSummaryContext - - :param Version version: Version that contains the resource - :param call_sid: The call_sid - - :returns: twilio.rest.insights.v1.call.summary.CallSummaryContext - :rtype: twilio.rest.insights.v1.call.summary.CallSummaryContext - """ - super(CallSummaryContext, self).__init__(version) - - # Path Solution - self._solution = {'call_sid': call_sid, } - self._uri = '/Voice/{call_sid}/Summary'.format(**self._solution) - - def fetch(self, processing_state=values.unset): - """ - Fetch the CallSummaryInstance - - :param CallSummaryInstance.ProcessingState processing_state: The processing_state - - :returns: The fetched CallSummaryInstance - :rtype: twilio.rest.insights.v1.call.summary.CallSummaryInstance - """ - data = values.of({'ProcessingState': processing_state, }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return CallSummaryInstance(self._version, payload, call_sid=self._solution['call_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class CallSummaryInstance(InstanceResource): - - class AnsweredBy(object): - UNKNOWN = "unknown" - MACHINE_START = "machine_start" - MACHINE_END_BEEP = "machine_end_beep" - MACHINE_END_SILENCE = "machine_end_silence" - MACHINE_END_OTHER = "machine_end_other" - HUMAN = "human" - FAX = "fax" - - class CallType(object): - CARRIER = "carrier" - SIP = "sip" - TRUNKING = "trunking" - CLIENT = "client" - - class CallState(object): - RINGING = "ringing" - COMPLETED = "completed" - BUSY = "busy" - FAIL = "fail" - NOANSWER = "noanswer" - CANCELED = "canceled" - ANSWERED = "answered" - UNDIALED = "undialed" - - class ProcessingState(object): - COMPLETE = "complete" - PARTIAL = "partial" - - def __init__(self, version, payload, call_sid): - """ - Initialize the CallSummaryInstance - - :returns: twilio.rest.insights.v1.call.summary.CallSummaryInstance - :rtype: twilio.rest.insights.v1.call.summary.CallSummaryInstance - """ - super(CallSummaryInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'call_sid': payload.get('call_sid'), - 'call_type': payload.get('call_type'), - 'call_state': payload.get('call_state'), - 'answered_by': payload.get('answered_by'), - 'processing_state': payload.get('processing_state'), - 'created_time': deserialize.iso8601_datetime(payload.get('created_time')), - 'start_time': deserialize.iso8601_datetime(payload.get('start_time')), - 'end_time': deserialize.iso8601_datetime(payload.get('end_time')), - 'duration': deserialize.integer(payload.get('duration')), - 'connect_duration': deserialize.integer(payload.get('connect_duration')), - 'from_': payload.get('from'), - 'to': payload.get('to'), - 'carrier_edge': payload.get('carrier_edge'), - 'client_edge': payload.get('client_edge'), - 'sdk_edge': payload.get('sdk_edge'), - 'sip_edge': payload.get('sip_edge'), - 'tags': payload.get('tags'), - 'url': payload.get('url'), - 'attributes': payload.get('attributes'), - 'properties': payload.get('properties'), - 'trust': payload.get('trust'), - 'annotation': payload.get('annotation'), - } - - # Context - self._context = None - self._solution = {'call_sid': call_sid, } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CallSummaryContext for this CallSummaryInstance - :rtype: twilio.rest.insights.v1.call.summary.CallSummaryContext - """ - if self._context is None: - self._context = CallSummaryContext(self._version, call_sid=self._solution['call_sid'], ) - return self._context - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def call_sid(self): - """ - :returns: The call_sid - :rtype: unicode - """ - return self._properties['call_sid'] - - @property - def call_type(self): - """ - :returns: The call_type - :rtype: CallSummaryInstance.CallType - """ - return self._properties['call_type'] - - @property - def call_state(self): - """ - :returns: The call_state - :rtype: CallSummaryInstance.CallState - """ - return self._properties['call_state'] - - @property - def answered_by(self): - """ - :returns: The answered_by - :rtype: CallSummaryInstance.AnsweredBy - """ - return self._properties['answered_by'] - - @property - def processing_state(self): - """ - :returns: The processing_state - :rtype: CallSummaryInstance.ProcessingState - """ - return self._properties['processing_state'] - - @property - def created_time(self): - """ - :returns: The created_time - :rtype: datetime - """ - return self._properties['created_time'] - - @property - def start_time(self): - """ - :returns: The start_time - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def end_time(self): - """ - :returns: The end_time - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def duration(self): - """ - :returns: The duration - :rtype: unicode - """ - return self._properties['duration'] - - @property - def connect_duration(self): - """ - :returns: The connect_duration - :rtype: unicode - """ - return self._properties['connect_duration'] - - @property - def from_(self): - """ - :returns: The from - :rtype: dict - """ - return self._properties['from_'] - - @property - def to(self): - """ - :returns: The to - :rtype: dict - """ - return self._properties['to'] - - @property - def carrier_edge(self): - """ - :returns: The carrier_edge - :rtype: dict - """ - return self._properties['carrier_edge'] - - @property - def client_edge(self): - """ - :returns: The client_edge - :rtype: dict - """ - return self._properties['client_edge'] - - @property - def sdk_edge(self): - """ - :returns: The sdk_edge - :rtype: dict - """ - return self._properties['sdk_edge'] - - @property - def sip_edge(self): - """ - :returns: The sip_edge - :rtype: dict - """ - return self._properties['sip_edge'] - - @property - def tags(self): - """ - :returns: The tags - :rtype: list[unicode] - """ - return self._properties['tags'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: dict - """ - return self._properties['attributes'] - - @property - def properties(self): - """ - :returns: The properties - :rtype: dict - """ - return self._properties['properties'] - - @property - def trust(self): - """ - :returns: The trust - :rtype: dict - """ - return self._properties['trust'] - - @property - def annotation(self): - """ - :returns: The annotation - :rtype: dict - """ - return self._properties['annotation'] - - def fetch(self, processing_state=values.unset): - """ - Fetch the CallSummaryInstance - - :param CallSummaryInstance.ProcessingState processing_state: The processing_state - - :returns: The fetched CallSummaryInstance - :rtype: twilio.rest.insights.v1.call.summary.CallSummaryInstance - """ - return self._proxy.fetch(processing_state=processing_state, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) diff --git a/twilio/rest/insights/v1/conference.py b/twilio/rest/insights/v1/conference.py deleted file mode 100644 index a6c8bdcb40..0000000000 --- a/twilio/rest/insights/v1/conference.py +++ /dev/null @@ -1,155 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Insights - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.conference.conference_participant import ConferenceParticipantListInstance - - -class ConferenceContext(InstanceContext): - def __init__(self, version: Version, conference_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'conference_sid': conference_sid, } - self._uri = '/Conferences/${conference_sid}' - - self._conference_participants = None - - def fetch(self): - - """ - Fetch the ConferenceInstance - - :returns: The fetched ConferenceInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ConferenceInstance(self._version, payload, conference_sid=self._solution['conference_sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ConferenceInstance(InstanceResource): - def __init__(self, version, payload, conference_sid: str): - super().__init__(version) - self._properties = { - 'conference_sid' : payload.get('conference_sid'), - 'account_sid' : payload.get('account_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'create_time' : payload.get('create_time'), - 'start_time' : payload.get('start_time'), - 'end_time' : payload.get('end_time'), - 'duration_seconds' : payload.get('duration_seconds'), - 'connect_duration_seconds' : payload.get('connect_duration_seconds'), - 'status' : payload.get('status'), - 'max_participants' : payload.get('max_participants'), - 'max_concurrent_participants' : payload.get('max_concurrent_participants'), - 'unique_participants' : payload.get('unique_participants'), - 'end_reason' : payload.get('end_reason'), - 'ended_by' : payload.get('ended_by'), - 'mixer_region' : payload.get('mixer_region'), - 'mixer_region_requested' : payload.get('mixer_region_requested'), - 'recording_enabled' : payload.get('recording_enabled'), - 'detected_issues' : payload.get('detected_issues'), - 'tags' : payload.get('tags'), - 'tag_info' : payload.get('tag_info'), - 'processing_state' : payload.get('processing_state'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'conference_sid': conference_sid or self._properties['conference_sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ConferenceContext( - self._version, - conference_sid=self._solution['conference_sid'], - ) - return self._context - - @property - def conference_participants(self): - return self._proxy.conference_participants - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ConferenceListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Conferences' - - - """ - def page(self, conference_sid, friendly_name, status, created_after, created_before, mixer_region, tags, subaccount, detected_issues, end_reason, page_size): - - data = values.of({ - 'conference_sid': conference_sid,'friendly_name': friendly_name,'status': status,'created_after': created_after,'created_before': created_before,'mixer_region': mixer_region,'tags': tags,'subaccount': subaccount,'detected_issues': detected_issues,'end_reason': end_reason,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ConferencePage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/insights/v1/conference/__init__.py b/twilio/rest/insights/v1/conference/__init__.py index ac3adab64b..a6c8bdcb40 100644 --- a/twilio/rest/insights/v1/conference/__init__.py +++ b/twilio/rest/insights/v1/conference/__init__.py @@ -1,630 +1,155 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Insights + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.insights.v1.conference.conference_participant import ConferenceParticipantList - - -class ConferenceList(ListResource): - - def __init__(self, version): - """ - Initialize the ConferenceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.insights.v1.conference.ConferenceList - :rtype: twilio.rest.insights.v1.conference.ConferenceList - """ - super(ConferenceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Conferences'.format(**self._solution) - - def stream(self, conference_sid=values.unset, friendly_name=values.unset, - status=values.unset, created_after=values.unset, - created_before=values.unset, mixer_region=values.unset, - tags=values.unset, subaccount=values.unset, - detected_issues=values.unset, end_reason=values.unset, limit=None, - page_size=None): - """ - Streams ConferenceInstance 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 unicode conference_sid: The SID of the conference. - :param unicode friendly_name: Custom label for the conference. - :param unicode status: Conference status. - :param unicode created_after: Conferences created after timestamp. - :param unicode created_before: Conferences created before timestamp. - :param unicode mixer_region: Region where the conference was mixed. - :param unicode tags: Tags applied by Twilio for common issues. - :param unicode subaccount: Account SID for the subaccount. - :param unicode detected_issues: Potential issues detected during the conference. - :param unicode end_reason: Conference end reason. - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.insights.v1.conference.ConferenceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - conference_sid=conference_sid, - friendly_name=friendly_name, - status=status, - created_after=created_after, - created_before=created_before, - mixer_region=mixer_region, - tags=tags, - subaccount=subaccount, - detected_issues=detected_issues, - end_reason=end_reason, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, conference_sid=values.unset, friendly_name=values.unset, - status=values.unset, created_after=values.unset, - created_before=values.unset, mixer_region=values.unset, - tags=values.unset, subaccount=values.unset, - detected_issues=values.unset, end_reason=values.unset, limit=None, - page_size=None): - """ - Lists ConferenceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode conference_sid: The SID of the conference. - :param unicode friendly_name: Custom label for the conference. - :param unicode status: Conference status. - :param unicode created_after: Conferences created after timestamp. - :param unicode created_before: Conferences created before timestamp. - :param unicode mixer_region: Region where the conference was mixed. - :param unicode tags: Tags applied by Twilio for common issues. - :param unicode subaccount: Account SID for the subaccount. - :param unicode detected_issues: Potential issues detected during the conference. - :param unicode end_reason: Conference end reason. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.insights.v1.conference.ConferenceInstance] - """ - return list(self.stream( - conference_sid=conference_sid, - friendly_name=friendly_name, - status=status, - created_after=created_after, - created_before=created_before, - mixer_region=mixer_region, - tags=tags, - subaccount=subaccount, - detected_issues=detected_issues, - end_reason=end_reason, - limit=limit, - page_size=page_size, - )) - - def page(self, conference_sid=values.unset, friendly_name=values.unset, - status=values.unset, created_after=values.unset, - created_before=values.unset, mixer_region=values.unset, - tags=values.unset, subaccount=values.unset, - detected_issues=values.unset, end_reason=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ConferenceInstance records from the API. - Request is executed immediately - - :param unicode conference_sid: The SID of the conference. - :param unicode friendly_name: Custom label for the conference. - :param unicode status: Conference status. - :param unicode created_after: Conferences created after timestamp. - :param unicode created_before: Conferences created before timestamp. - :param unicode mixer_region: Region where the conference was mixed. - :param unicode tags: Tags applied by Twilio for common issues. - :param unicode subaccount: Account SID for the subaccount. - :param unicode detected_issues: Potential issues detected during the conference. - :param unicode end_reason: Conference end reason. - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ConferenceInstance - :rtype: twilio.rest.insights.v1.conference.ConferencePage - """ - data = values.of({ - 'ConferenceSid': conference_sid, - 'FriendlyName': friendly_name, - 'Status': status, - 'CreatedAfter': created_after, - 'CreatedBefore': created_before, - 'MixerRegion': mixer_region, - 'Tags': tags, - 'Subaccount': subaccount, - 'DetectedIssues': detected_issues, - 'EndReason': end_reason, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ConferencePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ConferenceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ConferenceInstance - :rtype: twilio.rest.insights.v1.conference.ConferencePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ConferencePage(self._version, response, self._solution) - - def get(self, conference_sid): - """ - Constructs a ConferenceContext - - :param conference_sid: Conference SID. - - :returns: twilio.rest.insights.v1.conference.ConferenceContext - :rtype: twilio.rest.insights.v1.conference.ConferenceContext - """ - return ConferenceContext(self._version, conference_sid=conference_sid, ) - - def __call__(self, conference_sid): - """ - Constructs a ConferenceContext - - :param conference_sid: Conference SID. - - :returns: twilio.rest.insights.v1.conference.ConferenceContext - :rtype: twilio.rest.insights.v1.conference.ConferenceContext - """ - return ConferenceContext(self._version, conference_sid=conference_sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ConferencePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ConferencePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.insights.v1.conference.ConferencePage - :rtype: twilio.rest.insights.v1.conference.ConferencePage - """ - super(ConferencePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ConferenceInstance +from twilio.base.version import Version - :param dict payload: Payload response from the API - - :returns: twilio.rest.insights.v1.conference.ConferenceInstance - :rtype: twilio.rest.insights.v1.conference.ConferenceInstance - """ - return ConferenceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.conference.conference_participant import ConferenceParticipantListInstance class ConferenceContext(InstanceContext): - - def __init__(self, version, conference_sid): - """ - Initialize the ConferenceContext - - :param Version version: Version that contains the resource - :param conference_sid: Conference SID. - - :returns: twilio.rest.insights.v1.conference.ConferenceContext - :rtype: twilio.rest.insights.v1.conference.ConferenceContext - """ - super(ConferenceContext, self).__init__(version) + def __init__(self, version: Version, conference_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'conference_sid': conference_sid, } - self._uri = '/Conferences/{conference_sid}'.format(**self._solution) - - # Dependents + self._solution = { 'conference_sid': conference_sid, } + self._uri = '/Conferences/${conference_sid}' + self._conference_participants = None - + def fetch(self): + """ Fetch the ConferenceInstance :returns: The fetched ConferenceInstance - :rtype: twilio.rest.insights.v1.conference.ConferenceInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return ConferenceInstance(self._version, payload, conference_sid=self._solution['conference_sid'], ) + - @property - def conference_participants(self): - """ - Access the conference_participants - - :returns: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantList - :rtype: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantList - """ - if self._conference_participants is None: - self._conference_participants = ConferenceParticipantList( - self._version, - conference_sid=self._solution['conference_sid'], - ) - return self._conference_participants + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class ConferenceInstance(InstanceResource): - - class ConferenceStatus(object): - IN_PROGRESS = "in_progress" - NOT_STARTED = "not_started" - COMPLETED = "completed" - SUMMARY_TIMEOUT = "summary_timeout" - - class ConferenceEndReason(object): - LAST_PARTICIPANT_LEFT = "last_participant_left" - CONFERENCE_ENDED_VIA_API = "conference_ended_via_api" - PARTICIPANT_WITH_END_CONFERENCE_ON_EXIT_LEFT = "participant_with_end_conference_on_exit_left" - LAST_PARTICIPANT_KICKED = "last_participant_kicked" - PARTICIPANT_WITH_END_CONFERENCE_ON_EXIT_KICKED = "participant_with_end_conference_on_exit_kicked" - - class Region(object): - US1 = "us1" - AU1 = "au1" - BR1 = "br1" - IE1 = "ie1" - JP1 = "jp1" - SG1 = "sg1" - DE1 = "de1" - - class Tag(object): - INVALID_REQUESTED_REGION = "invalid_requested_region" - DUPLICATE_IDENTITY = "duplicate_identity" - START_FAILURE = "start_failure" - REGION_CONFIGURATION_ISSUES = "region_configuration_issues" - QUALITY_WARNINGS = "quality_warnings" - PARTICIPANT_BEHAVIOR_ISSUES = "participant_behavior_issues" - HIGH_PACKET_LOSS = "high_packet_loss" - HIGH_JITTER = "high_jitter" - HIGH_LATENCY = "high_latency" - LOW_MOS = "low_mos" - DETECTED_SILENCE = "detected_silence" - - class ProcessingState(object): - COMPLETE = "complete" - IN_PROGRESS = "in_progress" - TIMEOUT = "timeout" - - def __init__(self, version, payload, conference_sid=None): - """ - Initialize the ConferenceInstance - :returns: twilio.rest.insights.v1.conference.ConferenceInstance - :rtype: twilio.rest.insights.v1.conference.ConferenceInstance - """ - super(ConferenceInstance, self).__init__(version) - # Marshaled Properties - self._properties = { - 'conference_sid': payload.get('conference_sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'create_time': deserialize.iso8601_datetime(payload.get('create_time')), - 'start_time': deserialize.iso8601_datetime(payload.get('start_time')), - 'end_time': deserialize.iso8601_datetime(payload.get('end_time')), - 'duration_seconds': deserialize.integer(payload.get('duration_seconds')), - 'connect_duration_seconds': deserialize.integer(payload.get('connect_duration_seconds')), - 'status': payload.get('status'), - 'max_participants': deserialize.integer(payload.get('max_participants')), - 'max_concurrent_participants': deserialize.integer(payload.get('max_concurrent_participants')), - 'unique_participants': deserialize.integer(payload.get('unique_participants')), - 'end_reason': payload.get('end_reason'), - 'ended_by': payload.get('ended_by'), - 'mixer_region': payload.get('mixer_region'), - 'mixer_region_requested': payload.get('mixer_region_requested'), - 'recording_enabled': payload.get('recording_enabled'), - 'detected_issues': payload.get('detected_issues'), - 'tags': payload.get('tags'), - 'tag_info': payload.get('tag_info'), - 'processing_state': payload.get('processing_state'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ConferenceInstance(InstanceResource): + def __init__(self, version, payload, conference_sid: str): + super().__init__(version) + self._properties = { + 'conference_sid' : payload.get('conference_sid'), + 'account_sid' : payload.get('account_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'create_time' : payload.get('create_time'), + 'start_time' : payload.get('start_time'), + 'end_time' : payload.get('end_time'), + 'duration_seconds' : payload.get('duration_seconds'), + 'connect_duration_seconds' : payload.get('connect_duration_seconds'), + 'status' : payload.get('status'), + 'max_participants' : payload.get('max_participants'), + 'max_concurrent_participants' : payload.get('max_concurrent_participants'), + 'unique_participants' : payload.get('unique_participants'), + 'end_reason' : payload.get('end_reason'), + 'ended_by' : payload.get('ended_by'), + 'mixer_region' : payload.get('mixer_region'), + 'mixer_region_requested' : payload.get('mixer_region_requested'), + 'recording_enabled' : payload.get('recording_enabled'), + 'detected_issues' : payload.get('detected_issues'), + 'tags' : payload.get('tags'), + 'tag_info' : payload.get('tag_info'), + 'processing_state' : payload.get('processing_state'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'conference_sid': conference_sid or self._properties['conference_sid'], } + self._solution = { + 'conference_sid': conference_sid or self._properties['conference_sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ConferenceContext for this ConferenceInstance - :rtype: twilio.rest.insights.v1.conference.ConferenceContext - """ if self._context is None: - self._context = ConferenceContext(self._version, conference_sid=self._solution['conference_sid'], ) + self._context = ConferenceContext( + self._version, + conference_sid=self._solution['conference_sid'], + ) return self._context @property - def conference_sid(self): - """ - :returns: Conference SID. - :rtype: unicode - """ - return self._properties['conference_sid'] - - @property - def account_sid(self): - """ - :returns: Account SID. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: Custom label for the conference. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def create_time(self): - """ - :returns: Conference creation date/time. - :rtype: datetime - """ - return self._properties['create_time'] - - @property - def start_time(self): - """ - :returns: Timestamp in ISO 8601 format when the conference started. - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def end_time(self): - """ - :returns: Conference end date/time. - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def duration_seconds(self): - """ - :returns: Conference duration in seconds. - :rtype: unicode - """ - return self._properties['duration_seconds'] - - @property - def connect_duration_seconds(self): - """ - :returns: Duration of the conference in seconds. - :rtype: unicode - """ - return self._properties['connect_duration_seconds'] - - @property - def status(self): - """ - :returns: Status of conference - :rtype: ConferenceInstance.ConferenceStatus - """ - return self._properties['status'] - - @property - def max_participants(self): - """ - :returns: Max participants specified in config. - :rtype: unicode - """ - return self._properties['max_participants'] - - @property - def max_concurrent_participants(self): - """ - :returns: Actual maximum concurrent participants. - :rtype: unicode - """ - return self._properties['max_concurrent_participants'] - - @property - def unique_participants(self): - """ - :returns: Unique conference participants. - :rtype: unicode - """ - return self._properties['unique_participants'] - - @property - def end_reason(self): - """ - :returns: Conference end reason. - :rtype: ConferenceInstance.ConferenceEndReason - """ - return self._properties['end_reason'] - - @property - def ended_by(self): - """ - :returns: Call SID that ended the conference. - :rtype: unicode - """ - return self._properties['ended_by'] - - @property - def mixer_region(self): - """ - :returns: Region where the conference was mixed. - :rtype: ConferenceInstance.Region - """ - return self._properties['mixer_region'] - - @property - def mixer_region_requested(self): - """ - :returns: Configuration-requested conference mixer region. - :rtype: ConferenceInstance.Region - """ - return self._properties['mixer_region_requested'] - - @property - def recording_enabled(self): - """ - :returns: Boolean. Indicates whether recording was enabled. - :rtype: bool - """ - return self._properties['recording_enabled'] - - @property - def detected_issues(self): - """ - :returns: Potential issues detected during the conference. - :rtype: dict - """ - return self._properties['detected_issues'] - - @property - def tags(self): - """ - :returns: Tags for detected conference conditions and participant behaviors. - :rtype: list[ConferenceInstance.Tag] - """ - return self._properties['tags'] - - @property - def tag_info(self): - """ - :returns: Object. Contains details about conference tags. - :rtype: dict - """ - return self._properties['tag_info'] + def conference_participants(self): + return self._proxy.conference_participants + - @property - def processing_state(self): + def __repr__(self): """ - :returns: Processing state for the Conference Summary resource. - :rtype: ConferenceInstance.ProcessingState + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['processing_state'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - @property - def links(self): - """ - :returns: Nested resource URLs. - :rtype: unicode - """ - return self._properties['links'] - def fetch(self): - """ - Fetch the ConferenceInstance +class ConferenceListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The fetched ConferenceInstance - :rtype: twilio.rest.insights.v1.conference.ConferenceInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '/Conferences' + + + """ + def page(self, conference_sid, friendly_name, status, created_after, created_before, mixer_region, tags, subaccount, detected_issues, end_reason, page_size): + + data = values.of({ + 'conference_sid': conference_sid,'friendly_name': friendly_name,'status': status,'created_after': created_after,'created_before': created_before,'mixer_region': mixer_region,'tags': tags,'subaccount': subaccount,'detected_issues': detected_issues,'end_reason': end_reason,'page_size': page_size, + }) - @property - def conference_participants(self): - """ - Access the conference_participants + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantList - :rtype: twilio.rest.insights.v1.conference.conference_participant.ConferenceParticipantList - """ - return self._proxy.conference_participants + return ConferencePage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/insights/v1/room.py b/twilio/rest/insights/v1/room.py deleted file mode 100644 index 50b6ed1b80..0000000000 --- a/twilio/rest/insights/v1/room.py +++ /dev/null @@ -1,158 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Insights - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.room.participant import ParticipantListInstance - - -class RoomContext(InstanceContext): - def __init__(self, version: Version, room_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'room_sid': room_sid, } - self._uri = '/Video/Rooms/${room_sid}' - - self._participants = None - - def fetch(self): - - """ - Fetch the RoomInstance - - :returns: The fetched RoomInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return RoomInstance(self._version, payload, room_sid=self._solution['room_sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class RoomInstance(InstanceResource): - def __init__(self, version, payload, room_sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'room_sid' : payload.get('room_sid'), - 'room_name' : payload.get('room_name'), - 'create_time' : payload.get('create_time'), - 'end_time' : payload.get('end_time'), - 'room_type' : payload.get('room_type'), - 'room_status' : payload.get('room_status'), - 'status_callback' : payload.get('status_callback'), - 'status_callback_method' : payload.get('status_callback_method'), - 'created_method' : payload.get('created_method'), - 'end_reason' : payload.get('end_reason'), - 'max_participants' : payload.get('max_participants'), - 'unique_participants' : payload.get('unique_participants'), - 'unique_participant_identities' : payload.get('unique_participant_identities'), - 'concurrent_participants' : payload.get('concurrent_participants'), - 'max_concurrent_participants' : payload.get('max_concurrent_participants'), - 'codecs' : payload.get('codecs'), - 'media_region' : payload.get('media_region'), - 'duration_sec' : payload.get('duration_sec'), - 'total_participant_duration_sec' : payload.get('total_participant_duration_sec'), - 'total_recording_duration_sec' : payload.get('total_recording_duration_sec'), - 'processing_state' : payload.get('processing_state'), - 'recording_enabled' : payload.get('recording_enabled'), - 'edge_location' : payload.get('edge_location'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'room_sid': room_sid or self._properties['room_sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = RoomContext( - self._version, - room_sid=self._solution['room_sid'], - ) - return self._context - - @property - def participants(self): - return self._proxy.participants - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class RoomListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Video/Rooms' - - - """ - def page(self, room_type, codec, room_name, created_after, created_before, page_size): - - data = values.of({ - 'room_type': room_type,'codec': codec,'room_name': room_name,'created_after': created_after,'created_before': created_before,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return RoomPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/insights/v1/room/__init__.py b/twilio/rest/insights/v1/room/__init__.py index 974239fc5e..50b6ed1b80 100644 --- a/twilio/rest/insights/v1/room/__init__.py +++ b/twilio/rest/insights/v1/room/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Insights + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,624 +19,140 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.insights.v1.room.participant import ParticipantList - - -class RoomList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the RoomList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.insights.v1.room.RoomList - :rtype: twilio.rest.insights.v1.room.RoomList - """ - super(RoomList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Video/Rooms'.format(**self._solution) - - def stream(self, room_type=values.unset, codec=values.unset, - room_name=values.unset, created_after=values.unset, - created_before=values.unset, limit=None, page_size=None): - """ - Streams RoomInstance 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 list[RoomInstance.RoomType] room_type: Type of room. - :param list[RoomInstance.Codec] codec: Codecs used by participants in the room. - :param unicode room_name: Room friendly name. - :param datetime created_after: Only read rooms that started on or after this ISO 8601 timestamp. - :param datetime created_before: Only read rooms that started before this ISO 8601 timestamp. - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.insights.v1.room.RoomInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - room_type=room_type, - codec=codec, - room_name=room_name, - created_after=created_after, - created_before=created_before, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, room_type=values.unset, codec=values.unset, - room_name=values.unset, created_after=values.unset, - created_before=values.unset, limit=None, page_size=None): - """ - Lists RoomInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param list[RoomInstance.RoomType] room_type: Type of room. - :param list[RoomInstance.Codec] codec: Codecs used by participants in the room. - :param unicode room_name: Room friendly name. - :param datetime created_after: Only read rooms that started on or after this ISO 8601 timestamp. - :param datetime created_before: Only read rooms that started before this ISO 8601 timestamp. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.insights.v1.room.RoomInstance] - """ - return list(self.stream( - room_type=room_type, - codec=codec, - room_name=room_name, - created_after=created_after, - created_before=created_before, - limit=limit, - page_size=page_size, - )) - - def page(self, room_type=values.unset, codec=values.unset, - room_name=values.unset, created_after=values.unset, - created_before=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of RoomInstance records from the API. - Request is executed immediately - - :param list[RoomInstance.RoomType] room_type: Type of room. - :param list[RoomInstance.Codec] codec: Codecs used by participants in the room. - :param unicode room_name: Room friendly name. - :param datetime created_after: Only read rooms that started on or after this ISO 8601 timestamp. - :param datetime created_before: Only read rooms that started before this ISO 8601 timestamp. - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RoomInstance - :rtype: twilio.rest.insights.v1.room.RoomPage - """ - data = values.of({ - 'RoomType': serialize.map(room_type, lambda e: e), - 'Codec': serialize.map(codec, lambda e: e), - 'RoomName': room_name, - 'CreatedAfter': serialize.iso8601_datetime(created_after), - 'CreatedBefore': serialize.iso8601_datetime(created_before), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return RoomPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RoomInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RoomInstance - :rtype: twilio.rest.insights.v1.room.RoomPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RoomPage(self._version, response, self._solution) - - def get(self, room_sid): - """ - Constructs a RoomContext - - :param room_sid: The SID of the Room resource. - - :returns: twilio.rest.insights.v1.room.RoomContext - :rtype: twilio.rest.insights.v1.room.RoomContext - """ - return RoomContext(self._version, room_sid=room_sid, ) - - def __call__(self, room_sid): - """ - Constructs a RoomContext - - :param room_sid: The SID of the Room resource. - - :returns: twilio.rest.insights.v1.room.RoomContext - :rtype: twilio.rest.insights.v1.room.RoomContext - """ - return RoomContext(self._version, room_sid=room_sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RoomPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the RoomPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.insights.v1.room.RoomPage - :rtype: twilio.rest.insights.v1.room.RoomPage - """ - super(RoomPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RoomInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.insights.v1.room.RoomInstance - :rtype: twilio.rest.insights.v1.room.RoomInstance - """ - return RoomInstance(self._version, payload, ) +from twilio.base.version import Version - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.room.participant import ParticipantListInstance class RoomContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, room_sid): - """ - Initialize the RoomContext - - :param Version version: Version that contains the resource - :param room_sid: The SID of the Room resource. - - :returns: twilio.rest.insights.v1.room.RoomContext - :rtype: twilio.rest.insights.v1.room.RoomContext - """ - super(RoomContext, self).__init__(version) + def __init__(self, version: Version, room_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'room_sid': room_sid, } - self._uri = '/Video/Rooms/{room_sid}'.format(**self._solution) - - # Dependents + self._solution = { 'room_sid': room_sid, } + self._uri = '/Video/Rooms/${room_sid}' + self._participants = None - + def fetch(self): + """ Fetch the RoomInstance :returns: The fetched RoomInstance - :rtype: twilio.rest.insights.v1.room.RoomInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return RoomInstance(self._version, payload, room_sid=self._solution['room_sid'], ) + - @property - def participants(self): - """ - Access the participants - - :returns: twilio.rest.insights.v1.room.participant.ParticipantList - :rtype: twilio.rest.insights.v1.room.participant.ParticipantList - """ - if self._participants is None: - self._participants = ParticipantList(self._version, room_sid=self._solution['room_sid'], ) - return self._participants + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class RoomInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class RoomType(object): - GO = "go" - PEER_TO_PEER = "peer_to_peer" - GROUP = "group" - GROUP_SMALL = "group_small" - - class RoomStatus(object): - IN_PROGRESS = "in_progress" - COMPLETED = "completed" - - class CreatedMethod(object): - SDK = "sdk" - AD_HOC = "ad_hoc" - API = "api" - - class EndReason(object): - ROOM_ENDED_VIA_API = "room_ended_via_api" - TIMEOUT = "timeout" - - class Codec(object): - VP8 = "VP8" - H264 = "H264" - VP9 = "VP9" + return '' - class TwilioRealm(object): - US1 = "us1" - US2 = "us2" - AU1 = "au1" - BR1 = "br1" - IE1 = "ie1" - JP1 = "jp1" - SG1 = "sg1" - IN1 = "in1" - DE1 = "de1" - GLL = "gll" - class ProcessingState(object): - COMPLETE = "complete" - IN_PROGRESS = "in_progress" - class EdgeLocation(object): - ASHBURN = "ashburn" - DUBLIN = "dublin" - FRANKFURT = "frankfurt" - SINGAPORE = "singapore" - SYDNEY = "sydney" - SAO_PAULO = "sao_paulo" - ROAMING = "roaming" - UMATILLA = "umatilla" - TOKYO = "tokyo" - - def __init__(self, version, payload, room_sid=None): - """ - Initialize the RoomInstance - - :returns: twilio.rest.insights.v1.room.RoomInstance - :rtype: twilio.rest.insights.v1.room.RoomInstance - """ - super(RoomInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'room_sid': payload.get('room_sid'), - 'room_name': payload.get('room_name'), - 'create_time': deserialize.iso8601_datetime(payload.get('create_time')), - 'end_time': deserialize.iso8601_datetime(payload.get('end_time')), - 'room_type': payload.get('room_type'), - 'room_status': payload.get('room_status'), - 'status_callback': payload.get('status_callback'), - 'status_callback_method': payload.get('status_callback_method'), - 'created_method': payload.get('created_method'), - 'end_reason': payload.get('end_reason'), - 'max_participants': deserialize.integer(payload.get('max_participants')), - 'unique_participants': deserialize.integer(payload.get('unique_participants')), - 'unique_participant_identities': deserialize.integer(payload.get('unique_participant_identities')), - 'concurrent_participants': deserialize.integer(payload.get('concurrent_participants')), - 'max_concurrent_participants': deserialize.integer(payload.get('max_concurrent_participants')), - 'codecs': payload.get('codecs'), - 'media_region': payload.get('media_region'), - 'duration_sec': deserialize.integer(payload.get('duration_sec')), - 'total_participant_duration_sec': deserialize.integer(payload.get('total_participant_duration_sec')), - 'total_recording_duration_sec': deserialize.integer(payload.get('total_recording_duration_sec')), - 'processing_state': payload.get('processing_state'), - 'recording_enabled': payload.get('recording_enabled'), - 'edge_location': payload.get('edge_location'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class RoomInstance(InstanceResource): + def __init__(self, version, payload, room_sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'room_sid' : payload.get('room_sid'), + 'room_name' : payload.get('room_name'), + 'create_time' : payload.get('create_time'), + 'end_time' : payload.get('end_time'), + 'room_type' : payload.get('room_type'), + 'room_status' : payload.get('room_status'), + 'status_callback' : payload.get('status_callback'), + 'status_callback_method' : payload.get('status_callback_method'), + 'created_method' : payload.get('created_method'), + 'end_reason' : payload.get('end_reason'), + 'max_participants' : payload.get('max_participants'), + 'unique_participants' : payload.get('unique_participants'), + 'unique_participant_identities' : payload.get('unique_participant_identities'), + 'concurrent_participants' : payload.get('concurrent_participants'), + 'max_concurrent_participants' : payload.get('max_concurrent_participants'), + 'codecs' : payload.get('codecs'), + 'media_region' : payload.get('media_region'), + 'duration_sec' : payload.get('duration_sec'), + 'total_participant_duration_sec' : payload.get('total_participant_duration_sec'), + 'total_recording_duration_sec' : payload.get('total_recording_duration_sec'), + 'processing_state' : payload.get('processing_state'), + 'recording_enabled' : payload.get('recording_enabled'), + 'edge_location' : payload.get('edge_location'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'room_sid': room_sid or self._properties['room_sid'], } + self._solution = { + 'room_sid': room_sid or self._properties['room_sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RoomContext for this RoomInstance - :rtype: twilio.rest.insights.v1.room.RoomContext - """ if self._context is None: - self._context = RoomContext(self._version, room_sid=self._solution['room_sid'], ) + self._context = RoomContext( + self._version, + room_sid=self._solution['room_sid'], + ) return self._context @property - def account_sid(self): - """ - :returns: Account SID associated with this room. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def room_sid(self): - """ - :returns: Unique identifier for the room. - :rtype: unicode - """ - return self._properties['room_sid'] - - @property - def room_name(self): - """ - :returns: room friendly name. - :rtype: unicode - """ - return self._properties['room_name'] - - @property - def create_time(self): - """ - :returns: Creation time of the room. - :rtype: datetime - """ - return self._properties['create_time'] - - @property - def end_time(self): - """ - :returns: End time for the room. - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def room_type(self): - """ - :returns: Type of room. - :rtype: RoomInstance.RoomType - """ - return self._properties['room_type'] - - @property - def room_status(self): - """ - :returns: Status of the room. - :rtype: RoomInstance.RoomStatus - """ - return self._properties['room_status'] - - @property - def status_callback(self): - """ - :returns: Webhook provided for status callbacks. - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: HTTP method provided for status callback URL. - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def created_method(self): - """ - :returns: How the room was created. - :rtype: RoomInstance.CreatedMethod - """ - return self._properties['created_method'] - - @property - def end_reason(self): - """ - :returns: Reason the room ended. - :rtype: RoomInstance.EndReason - """ - return self._properties['end_reason'] - - @property - def max_participants(self): - """ - :returns: Max number of total participants allowed by the application settings. - :rtype: unicode - """ - return self._properties['max_participants'] - - @property - def unique_participants(self): - """ - :returns: Number of participants. May include duplicate identities for participants who left and rejoined. - :rtype: unicode - """ - return self._properties['unique_participants'] - - @property - def unique_participant_identities(self): - """ - :returns: Unique number of participant identities. - :rtype: unicode - """ - return self._properties['unique_participant_identities'] - - @property - def concurrent_participants(self): - """ - :returns: Actual number of concurrent participants. - :rtype: unicode - """ - return self._properties['concurrent_participants'] - - @property - def max_concurrent_participants(self): - """ - :returns: Maximum number of participants allowed in the room at the same time allowed by the application settings. - :rtype: unicode - """ - return self._properties['max_concurrent_participants'] - - @property - def codecs(self): - """ - :returns: Codecs used by participants in the room. - :rtype: list[RoomInstance.Codec] - """ - return self._properties['codecs'] - - @property - def media_region(self): - """ - :returns: Region of Twilio media servers for the room. - :rtype: RoomInstance.TwilioRealm - """ - return self._properties['media_region'] - - @property - def duration_sec(self): - """ - :returns: Total room duration from create time to end time. - :rtype: unicode - """ - return self._properties['duration_sec'] - - @property - def total_participant_duration_sec(self): - """ - :returns: Combined amount of participant time in the room. - :rtype: unicode - """ - return self._properties['total_participant_duration_sec'] - - @property - def total_recording_duration_sec(self): - """ - :returns: Combined amount of recorded seconds for participants in the room. - :rtype: unicode - """ - return self._properties['total_recording_duration_sec'] - - @property - def processing_state(self): - """ - :returns: Video Log Analyzer resource state. Will be either `in-progress` or `complete`. - :rtype: RoomInstance.ProcessingState - """ - return self._properties['processing_state'] - - @property - def recording_enabled(self): - """ - :returns: Boolean indicating if recording is enabled for the room. - :rtype: bool - """ - return self._properties['recording_enabled'] + def participants(self): + return self._proxy.participants + - @property - def edge_location(self): + def __repr__(self): """ - :returns: Edge location of Twilio media servers for the room. - :rtype: RoomInstance.EdgeLocation + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['edge_location'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: URL for the room resource. - :rtype: unicode - """ - return self._properties['url'] - @property - def links(self): - """ - :returns: Room subresources. - :rtype: unicode - """ - return self._properties['links'] - def fetch(self): - """ - Fetch the RoomInstance +class RoomListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The fetched RoomInstance - :rtype: twilio.rest.insights.v1.room.RoomInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '/Video/Rooms' + + + """ + def page(self, room_type, codec, room_name, created_after, created_before, page_size): + + data = values.of({ + 'room_type': room_type,'codec': codec,'room_name': room_name,'created_after': created_after,'created_before': created_before,'page_size': page_size, + }) - @property - def participants(self): - """ - Access the participants + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.insights.v1.room.participant.ParticipantList - :rtype: twilio.rest.insights.v1.room.participant.ParticipantList - """ - return self._proxy.participants + return RoomPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/ip_messaging/v1/service.py b/twilio/rest/ip_messaging/v1/service.py deleted file mode 100644 index 2d2a8f947b..0000000000 --- a/twilio/rest/ip_messaging/v1/service.py +++ /dev/null @@ -1,198 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Ip_messaging - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.service.channel import ChannelListInstancefrom twilio.rest.service.role import RoleListInstancefrom twilio.rest.service.user import UserListInstance - - -class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Services/${sid}' - - self._channels = None - self._roles = None - self._users = None - - def delete(self): - - - - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'default_service_role_sid' : payload.get('default_service_role_sid'), - 'default_channel_role_sid' : payload.get('default_channel_role_sid'), - 'default_channel_creator_role_sid' : payload.get('default_channel_creator_role_sid'), - 'read_status_enabled' : payload.get('read_status_enabled'), - 'reachability_enabled' : payload.get('reachability_enabled'), - 'typing_indicator_timeout' : payload.get('typing_indicator_timeout'), - 'consumption_report_interval' : payload.get('consumption_report_interval'), - 'limits' : payload.get('limits'), - 'webhooks' : payload.get('webhooks'), - 'pre_webhook_url' : payload.get('pre_webhook_url'), - 'post_webhook_url' : payload.get('post_webhook_url'), - 'webhook_method' : payload.get('webhook_method'), - 'webhook_filters' : payload.get('webhook_filters'), - 'notifications' : payload.get('notifications'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ServiceContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def channels(self): - return self._proxy.channels - @property - def roles(self): - return self._proxy.roles - @property - def users(self): - return self._proxy.users - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ServiceListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Services' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ServicePage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/ip_messaging/v1/service/__init__.py b/twilio/rest/ip_messaging/v1/service/__init__.py index 621fe59f98..2d2a8f947b 100644 --- a/twilio/rest/ip_messaging/v1/service/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,898 +19,180 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.ip_messaging.v1.service.channel import ChannelList -from twilio.rest.ip_messaging.v1.service.role import RoleList -from twilio.rest.ip_messaging.v1.service.user import UserList - - -class ServiceList(ListResource): - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.ip_messaging.v1.service.ServiceList - :rtype: twilio.rest.ip_messaging.v1.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def create(self, friendly_name): - """ - Create the ServiceInstance - - :param unicode friendly_name: The friendly_name +from twilio.base.version import Version - :returns: The created ServiceInstance - :rtype: twilio.rest.ip_messaging.v1.service.ServiceInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.ip_messaging.v1.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.ip_messaging.v1.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.ip_messaging.v1.service.ServicePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.ip_messaging.v1.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.ip_messaging.v1.service.ServiceContext - :rtype: twilio.rest.ip_messaging.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.ip_messaging.v1.service.ServiceContext - :rtype: twilio.rest.ip_messaging.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ServicePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.ip_messaging.v1.service.ServicePage - :rtype: twilio.rest.ip_messaging.v1.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.ip_messaging.v1.service.ServiceInstance - :rtype: twilio.rest.ip_messaging.v1.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.service.channel import ChannelListInstancefrom twilio.rest.service.role import RoleListInstancefrom twilio.rest.service.user import UserListInstance class ServiceContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.ip_messaging.v1.service.ServiceContext - :rtype: twilio.rest.ip_messaging.v1.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Services/${sid}' + self._channels = None self._roles = None self._users = None + + def delete(self): + + + + """ + Deletes the ServiceInstance + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the ServiceInstance :returns: The fetched ServiceInstance - :rtype: twilio.rest.ip_messaging.v1.service.ServiceInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, friendly_name=values.unset, - default_service_role_sid=values.unset, - default_channel_role_sid=values.unset, - default_channel_creator_role_sid=values.unset, - read_status_enabled=values.unset, reachability_enabled=values.unset, - typing_indicator_timeout=values.unset, - consumption_report_interval=values.unset, - notifications_new_message_enabled=values.unset, - notifications_new_message_template=values.unset, - notifications_added_to_channel_enabled=values.unset, - notifications_added_to_channel_template=values.unset, - notifications_removed_from_channel_enabled=values.unset, - notifications_removed_from_channel_template=values.unset, - notifications_invited_to_channel_enabled=values.unset, - notifications_invited_to_channel_template=values.unset, - pre_webhook_url=values.unset, post_webhook_url=values.unset, - webhook_method=values.unset, webhook_filters=values.unset, - webhooks_on_message_send_url=values.unset, - webhooks_on_message_send_method=values.unset, - webhooks_on_message_update_url=values.unset, - webhooks_on_message_update_method=values.unset, - webhooks_on_message_remove_url=values.unset, - webhooks_on_message_remove_method=values.unset, - webhooks_on_channel_add_url=values.unset, - webhooks_on_channel_add_method=values.unset, - webhooks_on_channel_destroy_url=values.unset, - webhooks_on_channel_destroy_method=values.unset, - webhooks_on_channel_update_url=values.unset, - webhooks_on_channel_update_method=values.unset, - webhooks_on_member_add_url=values.unset, - webhooks_on_member_add_method=values.unset, - webhooks_on_member_remove_url=values.unset, - webhooks_on_member_remove_method=values.unset, - webhooks_on_message_sent_url=values.unset, - webhooks_on_message_sent_method=values.unset, - webhooks_on_message_updated_url=values.unset, - webhooks_on_message_updated_method=values.unset, - webhooks_on_message_removed_url=values.unset, - webhooks_on_message_removed_method=values.unset, - webhooks_on_channel_added_url=values.unset, - webhooks_on_channel_added_method=values.unset, - webhooks_on_channel_destroyed_url=values.unset, - webhooks_on_channel_destroyed_method=values.unset, - webhooks_on_channel_updated_url=values.unset, - webhooks_on_channel_updated_method=values.unset, - webhooks_on_member_added_url=values.unset, - webhooks_on_member_added_method=values.unset, - webhooks_on_member_removed_url=values.unset, - webhooks_on_member_removed_method=values.unset, - limits_channel_members=values.unset, - limits_user_channels=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode default_service_role_sid: The default_service_role_sid - :param unicode default_channel_role_sid: The default_channel_role_sid - :param unicode default_channel_creator_role_sid: The default_channel_creator_role_sid - :param bool read_status_enabled: The read_status_enabled - :param bool reachability_enabled: The reachability_enabled - :param unicode typing_indicator_timeout: The typing_indicator_timeout - :param unicode consumption_report_interval: The consumption_report_interval - :param bool notifications_new_message_enabled: The notifications.new_message.enabled - :param unicode notifications_new_message_template: The notifications.new_message.template - :param bool notifications_added_to_channel_enabled: The notifications.added_to_channel.enabled - :param unicode notifications_added_to_channel_template: The notifications.added_to_channel.template - :param bool notifications_removed_from_channel_enabled: The notifications.removed_from_channel.enabled - :param unicode notifications_removed_from_channel_template: The notifications.removed_from_channel.template - :param bool notifications_invited_to_channel_enabled: The notifications.invited_to_channel.enabled - :param unicode notifications_invited_to_channel_template: The notifications.invited_to_channel.template - :param unicode pre_webhook_url: The pre_webhook_url - :param unicode post_webhook_url: The post_webhook_url - :param unicode webhook_method: The webhook_method - :param list[unicode] webhook_filters: The webhook_filters - :param unicode webhooks_on_message_send_url: The webhooks.on_message_send.url - :param unicode webhooks_on_message_send_method: The webhooks.on_message_send.method - :param unicode webhooks_on_message_update_url: The webhooks.on_message_update.url - :param unicode webhooks_on_message_update_method: The webhooks.on_message_update.method - :param unicode webhooks_on_message_remove_url: The webhooks.on_message_remove.url - :param unicode webhooks_on_message_remove_method: The webhooks.on_message_remove.method - :param unicode webhooks_on_channel_add_url: The webhooks.on_channel_add.url - :param unicode webhooks_on_channel_add_method: The webhooks.on_channel_add.method - :param unicode webhooks_on_channel_destroy_url: The webhooks.on_channel_destroy.url - :param unicode webhooks_on_channel_destroy_method: The webhooks.on_channel_destroy.method - :param unicode webhooks_on_channel_update_url: The webhooks.on_channel_update.url - :param unicode webhooks_on_channel_update_method: The webhooks.on_channel_update.method - :param unicode webhooks_on_member_add_url: The webhooks.on_member_add.url - :param unicode webhooks_on_member_add_method: The webhooks.on_member_add.method - :param unicode webhooks_on_member_remove_url: The webhooks.on_member_remove.url - :param unicode webhooks_on_member_remove_method: The webhooks.on_member_remove.method - :param unicode webhooks_on_message_sent_url: The webhooks.on_message_sent.url - :param unicode webhooks_on_message_sent_method: The webhooks.on_message_sent.method - :param unicode webhooks_on_message_updated_url: The webhooks.on_message_updated.url - :param unicode webhooks_on_message_updated_method: The webhooks.on_message_updated.method - :param unicode webhooks_on_message_removed_url: The webhooks.on_message_removed.url - :param unicode webhooks_on_message_removed_method: The webhooks.on_message_removed.method - :param unicode webhooks_on_channel_added_url: The webhooks.on_channel_added.url - :param unicode webhooks_on_channel_added_method: The webhooks.on_channel_added.method - :param unicode webhooks_on_channel_destroyed_url: The webhooks.on_channel_destroyed.url - :param unicode webhooks_on_channel_destroyed_method: The webhooks.on_channel_destroyed.method - :param unicode webhooks_on_channel_updated_url: The webhooks.on_channel_updated.url - :param unicode webhooks_on_channel_updated_method: The webhooks.on_channel_updated.method - :param unicode webhooks_on_member_added_url: The webhooks.on_member_added.url - :param unicode webhooks_on_member_added_method: The webhooks.on_member_added.method - :param unicode webhooks_on_member_removed_url: The webhooks.on_member_removed.url - :param unicode webhooks_on_member_removed_method: The webhooks.on_member_removed.method - :param unicode limits_channel_members: The limits.channel_members - :param unicode limits_user_channels: The limits.user_channels - - :returns: The updated ServiceInstance - :rtype: twilio.rest.ip_messaging.v1.service.ServiceInstance - """ + + + def update(self, body): data = values.of({ - 'FriendlyName': friendly_name, - 'DefaultServiceRoleSid': default_service_role_sid, - 'DefaultChannelRoleSid': default_channel_role_sid, - 'DefaultChannelCreatorRoleSid': default_channel_creator_role_sid, - 'ReadStatusEnabled': read_status_enabled, - 'ReachabilityEnabled': reachability_enabled, - 'TypingIndicatorTimeout': typing_indicator_timeout, - 'ConsumptionReportInterval': consumption_report_interval, - 'Notifications.NewMessage.Enabled': notifications_new_message_enabled, - 'Notifications.NewMessage.Template': notifications_new_message_template, - 'Notifications.AddedToChannel.Enabled': notifications_added_to_channel_enabled, - 'Notifications.AddedToChannel.Template': notifications_added_to_channel_template, - 'Notifications.RemovedFromChannel.Enabled': notifications_removed_from_channel_enabled, - 'Notifications.RemovedFromChannel.Template': notifications_removed_from_channel_template, - 'Notifications.InvitedToChannel.Enabled': notifications_invited_to_channel_enabled, - 'Notifications.InvitedToChannel.Template': notifications_invited_to_channel_template, - 'PreWebhookUrl': pre_webhook_url, - 'PostWebhookUrl': post_webhook_url, - 'WebhookMethod': webhook_method, - 'WebhookFilters': serialize.map(webhook_filters, lambda e: e), - 'Webhooks.OnMessageSend.Url': webhooks_on_message_send_url, - 'Webhooks.OnMessageSend.Method': webhooks_on_message_send_method, - 'Webhooks.OnMessageUpdate.Url': webhooks_on_message_update_url, - 'Webhooks.OnMessageUpdate.Method': webhooks_on_message_update_method, - 'Webhooks.OnMessageRemove.Url': webhooks_on_message_remove_url, - 'Webhooks.OnMessageRemove.Method': webhooks_on_message_remove_method, - 'Webhooks.OnChannelAdd.Url': webhooks_on_channel_add_url, - 'Webhooks.OnChannelAdd.Method': webhooks_on_channel_add_method, - 'Webhooks.OnChannelDestroy.Url': webhooks_on_channel_destroy_url, - 'Webhooks.OnChannelDestroy.Method': webhooks_on_channel_destroy_method, - 'Webhooks.OnChannelUpdate.Url': webhooks_on_channel_update_url, - 'Webhooks.OnChannelUpdate.Method': webhooks_on_channel_update_method, - 'Webhooks.OnMemberAdd.Url': webhooks_on_member_add_url, - 'Webhooks.OnMemberAdd.Method': webhooks_on_member_add_method, - 'Webhooks.OnMemberRemove.Url': webhooks_on_member_remove_url, - 'Webhooks.OnMemberRemove.Method': webhooks_on_member_remove_method, - 'Webhooks.OnMessageSent.Url': webhooks_on_message_sent_url, - 'Webhooks.OnMessageSent.Method': webhooks_on_message_sent_method, - 'Webhooks.OnMessageUpdated.Url': webhooks_on_message_updated_url, - 'Webhooks.OnMessageUpdated.Method': webhooks_on_message_updated_method, - 'Webhooks.OnMessageRemoved.Url': webhooks_on_message_removed_url, - 'Webhooks.OnMessageRemoved.Method': webhooks_on_message_removed_method, - 'Webhooks.OnChannelAdded.Url': webhooks_on_channel_added_url, - 'Webhooks.OnChannelAdded.Method': webhooks_on_channel_added_method, - 'Webhooks.OnChannelDestroyed.Url': webhooks_on_channel_destroyed_url, - 'Webhooks.OnChannelDestroyed.Method': webhooks_on_channel_destroyed_method, - 'Webhooks.OnChannelUpdated.Url': webhooks_on_channel_updated_url, - 'Webhooks.OnChannelUpdated.Method': webhooks_on_channel_updated_method, - 'Webhooks.OnMemberAdded.Url': webhooks_on_member_added_url, - 'Webhooks.OnMemberAdded.Method': webhooks_on_member_added_method, - 'Webhooks.OnMemberRemoved.Url': webhooks_on_member_removed_url, - 'Webhooks.OnMemberRemoved.Method': webhooks_on_member_removed_method, - 'Limits.ChannelMembers': limits_channel_members, - 'Limits.UserChannels': limits_user_channels, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def channels(self): - """ - Access the channels - - :returns: twilio.rest.ip_messaging.v1.service.channel.ChannelList - :rtype: twilio.rest.ip_messaging.v1.service.channel.ChannelList - """ - if self._channels is None: - self._channels = ChannelList(self._version, service_sid=self._solution['sid'], ) - return self._channels - - @property - def roles(self): - """ - Access the roles - - :returns: twilio.rest.ip_messaging.v1.service.role.RoleList - :rtype: twilio.rest.ip_messaging.v1.service.role.RoleList - """ - if self._roles is None: - self._roles = RoleList(self._version, service_sid=self._solution['sid'], ) - return self._roles - - @property - def users(self): - """ - Access the users - - :returns: twilio.rest.ip_messaging.v1.service.user.UserList - :rtype: twilio.rest.ip_messaging.v1.service.user.UserList - """ - if self._users is None: - self._users = UserList(self._version, service_sid=self._solution['sid'], ) - return self._users + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ServiceInstance(InstanceResource): - - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - :returns: twilio.rest.ip_messaging.v1.service.ServiceInstance - :rtype: twilio.rest.ip_messaging.v1.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'default_service_role_sid': payload.get('default_service_role_sid'), - 'default_channel_role_sid': payload.get('default_channel_role_sid'), - 'default_channel_creator_role_sid': payload.get('default_channel_creator_role_sid'), - 'read_status_enabled': payload.get('read_status_enabled'), - 'reachability_enabled': payload.get('reachability_enabled'), - 'typing_indicator_timeout': deserialize.integer(payload.get('typing_indicator_timeout')), - 'consumption_report_interval': deserialize.integer(payload.get('consumption_report_interval')), - 'limits': payload.get('limits'), - 'webhooks': payload.get('webhooks'), - 'pre_webhook_url': payload.get('pre_webhook_url'), - 'post_webhook_url': payload.get('post_webhook_url'), - 'webhook_method': payload.get('webhook_method'), - 'webhook_filters': payload.get('webhook_filters'), - 'notifications': payload.get('notifications'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'default_service_role_sid' : payload.get('default_service_role_sid'), + 'default_channel_role_sid' : payload.get('default_channel_role_sid'), + 'default_channel_creator_role_sid' : payload.get('default_channel_creator_role_sid'), + 'read_status_enabled' : payload.get('read_status_enabled'), + 'reachability_enabled' : payload.get('reachability_enabled'), + 'typing_indicator_timeout' : payload.get('typing_indicator_timeout'), + 'consumption_report_interval' : payload.get('consumption_report_interval'), + 'limits' : payload.get('limits'), + 'webhooks' : payload.get('webhooks'), + 'pre_webhook_url' : payload.get('pre_webhook_url'), + 'post_webhook_url' : payload.get('post_webhook_url'), + 'webhook_method' : payload.get('webhook_method'), + 'webhook_filters' : payload.get('webhook_filters'), + 'notifications' : payload.get('notifications'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.ip_messaging.v1.service.ServiceContext - """ if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def default_service_role_sid(self): - """ - :returns: The default_service_role_sid - :rtype: unicode - """ - return self._properties['default_service_role_sid'] - - @property - def default_channel_role_sid(self): - """ - :returns: The default_channel_role_sid - :rtype: unicode - """ - return self._properties['default_channel_role_sid'] - - @property - def default_channel_creator_role_sid(self): - """ - :returns: The default_channel_creator_role_sid - :rtype: unicode - """ - return self._properties['default_channel_creator_role_sid'] - - @property - def read_status_enabled(self): - """ - :returns: The read_status_enabled - :rtype: bool - """ - return self._properties['read_status_enabled'] - - @property - def reachability_enabled(self): - """ - :returns: The reachability_enabled - :rtype: bool - """ - return self._properties['reachability_enabled'] - - @property - def typing_indicator_timeout(self): - """ - :returns: The typing_indicator_timeout - :rtype: unicode - """ - return self._properties['typing_indicator_timeout'] - - @property - def consumption_report_interval(self): - """ - :returns: The consumption_report_interval - :rtype: unicode - """ - return self._properties['consumption_report_interval'] - - @property - def limits(self): - """ - :returns: The limits - :rtype: dict - """ - return self._properties['limits'] - - @property - def webhooks(self): - """ - :returns: The webhooks - :rtype: dict - """ - return self._properties['webhooks'] - - @property - def pre_webhook_url(self): - """ - :returns: The pre_webhook_url - :rtype: unicode - """ - return self._properties['pre_webhook_url'] - - @property - def post_webhook_url(self): - """ - :returns: The post_webhook_url - :rtype: unicode - """ - return self._properties['post_webhook_url'] - - @property - def webhook_method(self): - """ - :returns: The webhook_method - :rtype: unicode - """ - return self._properties['webhook_method'] - - @property - def webhook_filters(self): - """ - :returns: The webhook_filters - :rtype: list[unicode] - """ - return self._properties['webhook_filters'] - - @property - def notifications(self): - """ - :returns: The notifications - :rtype: dict - """ - return self._properties['notifications'] - + def channels(self): + return self._proxy.channels @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - + def roles(self): + return self._proxy.roles @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] + def users(self): + return self._proxy.users + - def fetch(self): + def __repr__(self): """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - :rtype: twilio.rest.ip_messaging.v1.service.ServiceInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the ServiceInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, - default_service_role_sid=values.unset, - default_channel_role_sid=values.unset, - default_channel_creator_role_sid=values.unset, - read_status_enabled=values.unset, reachability_enabled=values.unset, - typing_indicator_timeout=values.unset, - consumption_report_interval=values.unset, - notifications_new_message_enabled=values.unset, - notifications_new_message_template=values.unset, - notifications_added_to_channel_enabled=values.unset, - notifications_added_to_channel_template=values.unset, - notifications_removed_from_channel_enabled=values.unset, - notifications_removed_from_channel_template=values.unset, - notifications_invited_to_channel_enabled=values.unset, - notifications_invited_to_channel_template=values.unset, - pre_webhook_url=values.unset, post_webhook_url=values.unset, - webhook_method=values.unset, webhook_filters=values.unset, - webhooks_on_message_send_url=values.unset, - webhooks_on_message_send_method=values.unset, - webhooks_on_message_update_url=values.unset, - webhooks_on_message_update_method=values.unset, - webhooks_on_message_remove_url=values.unset, - webhooks_on_message_remove_method=values.unset, - webhooks_on_channel_add_url=values.unset, - webhooks_on_channel_add_method=values.unset, - webhooks_on_channel_destroy_url=values.unset, - webhooks_on_channel_destroy_method=values.unset, - webhooks_on_channel_update_url=values.unset, - webhooks_on_channel_update_method=values.unset, - webhooks_on_member_add_url=values.unset, - webhooks_on_member_add_method=values.unset, - webhooks_on_member_remove_url=values.unset, - webhooks_on_member_remove_method=values.unset, - webhooks_on_message_sent_url=values.unset, - webhooks_on_message_sent_method=values.unset, - webhooks_on_message_updated_url=values.unset, - webhooks_on_message_updated_method=values.unset, - webhooks_on_message_removed_url=values.unset, - webhooks_on_message_removed_method=values.unset, - webhooks_on_channel_added_url=values.unset, - webhooks_on_channel_added_method=values.unset, - webhooks_on_channel_destroyed_url=values.unset, - webhooks_on_channel_destroyed_method=values.unset, - webhooks_on_channel_updated_url=values.unset, - webhooks_on_channel_updated_method=values.unset, - webhooks_on_member_added_url=values.unset, - webhooks_on_member_added_method=values.unset, - webhooks_on_member_removed_url=values.unset, - webhooks_on_member_removed_method=values.unset, - limits_channel_members=values.unset, - limits_user_channels=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode default_service_role_sid: The default_service_role_sid - :param unicode default_channel_role_sid: The default_channel_role_sid - :param unicode default_channel_creator_role_sid: The default_channel_creator_role_sid - :param bool read_status_enabled: The read_status_enabled - :param bool reachability_enabled: The reachability_enabled - :param unicode typing_indicator_timeout: The typing_indicator_timeout - :param unicode consumption_report_interval: The consumption_report_interval - :param bool notifications_new_message_enabled: The notifications.new_message.enabled - :param unicode notifications_new_message_template: The notifications.new_message.template - :param bool notifications_added_to_channel_enabled: The notifications.added_to_channel.enabled - :param unicode notifications_added_to_channel_template: The notifications.added_to_channel.template - :param bool notifications_removed_from_channel_enabled: The notifications.removed_from_channel.enabled - :param unicode notifications_removed_from_channel_template: The notifications.removed_from_channel.template - :param bool notifications_invited_to_channel_enabled: The notifications.invited_to_channel.enabled - :param unicode notifications_invited_to_channel_template: The notifications.invited_to_channel.template - :param unicode pre_webhook_url: The pre_webhook_url - :param unicode post_webhook_url: The post_webhook_url - :param unicode webhook_method: The webhook_method - :param list[unicode] webhook_filters: The webhook_filters - :param unicode webhooks_on_message_send_url: The webhooks.on_message_send.url - :param unicode webhooks_on_message_send_method: The webhooks.on_message_send.method - :param unicode webhooks_on_message_update_url: The webhooks.on_message_update.url - :param unicode webhooks_on_message_update_method: The webhooks.on_message_update.method - :param unicode webhooks_on_message_remove_url: The webhooks.on_message_remove.url - :param unicode webhooks_on_message_remove_method: The webhooks.on_message_remove.method - :param unicode webhooks_on_channel_add_url: The webhooks.on_channel_add.url - :param unicode webhooks_on_channel_add_method: The webhooks.on_channel_add.method - :param unicode webhooks_on_channel_destroy_url: The webhooks.on_channel_destroy.url - :param unicode webhooks_on_channel_destroy_method: The webhooks.on_channel_destroy.method - :param unicode webhooks_on_channel_update_url: The webhooks.on_channel_update.url - :param unicode webhooks_on_channel_update_method: The webhooks.on_channel_update.method - :param unicode webhooks_on_member_add_url: The webhooks.on_member_add.url - :param unicode webhooks_on_member_add_method: The webhooks.on_member_add.method - :param unicode webhooks_on_member_remove_url: The webhooks.on_member_remove.url - :param unicode webhooks_on_member_remove_method: The webhooks.on_member_remove.method - :param unicode webhooks_on_message_sent_url: The webhooks.on_message_sent.url - :param unicode webhooks_on_message_sent_method: The webhooks.on_message_sent.method - :param unicode webhooks_on_message_updated_url: The webhooks.on_message_updated.url - :param unicode webhooks_on_message_updated_method: The webhooks.on_message_updated.method - :param unicode webhooks_on_message_removed_url: The webhooks.on_message_removed.url - :param unicode webhooks_on_message_removed_method: The webhooks.on_message_removed.method - :param unicode webhooks_on_channel_added_url: The webhooks.on_channel_added.url - :param unicode webhooks_on_channel_added_method: The webhooks.on_channel_added.method - :param unicode webhooks_on_channel_destroyed_url: The webhooks.on_channel_destroyed.url - :param unicode webhooks_on_channel_destroyed_method: The webhooks.on_channel_destroyed.method - :param unicode webhooks_on_channel_updated_url: The webhooks.on_channel_updated.url - :param unicode webhooks_on_channel_updated_method: The webhooks.on_channel_updated.method - :param unicode webhooks_on_member_added_url: The webhooks.on_member_added.url - :param unicode webhooks_on_member_added_method: The webhooks.on_member_added.method - :param unicode webhooks_on_member_removed_url: The webhooks.on_member_removed.url - :param unicode webhooks_on_member_removed_method: The webhooks.on_member_removed.method - :param unicode limits_channel_members: The limits.channel_members - :param unicode limits_user_channels: The limits.user_channels - - :returns: The updated ServiceInstance - :rtype: twilio.rest.ip_messaging.v1.service.ServiceInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - default_service_role_sid=default_service_role_sid, - default_channel_role_sid=default_channel_role_sid, - default_channel_creator_role_sid=default_channel_creator_role_sid, - read_status_enabled=read_status_enabled, - reachability_enabled=reachability_enabled, - typing_indicator_timeout=typing_indicator_timeout, - consumption_report_interval=consumption_report_interval, - notifications_new_message_enabled=notifications_new_message_enabled, - notifications_new_message_template=notifications_new_message_template, - notifications_added_to_channel_enabled=notifications_added_to_channel_enabled, - notifications_added_to_channel_template=notifications_added_to_channel_template, - notifications_removed_from_channel_enabled=notifications_removed_from_channel_enabled, - notifications_removed_from_channel_template=notifications_removed_from_channel_template, - notifications_invited_to_channel_enabled=notifications_invited_to_channel_enabled, - notifications_invited_to_channel_template=notifications_invited_to_channel_template, - pre_webhook_url=pre_webhook_url, - post_webhook_url=post_webhook_url, - webhook_method=webhook_method, - webhook_filters=webhook_filters, - webhooks_on_message_send_url=webhooks_on_message_send_url, - webhooks_on_message_send_method=webhooks_on_message_send_method, - webhooks_on_message_update_url=webhooks_on_message_update_url, - webhooks_on_message_update_method=webhooks_on_message_update_method, - webhooks_on_message_remove_url=webhooks_on_message_remove_url, - webhooks_on_message_remove_method=webhooks_on_message_remove_method, - webhooks_on_channel_add_url=webhooks_on_channel_add_url, - webhooks_on_channel_add_method=webhooks_on_channel_add_method, - webhooks_on_channel_destroy_url=webhooks_on_channel_destroy_url, - webhooks_on_channel_destroy_method=webhooks_on_channel_destroy_method, - webhooks_on_channel_update_url=webhooks_on_channel_update_url, - webhooks_on_channel_update_method=webhooks_on_channel_update_method, - webhooks_on_member_add_url=webhooks_on_member_add_url, - webhooks_on_member_add_method=webhooks_on_member_add_method, - webhooks_on_member_remove_url=webhooks_on_member_remove_url, - webhooks_on_member_remove_method=webhooks_on_member_remove_method, - webhooks_on_message_sent_url=webhooks_on_message_sent_url, - webhooks_on_message_sent_method=webhooks_on_message_sent_method, - webhooks_on_message_updated_url=webhooks_on_message_updated_url, - webhooks_on_message_updated_method=webhooks_on_message_updated_method, - webhooks_on_message_removed_url=webhooks_on_message_removed_url, - webhooks_on_message_removed_method=webhooks_on_message_removed_method, - webhooks_on_channel_added_url=webhooks_on_channel_added_url, - webhooks_on_channel_added_method=webhooks_on_channel_added_method, - webhooks_on_channel_destroyed_url=webhooks_on_channel_destroyed_url, - webhooks_on_channel_destroyed_method=webhooks_on_channel_destroyed_method, - webhooks_on_channel_updated_url=webhooks_on_channel_updated_url, - webhooks_on_channel_updated_method=webhooks_on_channel_updated_method, - webhooks_on_member_added_url=webhooks_on_member_added_url, - webhooks_on_member_added_method=webhooks_on_member_added_method, - webhooks_on_member_removed_url=webhooks_on_member_removed_url, - webhooks_on_member_removed_method=webhooks_on_member_removed_method, - limits_channel_members=limits_channel_members, - limits_user_channels=limits_user_channels, - ) - @property - def channels(self): - """ - Access the channels +class ServiceListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.ip_messaging.v1.service.channel.ChannelList - :rtype: twilio.rest.ip_messaging.v1.service.channel.ChannelList - """ - return self._proxy.channels + # Path Solution + self._solution = { } + self._uri = '/Services' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def roles(self): - """ - Access the roles + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.ip_messaging.v1.service.role.RoleList - :rtype: twilio.rest.ip_messaging.v1.service.role.RoleList - """ - return self._proxy.roles + return ServiceInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def users(self): - """ - Access the users + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.ip_messaging.v1.service.user.UserList - :rtype: twilio.rest.ip_messaging.v1.service.user.UserList - """ - return self._proxy.users + return ServicePage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/ip_messaging/v1/service/channel.py b/twilio/rest/ip_messaging/v1/service/channel.py deleted file mode 100644 index fd83ef6b43..0000000000 --- a/twilio/rest/ip_messaging/v1/service/channel.py +++ /dev/null @@ -1,191 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Ip_messaging - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.channel.invite import InviteListInstancefrom twilio.rest.channel.member import MemberListInstancefrom twilio.rest.channel.message import MessageListInstance - - -class ChannelContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Channels/${sid}' - - self._invites = None - self._members = None - self._messages = None - - def delete(self): - - - - """ - Deletes the ChannelInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ChannelInstance - - :returns: The fetched ChannelInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ChannelInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'unique_name' : payload.get('unique_name'), - 'attributes' : payload.get('attributes'), - 'type' : payload.get('type'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'created_by' : payload.get('created_by'), - 'members_count' : payload.get('members_count'), - 'messages_count' : payload.get('messages_count'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ChannelContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def invites(self): - return self._proxy.invites - @property - def members(self): - return self._proxy.members - @property - def messages(self): - return self._proxy.messages - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ChannelListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Channels' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, type, page_size): - - data = values.of({ - 'type': type,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ChannelPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/ip_messaging/v1/service/channel/__init__.py b/twilio/rest/ip_messaging/v1/service/channel/__init__.py index 5070205f08..fd83ef6b43 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/channel/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,251 +19,30 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.ip_messaging.v1.service.channel.invite import InviteList -from twilio.rest.ip_messaging.v1.service.channel.member import MemberList -from twilio.rest.ip_messaging.v1.service.channel.message import MessageList - - -class ChannelList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the ChannelList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.ip_messaging.v1.service.channel.ChannelList - :rtype: twilio.rest.ip_messaging.v1.service.channel.ChannelList - """ - super(ChannelList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Channels'.format(**self._solution) - - def create(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset, type=values.unset): - """ - Create the ChannelInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - :param unicode attributes: The attributes - :param ChannelInstance.ChannelType type: The type - - :returns: The created ChannelInstance - :rtype: twilio.rest.ip_messaging.v1.service.channel.ChannelInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Attributes': attributes, - 'Type': type, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, type=values.unset, limit=None, page_size=None): - """ - Streams ChannelInstance 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 list[ChannelInstance.ChannelType] type: The type - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.ip_messaging.v1.service.channel.ChannelInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(type=type, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, type=values.unset, limit=None, page_size=None): - """ - Lists ChannelInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param list[ChannelInstance.ChannelType] type: The type - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.ip_messaging.v1.service.channel.ChannelInstance] - """ - return list(self.stream(type=type, limit=limit, page_size=page_size, )) +from twilio.base.version import Version - def page(self, type=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of ChannelInstance records from the API. - Request is executed immediately - - :param list[ChannelInstance.ChannelType] type: The type - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ChannelInstance - :rtype: twilio.rest.ip_messaging.v1.service.channel.ChannelPage - """ - data = values.of({ - 'Type': serialize.map(type, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ChannelPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ChannelInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ChannelInstance - :rtype: twilio.rest.ip_messaging.v1.service.channel.ChannelPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ChannelPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ChannelContext - - :param sid: The sid - - :returns: twilio.rest.ip_messaging.v1.service.channel.ChannelContext - :rtype: twilio.rest.ip_messaging.v1.service.channel.ChannelContext - """ - return ChannelContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ChannelContext - - :param sid: The sid - - :returns: twilio.rest.ip_messaging.v1.service.channel.ChannelContext - :rtype: twilio.rest.ip_messaging.v1.service.channel.ChannelContext - """ - return ChannelContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ChannelPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ChannelPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.ip_messaging.v1.service.channel.ChannelPage - :rtype: twilio.rest.ip_messaging.v1.service.channel.ChannelPage - """ - super(ChannelPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ChannelInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.ip_messaging.v1.service.channel.ChannelInstance - :rtype: twilio.rest.ip_messaging.v1.service.channel.ChannelInstance - """ - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.channel.invite import InviteListInstancefrom twilio.rest.channel.member import MemberListInstancefrom twilio.rest.channel.message import MessageListInstance class ChannelContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the ChannelContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.ip_messaging.v1.service.channel.ChannelContext - :rtype: twilio.rest.ip_messaging.v1.service.channel.ChannelContext - """ - super(ChannelContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Channels/${sid}' + + self._invites = None self._members = None self._messages = None - self._invites = None - - def fetch(self): - """ - Fetch the ChannelInstance - - :returns: The fetched ChannelInstance - :rtype: twilio.rest.ip_messaging.v1.service.channel.ChannelInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the ChannelInstance @@ -264,331 +50,142 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ChannelInstance - def update(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset): + :returns: The fetched ChannelInstance + #TODO: add rtype docs """ - Update the ChannelInstance + payload = self._version.fetch(method='GET', uri=self._uri, ) - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - :param unicode attributes: The attributes + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - :returns: The updated ChannelInstance - :rtype: twilio.rest.ip_messaging.v1.service.channel.ChannelInstance - """ + + + def update(self, body): data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Attributes': attributes, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return ChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def members(self): - """ - Access the members - - :returns: twilio.rest.ip_messaging.v1.service.channel.member.MemberList - :rtype: twilio.rest.ip_messaging.v1.service.channel.member.MemberList - """ - if self._members is None: - self._members = MemberList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._members - - @property - def messages(self): - """ - Access the messages - - :returns: twilio.rest.ip_messaging.v1.service.channel.message.MessageList - :rtype: twilio.rest.ip_messaging.v1.service.channel.message.MessageList - """ - if self._messages is None: - self._messages = MessageList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._messages + payload = self._version.update(method='post', uri=self._uri, data=data, ) - @property - def invites(self): - """ - Access the invites + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + - :returns: twilio.rest.ip_messaging.v1.service.channel.invite.InviteList - :rtype: twilio.rest.ip_messaging.v1.service.channel.invite.InviteList - """ - if self._invites is None: - self._invites = InviteList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._invites + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ChannelInstance(InstanceResource): - - class ChannelType(object): - PUBLIC = "public" - PRIVATE = "private" - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the ChannelInstance - :returns: twilio.rest.ip_messaging.v1.service.channel.ChannelInstance - :rtype: twilio.rest.ip_messaging.v1.service.channel.ChannelInstance - """ - super(ChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'friendly_name': payload.get('friendly_name'), - 'unique_name': payload.get('unique_name'), - 'attributes': payload.get('attributes'), - 'type': payload.get('type'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'created_by': payload.get('created_by'), - 'members_count': deserialize.integer(payload.get('members_count')), - 'messages_count': deserialize.integer(payload.get('messages_count')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ChannelInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'unique_name' : payload.get('unique_name'), + 'attributes' : payload.get('attributes'), + 'type' : payload.get('type'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'created_by' : payload.get('created_by'), + 'members_count' : payload.get('members_count'), + 'messages_count' : payload.get('messages_count'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ChannelContext for this ChannelInstance - :rtype: twilio.rest.ip_messaging.v1.service.channel.ChannelContext - """ if self._context is None: self._context = ChannelContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def type(self): - """ - :returns: The type - :rtype: ChannelInstance.ChannelType - """ - return self._properties['type'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - @property - def members_count(self): - """ - :returns: The members_count - :rtype: unicode - """ - return self._properties['members_count'] - - @property - def messages_count(self): - """ - :returns: The messages_count - :rtype: unicode - """ - return self._properties['messages_count'] - + def invites(self): + return self._proxy.invites @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - + def members(self): + return self._proxy.members @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the ChannelInstance - - :returns: The fetched ChannelInstance - :rtype: twilio.rest.ip_messaging.v1.service.channel.ChannelInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ChannelInstance + def messages(self): + return self._proxy.messages + - :returns: True if delete succeeds, False otherwise - :rtype: bool + def __repr__(self): """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the ChannelInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - :param unicode attributes: The attributes - :returns: The updated ChannelInstance - :rtype: twilio.rest.ip_messaging.v1.service.channel.ChannelInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - unique_name=unique_name, - attributes=attributes, - ) - @property - def members(self): - """ - Access the members +class ChannelListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.ip_messaging.v1.service.channel.member.MemberList - :rtype: twilio.rest.ip_messaging.v1.service.channel.member.MemberList - """ - return self._proxy.members + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Channels' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def messages(self): - """ - Access the messages + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.ip_messaging.v1.service.channel.message.MessageList - :rtype: twilio.rest.ip_messaging.v1.service.channel.message.MessageList - """ - return self._proxy.messages + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, type, page_size): + + data = values.of({ + 'type': type,'page_size': page_size, + }) - @property - def invites(self): - """ - Access the invites + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.ip_messaging.v1.service.channel.invite.InviteList - :rtype: twilio.rest.ip_messaging.v1.service.channel.invite.InviteList - """ - return self._proxy.invites + return ChannelPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/ip_messaging/v1/service/user.py b/twilio/rest/ip_messaging/v1/service/user.py deleted file mode 100644 index 834df9cc47..0000000000 --- a/twilio/rest/ip_messaging/v1/service/user.py +++ /dev/null @@ -1,183 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Ip_messaging - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.user.user_channel import UserChannelListInstance - - -class UserContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Users/${sid}' - - self._user_channels = None - - def delete(self): - - - - """ - Deletes the UserInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the UserInstance - - :returns: The fetched UserInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class UserInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'attributes' : payload.get('attributes'), - 'friendly_name' : payload.get('friendly_name'), - 'role_sid' : payload.get('role_sid'), - 'identity' : payload.get('identity'), - 'is_online' : payload.get('is_online'), - 'is_notifiable' : payload.get('is_notifiable'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'joined_channels_count' : payload.get('joined_channels_count'), - 'links' : payload.get('links'), - 'url' : payload.get('url'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = UserContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def user_channels(self): - return self._proxy.user_channels - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class UserListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Users' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return UserPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/ip_messaging/v1/service/user/__init__.py b/twilio/rest/ip_messaging/v1/service/user/__init__.py index d6dd50b2c8..834df9cc47 100644 --- a/twilio/rest/ip_messaging/v1/service/user/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/user/__init__.py @@ -1,249 +1,46 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.ip_messaging.v1.service.user.user_channel import UserChannelList - - -class UserList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the UserList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.ip_messaging.v1.service.user.UserList - :rtype: twilio.rest.ip_messaging.v1.service.user.UserList - """ - super(UserList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Users'.format(**self._solution) - - def create(self, identity, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): - """ - Create the UserInstance - - :param unicode identity: The identity - :param unicode role_sid: The role_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name - - :returns: The created UserInstance - :rtype: twilio.rest.ip_messaging.v1.service.user.UserInstance - """ - data = values.of({ - 'Identity': identity, - 'RoleSid': role_sid, - 'Attributes': attributes, - 'FriendlyName': friendly_name, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams UserInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.ip_messaging.v1.service.user.UserInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists UserInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.ip_messaging.v1.service.user.UserInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UserInstance - :rtype: twilio.rest.ip_messaging.v1.service.user.UserPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return UserPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserInstance - :rtype: twilio.rest.ip_messaging.v1.service.user.UserPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a UserContext - - :param sid: The sid - - :returns: twilio.rest.ip_messaging.v1.service.user.UserContext - :rtype: twilio.rest.ip_messaging.v1.service.user.UserContext - """ - return UserContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a UserContext - - :param sid: The sid - - :returns: twilio.rest.ip_messaging.v1.service.user.UserContext - :rtype: twilio.rest.ip_messaging.v1.service.user.UserContext - """ - return UserContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) +from twilio.base.version import Version - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class UserPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the UserPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.ip_messaging.v1.service.user.UserPage - :rtype: twilio.rest.ip_messaging.v1.service.user.UserPage - """ - super(UserPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - - :returns: twilio.rest.ip_messaging.v1.service.user.UserInstance - :rtype: twilio.rest.ip_messaging.v1.service.user.UserInstance - """ - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.user.user_channel import UserChannelListInstance class UserContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the UserContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.ip_messaging.v1.service.user.UserContext - :rtype: twilio.rest.ip_messaging.v1.service.user.UserContext - """ - super(UserContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Users/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Users/${sid}' + self._user_channels = None - - def fetch(self): - """ - Fetch the UserInstance - - :returns: The fetched UserInstance - :rtype: twilio.rest.ip_messaging.v1.service.user.UserInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return UserInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the UserInstance @@ -251,267 +48,136 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): + + def fetch(self): + """ - Update the UserInstance - - :param unicode role_sid: The role_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name + Fetch the UserInstance - :returns: The updated UserInstance - :rtype: twilio.rest.ip_messaging.v1.service.user.UserInstance + :returns: The fetched UserInstance + #TODO: add rtype docs """ - data = values.of({'RoleSid': role_sid, 'Attributes': attributes, 'FriendlyName': friendly_name, }) + payload = self._version.fetch(method='GET', uri=self._uri, ) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - return UserInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + + + def update(self, body): + data = values.of({ + 'body': body, + }) - @property - def user_channels(self): - """ - Access the user_channels + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.ip_messaging.v1.service.user.user_channel.UserChannelList - :rtype: twilio.rest.ip_messaging.v1.service.user.user_channel.UserChannelList - """ - if self._user_channels is None: - self._user_channels = UserChannelList( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['sid'], - ) - return self._user_channels + return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class UserInstance(InstanceResource): - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the UserInstance - - :returns: twilio.rest.ip_messaging.v1.service.user.UserInstance - :rtype: twilio.rest.ip_messaging.v1.service.user.UserInstance - """ - super(UserInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'attributes': payload.get('attributes'), - 'friendly_name': payload.get('friendly_name'), - 'role_sid': payload.get('role_sid'), - 'identity': payload.get('identity'), - 'is_online': payload.get('is_online'), - 'is_notifiable': payload.get('is_notifiable'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'joined_channels_count': deserialize.integer(payload.get('joined_channels_count')), - 'links': payload.get('links'), - 'url': payload.get('url'), +class UserInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'attributes' : payload.get('attributes'), + 'friendly_name' : payload.get('friendly_name'), + 'role_sid' : payload.get('role_sid'), + 'identity' : payload.get('identity'), + 'is_online' : payload.get('is_online'), + 'is_notifiable' : payload.get('is_notifiable'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'joined_channels_count' : payload.get('joined_channels_count'), + 'links' : payload.get('links'), + 'url' : payload.get('url'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserContext for this UserInstance - :rtype: twilio.rest.ip_messaging.v1.service.user.UserContext - """ if self._context is None: self._context = UserContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def role_sid(self): - """ - :returns: The role_sid - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def is_online(self): - """ - :returns: The is_online - :rtype: bool - """ - return self._properties['is_online'] - - @property - def is_notifiable(self): - """ - :returns: The is_notifiable - :rtype: bool - """ - return self._properties['is_notifiable'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def joined_channels_count(self): - """ - :returns: The joined_channels_count - :rtype: unicode - """ - return self._properties['joined_channels_count'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] + def user_channels(self): + return self._proxy.user_channels + - @property - def url(self): - """ - :returns: The url - :rtype: unicode + def __repr__(self): """ - return self._properties['url'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the UserInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched UserInstance - :rtype: twilio.rest.ip_messaging.v1.service.user.UserInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the UserInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() +class UserListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - def update(self, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset): - """ - Update the UserInstance + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Users' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - :param unicode role_sid: The role_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: The updated UserInstance - :rtype: twilio.rest.ip_messaging.v1.service.user.UserInstance - """ - return self._proxy.update(role_sid=role_sid, attributes=attributes, friendly_name=friendly_name, ) + return UserInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def user_channels(self): - """ - Access the user_channels + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.ip_messaging.v1.service.user.user_channel.UserChannelList - :rtype: twilio.rest.ip_messaging.v1.service.user.user_channel.UserChannelList - """ - return self._proxy.user_channels + return UserPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/ip_messaging/v2/service.py b/twilio/rest/ip_messaging/v2/service.py deleted file mode 100644 index 91c5ac73b7..0000000000 --- a/twilio/rest/ip_messaging/v2/service.py +++ /dev/null @@ -1,204 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Ip_messaging - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.service.binding import BindingListInstancefrom twilio.rest.service.channel import ChannelListInstancefrom twilio.rest.service.role import RoleListInstancefrom twilio.rest.service.user import UserListInstance - - -class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Services/${sid}' - - self._bindings = None - self._channels = None - self._roles = None - self._users = None - - def delete(self): - - - - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'default_service_role_sid' : payload.get('default_service_role_sid'), - 'default_channel_role_sid' : payload.get('default_channel_role_sid'), - 'default_channel_creator_role_sid' : payload.get('default_channel_creator_role_sid'), - 'read_status_enabled' : payload.get('read_status_enabled'), - 'reachability_enabled' : payload.get('reachability_enabled'), - 'typing_indicator_timeout' : payload.get('typing_indicator_timeout'), - 'consumption_report_interval' : payload.get('consumption_report_interval'), - 'limits' : payload.get('limits'), - 'pre_webhook_url' : payload.get('pre_webhook_url'), - 'post_webhook_url' : payload.get('post_webhook_url'), - 'webhook_method' : payload.get('webhook_method'), - 'webhook_filters' : payload.get('webhook_filters'), - 'pre_webhook_retry_count' : payload.get('pre_webhook_retry_count'), - 'post_webhook_retry_count' : payload.get('post_webhook_retry_count'), - 'notifications' : payload.get('notifications'), - 'media' : payload.get('media'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ServiceContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def bindings(self): - return self._proxy.bindings - @property - def channels(self): - return self._proxy.channels - @property - def roles(self): - return self._proxy.roles - @property - def users(self): - return self._proxy.users - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ServiceListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Services' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ServicePage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/ip_messaging/v2/service/__init__.py b/twilio/rest/ip_messaging/v2/service/__init__.py index dfe550e581..91c5ac73b7 100644 --- a/twilio/rest/ip_messaging/v2/service/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,802 +19,186 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.ip_messaging.v2.service.binding import BindingList -from twilio.rest.ip_messaging.v2.service.channel import ChannelList -from twilio.rest.ip_messaging.v2.service.role import RoleList -from twilio.rest.ip_messaging.v2.service.user import UserList - - -class ServiceList(ListResource): - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.ip_messaging.v2.service.ServiceList - :rtype: twilio.rest.ip_messaging.v2.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def create(self, friendly_name): - """ - Create the ServiceInstance - - :param unicode friendly_name: The friendly_name - - :returns: The created ServiceInstance - :rtype: twilio.rest.ip_messaging.v2.service.ServiceInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.ip_messaging.v2.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.ip_messaging.v2.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.ip_messaging.v2.service.ServicePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.ip_messaging.v2.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.ip_messaging.v2.service.ServiceContext - :rtype: twilio.rest.ip_messaging.v2.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.ip_messaging.v2.service.ServiceContext - :rtype: twilio.rest.ip_messaging.v2.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ServicePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.ip_messaging.v2.service.ServicePage - :rtype: twilio.rest.ip_messaging.v2.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API +from twilio.base.version import Version - :returns: twilio.rest.ip_messaging.v2.service.ServiceInstance - :rtype: twilio.rest.ip_messaging.v2.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.service.binding import BindingListInstancefrom twilio.rest.service.channel import ChannelListInstancefrom twilio.rest.service.role import RoleListInstancefrom twilio.rest.service.user import UserListInstance class ServiceContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.ip_messaging.v2.service.ServiceContext - :rtype: twilio.rest.ip_messaging.v2.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Services/${sid}' + + self._bindings = None self._channels = None self._roles = None self._users = None - self._bindings = None + + def delete(self): + + + """ + Deletes the ServiceInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the ServiceInstance :returns: The fetched ServiceInstance - :rtype: twilio.rest.ip_messaging.v2.service.ServiceInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, friendly_name=values.unset, - default_service_role_sid=values.unset, - default_channel_role_sid=values.unset, - default_channel_creator_role_sid=values.unset, - read_status_enabled=values.unset, reachability_enabled=values.unset, - typing_indicator_timeout=values.unset, - consumption_report_interval=values.unset, - notifications_new_message_enabled=values.unset, - notifications_new_message_template=values.unset, - notifications_new_message_sound=values.unset, - notifications_new_message_badge_count_enabled=values.unset, - notifications_added_to_channel_enabled=values.unset, - notifications_added_to_channel_template=values.unset, - notifications_added_to_channel_sound=values.unset, - notifications_removed_from_channel_enabled=values.unset, - notifications_removed_from_channel_template=values.unset, - notifications_removed_from_channel_sound=values.unset, - notifications_invited_to_channel_enabled=values.unset, - notifications_invited_to_channel_template=values.unset, - notifications_invited_to_channel_sound=values.unset, - pre_webhook_url=values.unset, post_webhook_url=values.unset, - webhook_method=values.unset, webhook_filters=values.unset, - limits_channel_members=values.unset, - limits_user_channels=values.unset, - media_compatibility_message=values.unset, - pre_webhook_retry_count=values.unset, - post_webhook_retry_count=values.unset, - notifications_log_enabled=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode default_service_role_sid: The default_service_role_sid - :param unicode default_channel_role_sid: The default_channel_role_sid - :param unicode default_channel_creator_role_sid: The default_channel_creator_role_sid - :param bool read_status_enabled: The read_status_enabled - :param bool reachability_enabled: The reachability_enabled - :param unicode typing_indicator_timeout: The typing_indicator_timeout - :param unicode consumption_report_interval: The consumption_report_interval - :param bool notifications_new_message_enabled: The notifications.new_message.enabled - :param unicode notifications_new_message_template: The notifications.new_message.template - :param unicode notifications_new_message_sound: The notifications.new_message.sound - :param bool notifications_new_message_badge_count_enabled: The notifications.new_message.badge_count_enabled - :param bool notifications_added_to_channel_enabled: The notifications.added_to_channel.enabled - :param unicode notifications_added_to_channel_template: The notifications.added_to_channel.template - :param unicode notifications_added_to_channel_sound: The notifications.added_to_channel.sound - :param bool notifications_removed_from_channel_enabled: The notifications.removed_from_channel.enabled - :param unicode notifications_removed_from_channel_template: The notifications.removed_from_channel.template - :param unicode notifications_removed_from_channel_sound: The notifications.removed_from_channel.sound - :param bool notifications_invited_to_channel_enabled: The notifications.invited_to_channel.enabled - :param unicode notifications_invited_to_channel_template: The notifications.invited_to_channel.template - :param unicode notifications_invited_to_channel_sound: The notifications.invited_to_channel.sound - :param unicode pre_webhook_url: The pre_webhook_url - :param unicode post_webhook_url: The post_webhook_url - :param unicode webhook_method: The webhook_method - :param list[unicode] webhook_filters: The webhook_filters - :param unicode limits_channel_members: The limits.channel_members - :param unicode limits_user_channels: The limits.user_channels - :param unicode media_compatibility_message: The media.compatibility_message - :param unicode pre_webhook_retry_count: The pre_webhook_retry_count - :param unicode post_webhook_retry_count: The post_webhook_retry_count - :param bool notifications_log_enabled: The notifications.log_enabled - - :returns: The updated ServiceInstance - :rtype: twilio.rest.ip_messaging.v2.service.ServiceInstance - """ + + + def update(self, body): data = values.of({ - 'FriendlyName': friendly_name, - 'DefaultServiceRoleSid': default_service_role_sid, - 'DefaultChannelRoleSid': default_channel_role_sid, - 'DefaultChannelCreatorRoleSid': default_channel_creator_role_sid, - 'ReadStatusEnabled': read_status_enabled, - 'ReachabilityEnabled': reachability_enabled, - 'TypingIndicatorTimeout': typing_indicator_timeout, - 'ConsumptionReportInterval': consumption_report_interval, - 'Notifications.NewMessage.Enabled': notifications_new_message_enabled, - 'Notifications.NewMessage.Template': notifications_new_message_template, - 'Notifications.NewMessage.Sound': notifications_new_message_sound, - 'Notifications.NewMessage.BadgeCountEnabled': notifications_new_message_badge_count_enabled, - 'Notifications.AddedToChannel.Enabled': notifications_added_to_channel_enabled, - 'Notifications.AddedToChannel.Template': notifications_added_to_channel_template, - 'Notifications.AddedToChannel.Sound': notifications_added_to_channel_sound, - 'Notifications.RemovedFromChannel.Enabled': notifications_removed_from_channel_enabled, - 'Notifications.RemovedFromChannel.Template': notifications_removed_from_channel_template, - 'Notifications.RemovedFromChannel.Sound': notifications_removed_from_channel_sound, - 'Notifications.InvitedToChannel.Enabled': notifications_invited_to_channel_enabled, - 'Notifications.InvitedToChannel.Template': notifications_invited_to_channel_template, - 'Notifications.InvitedToChannel.Sound': notifications_invited_to_channel_sound, - 'PreWebhookUrl': pre_webhook_url, - 'PostWebhookUrl': post_webhook_url, - 'WebhookMethod': webhook_method, - 'WebhookFilters': serialize.map(webhook_filters, lambda e: e), - 'Limits.ChannelMembers': limits_channel_members, - 'Limits.UserChannels': limits_user_channels, - 'Media.CompatibilityMessage': media_compatibility_message, - 'PreWebhookRetryCount': pre_webhook_retry_count, - 'PostWebhookRetryCount': post_webhook_retry_count, - 'Notifications.LogEnabled': notifications_log_enabled, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def channels(self): - """ - Access the channels - - :returns: twilio.rest.ip_messaging.v2.service.channel.ChannelList - :rtype: twilio.rest.ip_messaging.v2.service.channel.ChannelList - """ - if self._channels is None: - self._channels = ChannelList(self._version, service_sid=self._solution['sid'], ) - return self._channels - - @property - def roles(self): - """ - Access the roles - - :returns: twilio.rest.ip_messaging.v2.service.role.RoleList - :rtype: twilio.rest.ip_messaging.v2.service.role.RoleList - """ - if self._roles is None: - self._roles = RoleList(self._version, service_sid=self._solution['sid'], ) - return self._roles - - @property - def users(self): - """ - Access the users - - :returns: twilio.rest.ip_messaging.v2.service.user.UserList - :rtype: twilio.rest.ip_messaging.v2.service.user.UserList - """ - if self._users is None: - self._users = UserList(self._version, service_sid=self._solution['sid'], ) - return self._users - - @property - def bindings(self): - """ - Access the bindings - - :returns: twilio.rest.ip_messaging.v2.service.binding.BindingList - :rtype: twilio.rest.ip_messaging.v2.service.binding.BindingList - """ - if self._bindings is None: - self._bindings = BindingList(self._version, service_sid=self._solution['sid'], ) - return self._bindings + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - :returns: twilio.rest.ip_messaging.v2.service.ServiceInstance - :rtype: twilio.rest.ip_messaging.v2.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'default_service_role_sid': payload.get('default_service_role_sid'), - 'default_channel_role_sid': payload.get('default_channel_role_sid'), - 'default_channel_creator_role_sid': payload.get('default_channel_creator_role_sid'), - 'read_status_enabled': payload.get('read_status_enabled'), - 'reachability_enabled': payload.get('reachability_enabled'), - 'typing_indicator_timeout': deserialize.integer(payload.get('typing_indicator_timeout')), - 'consumption_report_interval': deserialize.integer(payload.get('consumption_report_interval')), - 'limits': payload.get('limits'), - 'pre_webhook_url': payload.get('pre_webhook_url'), - 'post_webhook_url': payload.get('post_webhook_url'), - 'webhook_method': payload.get('webhook_method'), - 'webhook_filters': payload.get('webhook_filters'), - 'pre_webhook_retry_count': deserialize.integer(payload.get('pre_webhook_retry_count')), - 'post_webhook_retry_count': deserialize.integer(payload.get('post_webhook_retry_count')), - 'notifications': payload.get('notifications'), - 'media': payload.get('media'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'default_service_role_sid' : payload.get('default_service_role_sid'), + 'default_channel_role_sid' : payload.get('default_channel_role_sid'), + 'default_channel_creator_role_sid' : payload.get('default_channel_creator_role_sid'), + 'read_status_enabled' : payload.get('read_status_enabled'), + 'reachability_enabled' : payload.get('reachability_enabled'), + 'typing_indicator_timeout' : payload.get('typing_indicator_timeout'), + 'consumption_report_interval' : payload.get('consumption_report_interval'), + 'limits' : payload.get('limits'), + 'pre_webhook_url' : payload.get('pre_webhook_url'), + 'post_webhook_url' : payload.get('post_webhook_url'), + 'webhook_method' : payload.get('webhook_method'), + 'webhook_filters' : payload.get('webhook_filters'), + 'pre_webhook_retry_count' : payload.get('pre_webhook_retry_count'), + 'post_webhook_retry_count' : payload.get('post_webhook_retry_count'), + 'notifications' : payload.get('notifications'), + 'media' : payload.get('media'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.ip_messaging.v2.service.ServiceContext - """ if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def default_service_role_sid(self): - """ - :returns: The default_service_role_sid - :rtype: unicode - """ - return self._properties['default_service_role_sid'] - - @property - def default_channel_role_sid(self): - """ - :returns: The default_channel_role_sid - :rtype: unicode - """ - return self._properties['default_channel_role_sid'] - - @property - def default_channel_creator_role_sid(self): - """ - :returns: The default_channel_creator_role_sid - :rtype: unicode - """ - return self._properties['default_channel_creator_role_sid'] - - @property - def read_status_enabled(self): - """ - :returns: The read_status_enabled - :rtype: bool - """ - return self._properties['read_status_enabled'] - - @property - def reachability_enabled(self): - """ - :returns: The reachability_enabled - :rtype: bool - """ - return self._properties['reachability_enabled'] - - @property - def typing_indicator_timeout(self): - """ - :returns: The typing_indicator_timeout - :rtype: unicode - """ - return self._properties['typing_indicator_timeout'] - - @property - def consumption_report_interval(self): - """ - :returns: The consumption_report_interval - :rtype: unicode - """ - return self._properties['consumption_report_interval'] - - @property - def limits(self): - """ - :returns: The limits - :rtype: dict - """ - return self._properties['limits'] - - @property - def pre_webhook_url(self): - """ - :returns: The pre_webhook_url - :rtype: unicode - """ - return self._properties['pre_webhook_url'] - - @property - def post_webhook_url(self): - """ - :returns: The post_webhook_url - :rtype: unicode - """ - return self._properties['post_webhook_url'] - - @property - def webhook_method(self): - """ - :returns: The webhook_method - :rtype: unicode - """ - return self._properties['webhook_method'] - - @property - def webhook_filters(self): - """ - :returns: The webhook_filters - :rtype: list[unicode] - """ - return self._properties['webhook_filters'] - - @property - def pre_webhook_retry_count(self): - """ - :returns: The pre_webhook_retry_count - :rtype: unicode - """ - return self._properties['pre_webhook_retry_count'] - - @property - def post_webhook_retry_count(self): - """ - :returns: The post_webhook_retry_count - :rtype: unicode - """ - return self._properties['post_webhook_retry_count'] - - @property - def notifications(self): - """ - :returns: The notifications - :rtype: dict - """ - return self._properties['notifications'] - + def bindings(self): + return self._proxy.bindings @property - def media(self): - """ - :returns: The media - :rtype: dict - """ - return self._properties['media'] - + def channels(self): + return self._proxy.channels @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - + def roles(self): + return self._proxy.roles @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - :rtype: twilio.rest.ip_messaging.v2.service.ServiceInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ServiceInstance + def users(self): + return self._proxy.users + - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, - default_service_role_sid=values.unset, - default_channel_role_sid=values.unset, - default_channel_creator_role_sid=values.unset, - read_status_enabled=values.unset, reachability_enabled=values.unset, - typing_indicator_timeout=values.unset, - consumption_report_interval=values.unset, - notifications_new_message_enabled=values.unset, - notifications_new_message_template=values.unset, - notifications_new_message_sound=values.unset, - notifications_new_message_badge_count_enabled=values.unset, - notifications_added_to_channel_enabled=values.unset, - notifications_added_to_channel_template=values.unset, - notifications_added_to_channel_sound=values.unset, - notifications_removed_from_channel_enabled=values.unset, - notifications_removed_from_channel_template=values.unset, - notifications_removed_from_channel_sound=values.unset, - notifications_invited_to_channel_enabled=values.unset, - notifications_invited_to_channel_template=values.unset, - notifications_invited_to_channel_sound=values.unset, - pre_webhook_url=values.unset, post_webhook_url=values.unset, - webhook_method=values.unset, webhook_filters=values.unset, - limits_channel_members=values.unset, - limits_user_channels=values.unset, - media_compatibility_message=values.unset, - pre_webhook_retry_count=values.unset, - post_webhook_retry_count=values.unset, - notifications_log_enabled=values.unset): + def __repr__(self): """ - Update the ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode default_service_role_sid: The default_service_role_sid - :param unicode default_channel_role_sid: The default_channel_role_sid - :param unicode default_channel_creator_role_sid: The default_channel_creator_role_sid - :param bool read_status_enabled: The read_status_enabled - :param bool reachability_enabled: The reachability_enabled - :param unicode typing_indicator_timeout: The typing_indicator_timeout - :param unicode consumption_report_interval: The consumption_report_interval - :param bool notifications_new_message_enabled: The notifications.new_message.enabled - :param unicode notifications_new_message_template: The notifications.new_message.template - :param unicode notifications_new_message_sound: The notifications.new_message.sound - :param bool notifications_new_message_badge_count_enabled: The notifications.new_message.badge_count_enabled - :param bool notifications_added_to_channel_enabled: The notifications.added_to_channel.enabled - :param unicode notifications_added_to_channel_template: The notifications.added_to_channel.template - :param unicode notifications_added_to_channel_sound: The notifications.added_to_channel.sound - :param bool notifications_removed_from_channel_enabled: The notifications.removed_from_channel.enabled - :param unicode notifications_removed_from_channel_template: The notifications.removed_from_channel.template - :param unicode notifications_removed_from_channel_sound: The notifications.removed_from_channel.sound - :param bool notifications_invited_to_channel_enabled: The notifications.invited_to_channel.enabled - :param unicode notifications_invited_to_channel_template: The notifications.invited_to_channel.template - :param unicode notifications_invited_to_channel_sound: The notifications.invited_to_channel.sound - :param unicode pre_webhook_url: The pre_webhook_url - :param unicode post_webhook_url: The post_webhook_url - :param unicode webhook_method: The webhook_method - :param list[unicode] webhook_filters: The webhook_filters - :param unicode limits_channel_members: The limits.channel_members - :param unicode limits_user_channels: The limits.user_channels - :param unicode media_compatibility_message: The media.compatibility_message - :param unicode pre_webhook_retry_count: The pre_webhook_retry_count - :param unicode post_webhook_retry_count: The post_webhook_retry_count - :param bool notifications_log_enabled: The notifications.log_enabled - - :returns: The updated ServiceInstance - :rtype: twilio.rest.ip_messaging.v2.service.ServiceInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update( - friendly_name=friendly_name, - default_service_role_sid=default_service_role_sid, - default_channel_role_sid=default_channel_role_sid, - default_channel_creator_role_sid=default_channel_creator_role_sid, - read_status_enabled=read_status_enabled, - reachability_enabled=reachability_enabled, - typing_indicator_timeout=typing_indicator_timeout, - consumption_report_interval=consumption_report_interval, - notifications_new_message_enabled=notifications_new_message_enabled, - notifications_new_message_template=notifications_new_message_template, - notifications_new_message_sound=notifications_new_message_sound, - notifications_new_message_badge_count_enabled=notifications_new_message_badge_count_enabled, - notifications_added_to_channel_enabled=notifications_added_to_channel_enabled, - notifications_added_to_channel_template=notifications_added_to_channel_template, - notifications_added_to_channel_sound=notifications_added_to_channel_sound, - notifications_removed_from_channel_enabled=notifications_removed_from_channel_enabled, - notifications_removed_from_channel_template=notifications_removed_from_channel_template, - notifications_removed_from_channel_sound=notifications_removed_from_channel_sound, - notifications_invited_to_channel_enabled=notifications_invited_to_channel_enabled, - notifications_invited_to_channel_template=notifications_invited_to_channel_template, - notifications_invited_to_channel_sound=notifications_invited_to_channel_sound, - pre_webhook_url=pre_webhook_url, - post_webhook_url=post_webhook_url, - webhook_method=webhook_method, - webhook_filters=webhook_filters, - limits_channel_members=limits_channel_members, - limits_user_channels=limits_user_channels, - media_compatibility_message=media_compatibility_message, - pre_webhook_retry_count=pre_webhook_retry_count, - post_webhook_retry_count=post_webhook_retry_count, - notifications_log_enabled=notifications_log_enabled, - ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def channels(self): - """ - Access the channels - :returns: twilio.rest.ip_messaging.v2.service.channel.ChannelList - :rtype: twilio.rest.ip_messaging.v2.service.channel.ChannelList - """ - return self._proxy.channels - @property - def roles(self): - """ - Access the roles +class ServiceListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.ip_messaging.v2.service.role.RoleList - :rtype: twilio.rest.ip_messaging.v2.service.role.RoleList - """ - return self._proxy.roles + # Path Solution + self._solution = { } + self._uri = '/Services' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def users(self): - """ - Access the users + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.ip_messaging.v2.service.user.UserList - :rtype: twilio.rest.ip_messaging.v2.service.user.UserList - """ - return self._proxy.users + return ServiceInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def bindings(self): - """ - Access the bindings + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.ip_messaging.v2.service.binding.BindingList - :rtype: twilio.rest.ip_messaging.v2.service.binding.BindingList - """ - return self._proxy.bindings + return ServicePage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/ip_messaging/v2/service/channel.py b/twilio/rest/ip_messaging/v2/service/channel.py deleted file mode 100644 index 924b5a9cfc..0000000000 --- a/twilio/rest/ip_messaging/v2/service/channel.py +++ /dev/null @@ -1,195 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Ip_messaging - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.channel.invite import InviteListInstancefrom twilio.rest.channel.member import MemberListInstancefrom twilio.rest.channel.message import MessageListInstancefrom twilio.rest.channel.webhook import WebhookListInstance - - -class ChannelContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Channels/${sid}' - - self._invites = None - self._members = None - self._messages = None - self._webhooks = None - - def delete(self, x_twilio_webhook_enabled): - - - - """ - Deletes the ChannelInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ChannelInstance - - :returns: The fetched ChannelInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - def update(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ChannelInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'unique_name' : payload.get('unique_name'), - 'attributes' : payload.get('attributes'), - 'type' : payload.get('type'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'created_by' : payload.get('created_by'), - 'members_count' : payload.get('members_count'), - 'messages_count' : payload.get('messages_count'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ChannelContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def invites(self): - return self._proxy.invites - @property - def members(self): - return self._proxy.members - @property - def messages(self): - return self._proxy.messages - @property - def webhooks(self): - return self._proxy.webhooks - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ChannelListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Channels' - - - """ - def create(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, type, page_size): - - data = values.of({ - 'type': type,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ChannelPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/ip_messaging/v2/service/channel/__init__.py b/twilio/rest/ip_messaging/v2/service/channel/__init__.py index 8d6f15a21e..924b5a9cfc 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/channel/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,651 +19,177 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.ip_messaging.v2.service.channel.invite import InviteList -from twilio.rest.ip_messaging.v2.service.channel.member import MemberList -from twilio.rest.ip_messaging.v2.service.channel.message import MessageList -from twilio.rest.ip_messaging.v2.service.channel.webhook import WebhookList - - -class ChannelList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the ChannelList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.ip_messaging.v2.service.channel.ChannelList - :rtype: twilio.rest.ip_messaging.v2.service.channel.ChannelList - """ - super(ChannelList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Channels'.format(**self._solution) - - def create(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset, type=values.unset, - date_created=values.unset, date_updated=values.unset, - created_by=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Create the ChannelInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - :param unicode attributes: The attributes - :param ChannelInstance.ChannelType type: The type - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - :param unicode created_by: The created_by - :param ChannelInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The created ChannelInstance - :rtype: twilio.rest.ip_messaging.v2.service.channel.ChannelInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Attributes': attributes, - 'Type': type, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'CreatedBy': created_by, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, headers=headers, ) - - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, type=values.unset, limit=None, page_size=None): - """ - Streams ChannelInstance 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 list[ChannelInstance.ChannelType] type: The type - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.ip_messaging.v2.service.channel.ChannelInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(type=type, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, type=values.unset, limit=None, page_size=None): - """ - Lists ChannelInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param list[ChannelInstance.ChannelType] type: The type - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.ip_messaging.v2.service.channel.ChannelInstance] - """ - return list(self.stream(type=type, limit=limit, page_size=page_size, )) - - def page(self, type=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of ChannelInstance records from the API. - Request is executed immediately - - :param list[ChannelInstance.ChannelType] type: The type - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ChannelInstance - :rtype: twilio.rest.ip_messaging.v2.service.channel.ChannelPage - """ - data = values.of({ - 'Type': serialize.map(type, lambda e: e), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ChannelPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ChannelInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ChannelInstance - :rtype: twilio.rest.ip_messaging.v2.service.channel.ChannelPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ChannelPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ChannelContext - - :param sid: The sid - - :returns: twilio.rest.ip_messaging.v2.service.channel.ChannelContext - :rtype: twilio.rest.ip_messaging.v2.service.channel.ChannelContext - """ - return ChannelContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ChannelContext - - :param sid: The sid - - :returns: twilio.rest.ip_messaging.v2.service.channel.ChannelContext - :rtype: twilio.rest.ip_messaging.v2.service.channel.ChannelContext - """ - return ChannelContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ChannelPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ChannelPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.ip_messaging.v2.service.channel.ChannelPage - :rtype: twilio.rest.ip_messaging.v2.service.channel.ChannelPage - """ - super(ChannelPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ChannelInstance - - :param dict payload: Payload response from the API +from twilio.base.version import Version - :returns: twilio.rest.ip_messaging.v2.service.channel.ChannelInstance - :rtype: twilio.rest.ip_messaging.v2.service.channel.ChannelInstance - """ - return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.channel.invite import InviteListInstancefrom twilio.rest.channel.member import MemberListInstancefrom twilio.rest.channel.message import MessageListInstancefrom twilio.rest.channel.webhook import WebhookListInstance class ChannelContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the ChannelContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.ip_messaging.v2.service.channel.ChannelContext - :rtype: twilio.rest.ip_messaging.v2.service.channel.ChannelContext - """ - super(ChannelContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Channels/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Channels/${sid}' + + self._invites = None self._members = None self._messages = None - self._invites = None self._webhooks = None + + def delete(self, x_twilio_webhook_enabled): + + + + """ + Deletes the ChannelInstance + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the ChannelInstance :returns: The fetched ChannelInstance - :rtype: twilio.rest.ip_messaging.v2.service.channel.ChannelInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return ChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - def delete(self, x_twilio_webhook_enabled=values.unset): - """ - Deletes the ChannelInstance - - :param ChannelInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) - - def update(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset, date_created=values.unset, - date_updated=values.unset, created_by=values.unset, - x_twilio_webhook_enabled=values.unset): - """ - Update the ChannelInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - :param unicode attributes: The attributes - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - :param unicode created_by: The created_by - :param ChannelInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated ChannelInstance - :rtype: twilio.rest.ip_messaging.v2.service.channel.ChannelInstance - """ + + + def update(self, x_twilio_webhook_enabled, body): data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Attributes': attributes, - 'DateCreated': serialize.iso8601_datetime(date_created), - 'DateUpdated': serialize.iso8601_datetime(date_updated), - 'CreatedBy': created_by, + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) - - return ChannelInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def members(self): - """ - Access the members - :returns: twilio.rest.ip_messaging.v2.service.channel.member.MemberList - :rtype: twilio.rest.ip_messaging.v2.service.channel.member.MemberList - """ - if self._members is None: - self._members = MemberList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._members - - @property - def messages(self): - """ - Access the messages + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.ip_messaging.v2.service.channel.message.MessageList - :rtype: twilio.rest.ip_messaging.v2.service.channel.message.MessageList - """ - if self._messages is None: - self._messages = MessageList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._messages + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + - @property - def invites(self): - """ - Access the invites - - :returns: twilio.rest.ip_messaging.v2.service.channel.invite.InviteList - :rtype: twilio.rest.ip_messaging.v2.service.channel.invite.InviteList - """ - if self._invites is None: - self._invites = InviteList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._invites - - @property - def webhooks(self): - """ - Access the webhooks - - :returns: twilio.rest.ip_messaging.v2.service.channel.webhook.WebhookList - :rtype: twilio.rest.ip_messaging.v2.service.channel.webhook.WebhookList - """ - if self._webhooks is None: - self._webhooks = WebhookList( - self._version, - service_sid=self._solution['service_sid'], - channel_sid=self._solution['sid'], - ) - return self._webhooks + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class ChannelInstance(InstanceResource): - - class ChannelType(object): - PUBLIC = "public" - PRIVATE = "private" + return '' - class WebhookEnabledType(object): - TRUE = "true" - FALSE = "false" - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the ChannelInstance - :returns: twilio.rest.ip_messaging.v2.service.channel.ChannelInstance - :rtype: twilio.rest.ip_messaging.v2.service.channel.ChannelInstance - """ - super(ChannelInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'friendly_name': payload.get('friendly_name'), - 'unique_name': payload.get('unique_name'), - 'attributes': payload.get('attributes'), - 'type': payload.get('type'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'created_by': payload.get('created_by'), - 'members_count': deserialize.integer(payload.get('members_count')), - 'messages_count': deserialize.integer(payload.get('messages_count')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ChannelInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'unique_name' : payload.get('unique_name'), + 'attributes' : payload.get('attributes'), + 'type' : payload.get('type'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'created_by' : payload.get('created_by'), + 'members_count' : payload.get('members_count'), + 'messages_count' : payload.get('messages_count'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ChannelContext for this ChannelInstance - :rtype: twilio.rest.ip_messaging.v2.service.channel.ChannelContext - """ if self._context is None: self._context = ChannelContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def type(self): - """ - :returns: The type - :rtype: ChannelInstance.ChannelType - """ - return self._properties['type'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - @property - def members_count(self): - """ - :returns: The members_count - :rtype: unicode - """ - return self._properties['members_count'] - + def invites(self): + return self._proxy.invites @property - def messages_count(self): - """ - :returns: The messages_count - :rtype: unicode - """ - return self._properties['messages_count'] - + def members(self): + return self._proxy.members @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - + def messages(self): + return self._proxy.messages @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the ChannelInstance - - :returns: The fetched ChannelInstance - :rtype: twilio.rest.ip_messaging.v2.service.channel.ChannelInstance - """ - return self._proxy.fetch() - - def delete(self, x_twilio_webhook_enabled=values.unset): - """ - Deletes the ChannelInstance - - :param ChannelInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete(x_twilio_webhook_enabled=x_twilio_webhook_enabled, ) + def webhooks(self): + return self._proxy.webhooks + - def update(self, friendly_name=values.unset, unique_name=values.unset, - attributes=values.unset, date_created=values.unset, - date_updated=values.unset, created_by=values.unset, - x_twilio_webhook_enabled=values.unset): + def __repr__(self): """ - Update the ChannelInstance - - :param unicode friendly_name: The friendly_name - :param unicode unique_name: The unique_name - :param unicode attributes: The attributes - :param datetime date_created: The date_created - :param datetime date_updated: The date_updated - :param unicode created_by: The created_by - :param ChannelInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The updated ChannelInstance - :rtype: twilio.rest.ip_messaging.v2.service.channel.ChannelInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update( - friendly_name=friendly_name, - unique_name=unique_name, - attributes=attributes, - date_created=date_created, - date_updated=date_updated, - created_by=created_by, - x_twilio_webhook_enabled=x_twilio_webhook_enabled, - ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def members(self): - """ - Access the members - :returns: twilio.rest.ip_messaging.v2.service.channel.member.MemberList - :rtype: twilio.rest.ip_messaging.v2.service.channel.member.MemberList - """ - return self._proxy.members - @property - def messages(self): - """ - Access the messages +class ChannelListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.ip_messaging.v2.service.channel.message.MessageList - :rtype: twilio.rest.ip_messaging.v2.service.channel.message.MessageList - """ - return self._proxy.messages + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Channels' + + + """ + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - @property - def invites(self): - """ - Access the invites + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.ip_messaging.v2.service.channel.invite.InviteList - :rtype: twilio.rest.ip_messaging.v2.service.channel.invite.InviteList - """ - return self._proxy.invites + return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, type, page_size): + + data = values.of({ + 'type': type,'page_size': page_size, + }) - @property - def webhooks(self): - """ - Access the webhooks + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.ip_messaging.v2.service.channel.webhook.WebhookList - :rtype: twilio.rest.ip_messaging.v2.service.channel.webhook.WebhookList - """ - return self._proxy.webhooks + return ChannelPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/ip_messaging/v2/service/user.py b/twilio/rest/ip_messaging/v2/service/user.py deleted file mode 100644 index 33f1b3f6d3..0000000000 --- a/twilio/rest/ip_messaging/v2/service/user.py +++ /dev/null @@ -1,187 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Ip_messaging - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.user.user_binding import UserBindingListInstancefrom twilio.rest.user.user_channel import UserChannelListInstance - - -class UserContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Users/${sid}' - - self._user_bindings = None - self._user_channels = None - - def delete(self): - - - - """ - Deletes the UserInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the UserInstance - - :returns: The fetched UserInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - def update(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class UserInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'attributes' : payload.get('attributes'), - 'friendly_name' : payload.get('friendly_name'), - 'role_sid' : payload.get('role_sid'), - 'identity' : payload.get('identity'), - 'is_online' : payload.get('is_online'), - 'is_notifiable' : payload.get('is_notifiable'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'joined_channels_count' : payload.get('joined_channels_count'), - 'links' : payload.get('links'), - 'url' : payload.get('url'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = UserContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def user_bindings(self): - return self._proxy.user_bindings - @property - def user_channels(self): - return self._proxy.user_channels - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class UserListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Users' - - - """ - def create(self, x_twilio_webhook_enabled, body): - data = values.of({ - 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return UserPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/ip_messaging/v2/service/user/__init__.py b/twilio/rest/ip_messaging/v2/service/user/__init__.py index 29bb110025..33f1b3f6d3 100644 --- a/twilio/rest/ip_messaging/v2/service/user/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/user/__init__.py @@ -1,253 +1,47 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Ip_messaging + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.ip_messaging.v2.service.user.user_binding import UserBindingList -from twilio.rest.ip_messaging.v2.service.user.user_channel import UserChannelList - - -class UserList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the UserList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.ip_messaging.v2.service.user.UserList - :rtype: twilio.rest.ip_messaging.v2.service.user.UserList - """ - super(UserList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Users'.format(**self._solution) - - def create(self, identity, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Create the UserInstance - - :param unicode identity: The identity - :param unicode role_sid: The role_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name - :param UserInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header - - :returns: The created UserInstance - :rtype: twilio.rest.ip_messaging.v2.service.user.UserInstance - """ - data = values.of({ - 'Identity': identity, - 'RoleSid': role_sid, - 'Attributes': attributes, - 'FriendlyName': friendly_name, - }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, headers=headers, ) - - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams UserInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.ip_messaging.v2.service.user.UserInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists UserInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.ip_messaging.v2.service.user.UserInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of UserInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of UserInstance - :rtype: twilio.rest.ip_messaging.v2.service.user.UserPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return UserPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of UserInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of UserInstance - :rtype: twilio.rest.ip_messaging.v2.service.user.UserPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return UserPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a UserContext - - :param sid: The sid - - :returns: twilio.rest.ip_messaging.v2.service.user.UserContext - :rtype: twilio.rest.ip_messaging.v2.service.user.UserContext - """ - return UserContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a UserContext - - :param sid: The sid - - :returns: twilio.rest.ip_messaging.v2.service.user.UserContext - :rtype: twilio.rest.ip_messaging.v2.service.user.UserContext - """ - return UserContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.version import Version - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class UserPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the UserPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.ip_messaging.v2.service.user.UserPage - :rtype: twilio.rest.ip_messaging.v2.service.user.UserPage - """ - super(UserPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of UserInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.ip_messaging.v2.service.user.UserInstance - :rtype: twilio.rest.ip_messaging.v2.service.user.UserInstance - """ - return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.user.user_binding import UserBindingListInstancefrom twilio.rest.user.user_channel import UserChannelListInstance class UserContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the UserContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.ip_messaging.v2.service.user.UserContext - :rtype: twilio.rest.ip_messaging.v2.service.user.UserContext - """ - super(UserContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Users/{sid}'.format(**self._solution) - - # Dependents - self._user_channels = None + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Users/${sid}' + self._user_bindings = None - - def fetch(self): - """ - Fetch the UserInstance - - :returns: The fetched UserInstance - :rtype: twilio.rest.ip_messaging.v2.service.user.UserInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return UserInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - + self._user_channels = None + def delete(self): + + + """ Deletes the UserInstance @@ -255,305 +49,139 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset, x_twilio_webhook_enabled=values.unset): + + def fetch(self): + """ - Update the UserInstance - - :param unicode role_sid: The role_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name - :param UserInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header + Fetch the UserInstance - :returns: The updated UserInstance - :rtype: twilio.rest.ip_messaging.v2.service.user.UserInstance + :returns: The fetched UserInstance + #TODO: add rtype docs """ - data = values.of({'RoleSid': role_sid, 'Attributes': attributes, 'FriendlyName': friendly_name, }) - headers = values.of({'X-Twilio-Webhook-Enabled': x_twilio_webhook_enabled, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) + payload = self._version.fetch(method='GET', uri=self._uri, ) - return UserInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - @property - def user_channels(self): - """ - Access the user_channels + + + def update(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - :returns: twilio.rest.ip_messaging.v2.service.user.user_channel.UserChannelList - :rtype: twilio.rest.ip_messaging.v2.service.user.user_channel.UserChannelList - """ - if self._user_channels is None: - self._user_channels = UserChannelList( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['sid'], - ) - return self._user_channels + payload = self._version.update(method='post', uri=self._uri, data=data, ) - @property - def user_bindings(self): - """ - Access the user_bindings + return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + - :returns: twilio.rest.ip_messaging.v2.service.user.user_binding.UserBindingList - :rtype: twilio.rest.ip_messaging.v2.service.user.user_binding.UserBindingList - """ - if self._user_bindings is None: - self._user_bindings = UserBindingList( - self._version, - service_sid=self._solution['service_sid'], - user_sid=self._solution['sid'], - ) - return self._user_bindings + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class UserInstance(InstanceResource): - - class WebhookEnabledType(object): - TRUE = "true" - FALSE = "false" - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the UserInstance - - :returns: twilio.rest.ip_messaging.v2.service.user.UserInstance - :rtype: twilio.rest.ip_messaging.v2.service.user.UserInstance - """ - super(UserInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'attributes': payload.get('attributes'), - 'friendly_name': payload.get('friendly_name'), - 'role_sid': payload.get('role_sid'), - 'identity': payload.get('identity'), - 'is_online': payload.get('is_online'), - 'is_notifiable': payload.get('is_notifiable'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'joined_channels_count': deserialize.integer(payload.get('joined_channels_count')), - 'links': payload.get('links'), - 'url': payload.get('url'), +class UserInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'attributes' : payload.get('attributes'), + 'friendly_name' : payload.get('friendly_name'), + 'role_sid' : payload.get('role_sid'), + 'identity' : payload.get('identity'), + 'is_online' : payload.get('is_online'), + 'is_notifiable' : payload.get('is_notifiable'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'joined_channels_count' : payload.get('joined_channels_count'), + 'links' : payload.get('links'), + 'url' : payload.get('url'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: UserContext for this UserInstance - :rtype: twilio.rest.ip_messaging.v2.service.user.UserContext - """ if self._context is None: self._context = UserContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def attributes(self): - """ - :returns: The attributes - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def role_sid(self): - """ - :returns: The role_sid - :rtype: unicode - """ - return self._properties['role_sid'] - - @property - def identity(self): - """ - :returns: The identity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def is_online(self): - """ - :returns: The is_online - :rtype: bool - """ - return self._properties['is_online'] - - @property - def is_notifiable(self): - """ - :returns: The is_notifiable - :rtype: bool - """ - return self._properties['is_notifiable'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def joined_channels_count(self): - """ - :returns: The joined_channels_count - :rtype: unicode - """ - return self._properties['joined_channels_count'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - + def user_bindings(self): + return self._proxy.user_bindings @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the UserInstance + def user_channels(self): + return self._proxy.user_channels + - :returns: The fetched UserInstance - :rtype: twilio.rest.ip_messaging.v2.service.user.UserInstance + def __repr__(self): """ - return self._proxy.fetch() - - def delete(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the UserInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def update(self, role_sid=values.unset, attributes=values.unset, - friendly_name=values.unset, x_twilio_webhook_enabled=values.unset): - """ - Update the UserInstance - :param unicode role_sid: The role_sid - :param unicode attributes: The attributes - :param unicode friendly_name: The friendly_name - :param UserInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header +class UserListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The updated UserInstance - :rtype: twilio.rest.ip_messaging.v2.service.user.UserInstance - """ - return self._proxy.update( - role_sid=role_sid, - attributes=attributes, - friendly_name=friendly_name, - x_twilio_webhook_enabled=x_twilio_webhook_enabled, - ) + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Users' + + + """ + def create(self, x_twilio_webhook_enabled, body): + data = values.of({ + 'x_twilio_webhook_enabled': x_twilio_webhook_enabled,'body': body, + }) - @property - def user_channels(self): - """ - Access the user_channels + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.ip_messaging.v2.service.user.user_channel.UserChannelList - :rtype: twilio.rest.ip_messaging.v2.service.user.user_channel.UserChannelList - """ - return self._proxy.user_channels + return UserInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def user_bindings(self): - """ - Access the user_bindings + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.ip_messaging.v2.service.user.user_binding.UserBindingList - :rtype: twilio.rest.ip_messaging.v2.service.user.user_binding.UserBindingList - """ - return self._proxy.user_bindings + return UserPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/media/v1/media_recording/__init__.py b/twilio/rest/media/v1/media_recording/__init__.py deleted file mode 100644 index 5494c1bd77..0000000000 --- a/twilio/rest/media/v1/media_recording/__init__.py +++ /dev/null @@ -1,488 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class MediaRecordingList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the MediaRecordingList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.media.v1.media_recording.MediaRecordingList - :rtype: twilio.rest.media.v1.media_recording.MediaRecordingList - """ - super(MediaRecordingList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/MediaRecordings'.format(**self._solution) - - def stream(self, order=values.unset, status=values.unset, - processor_sid=values.unset, source_sid=values.unset, limit=None, - page_size=None): - """ - Streams MediaRecordingInstance 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 MediaRecordingInstance.Order order: The sort order of the list - :param MediaRecordingInstance.Status status: Status to filter by - :param unicode processor_sid: MediaProcessor to filter by - :param unicode source_sid: Source SID to filter by - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.media.v1.media_recording.MediaRecordingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - order=order, - status=status, - processor_sid=processor_sid, - source_sid=source_sid, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, order=values.unset, status=values.unset, - processor_sid=values.unset, source_sid=values.unset, limit=None, - page_size=None): - """ - Lists MediaRecordingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param MediaRecordingInstance.Order order: The sort order of the list - :param MediaRecordingInstance.Status status: Status to filter by - :param unicode processor_sid: MediaProcessor to filter by - :param unicode source_sid: Source SID to filter by - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.media.v1.media_recording.MediaRecordingInstance] - """ - return list(self.stream( - order=order, - status=status, - processor_sid=processor_sid, - source_sid=source_sid, - limit=limit, - page_size=page_size, - )) - - def page(self, order=values.unset, status=values.unset, - processor_sid=values.unset, source_sid=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of MediaRecordingInstance records from the API. - Request is executed immediately - - :param MediaRecordingInstance.Order order: The sort order of the list - :param MediaRecordingInstance.Status status: Status to filter by - :param unicode processor_sid: MediaProcessor to filter by - :param unicode source_sid: Source SID to filter by - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of MediaRecordingInstance - :rtype: twilio.rest.media.v1.media_recording.MediaRecordingPage - """ - data = values.of({ - 'Order': order, - 'Status': status, - 'ProcessorSid': processor_sid, - 'SourceSid': source_sid, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return MediaRecordingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of MediaRecordingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of MediaRecordingInstance - :rtype: twilio.rest.media.v1.media_recording.MediaRecordingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return MediaRecordingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a MediaRecordingContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.media.v1.media_recording.MediaRecordingContext - :rtype: twilio.rest.media.v1.media_recording.MediaRecordingContext - """ - return MediaRecordingContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a MediaRecordingContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.media.v1.media_recording.MediaRecordingContext - :rtype: twilio.rest.media.v1.media_recording.MediaRecordingContext - """ - return MediaRecordingContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class MediaRecordingPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the MediaRecordingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.media.v1.media_recording.MediaRecordingPage - :rtype: twilio.rest.media.v1.media_recording.MediaRecordingPage - """ - super(MediaRecordingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MediaRecordingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.media.v1.media_recording.MediaRecordingInstance - :rtype: twilio.rest.media.v1.media_recording.MediaRecordingInstance - """ - return MediaRecordingInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class MediaRecordingContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the MediaRecordingContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.media.v1.media_recording.MediaRecordingContext - :rtype: twilio.rest.media.v1.media_recording.MediaRecordingContext - """ - super(MediaRecordingContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/MediaRecordings/{sid}'.format(**self._solution) - - def delete(self): - """ - Deletes the MediaRecordingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - """ - Fetch the MediaRecordingInstance - - :returns: The fetched MediaRecordingInstance - :rtype: twilio.rest.media.v1.media_recording.MediaRecordingInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return MediaRecordingInstance(self._version, payload, sid=self._solution['sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class MediaRecordingInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class Format(object): - MP4 = "mp4" - WEBM = "webm" - - class Order(object): - ASC = "asc" - DESC = "desc" - - class Status(object): - PROCESSING = "processing" - COMPLETED = "completed" - DELETED = "deleted" - FAILED = "failed" - - def __init__(self, version, payload, sid=None): - """ - Initialize the MediaRecordingInstance - - :returns: twilio.rest.media.v1.media_recording.MediaRecordingInstance - :rtype: twilio.rest.media.v1.media_recording.MediaRecordingInstance - """ - super(MediaRecordingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'duration': deserialize.integer(payload.get('duration')), - 'format': payload.get('format'), - 'links': payload.get('links'), - 'processor_sid': payload.get('processor_sid'), - 'resolution': payload.get('resolution'), - 'source_sid': payload.get('source_sid'), - 'sid': payload.get('sid'), - 'media_size': deserialize.integer(payload.get('media_size')), - 'status': payload.get('status'), - 'status_callback': payload.get('status_callback'), - 'status_callback_method': payload.get('status_callback_method'), - 'url': payload.get('url'), - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: MediaRecordingContext for this MediaRecordingInstance - :rtype: twilio.rest.media.v1.media_recording.MediaRecordingContext - """ - if self._context is None: - self._context = MediaRecordingContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def duration(self): - """ - :returns: The duration of the MediaRecording - :rtype: unicode - """ - return self._properties['duration'] - - @property - def format(self): - """ - :returns: The format of the MediaRecording - :rtype: MediaRecordingInstance.Format - """ - return self._properties['format'] - - @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - - @property - def processor_sid(self): - """ - :returns: The SID of the MediaProcessor - :rtype: unicode - """ - return self._properties['processor_sid'] - - @property - def resolution(self): - """ - :returns: The dimensions of the video image in pixels - :rtype: unicode - """ - return self._properties['resolution'] - - @property - def source_sid(self): - """ - :returns: The SID of the resource that generated the original media - :rtype: unicode - """ - return self._properties['source_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def media_size(self): - """ - :returns: The size of the recording media - :rtype: unicode - """ - return self._properties['media_size'] - - @property - def status(self): - """ - :returns: The status of the MediaRecording - :rtype: MediaRecordingInstance.Status - """ - return self._properties['status'] - - @property - def status_callback(self): - """ - :returns: The URL to which Twilio will send MediaRecording event updates - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: The HTTP method Twilio should use to call the `status_callback` URL - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - def delete(self): - """ - Deletes the MediaRecordingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch the MediaRecordingInstance - - :returns: The fetched MediaRecordingInstance - :rtype: twilio.rest.media.v1.media_recording.MediaRecordingInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) diff --git a/twilio/rest/media/v1/player_streamer.py b/twilio/rest/media/v1/player_streamer.py deleted file mode 100644 index 8d63f98fcc..0000000000 --- a/twilio/rest/media/v1/player_streamer.py +++ /dev/null @@ -1,169 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Media - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.player_streamer.playback_grant import PlaybackGrantListInstance - - -class PlayerStreamerContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/PlayerStreamers/${sid}' - - self._playback_grant = None - - def fetch(self): - - """ - Fetch the PlayerStreamerInstance - - :returns: The fetched PlayerStreamerInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return PlayerStreamerInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return PlayerStreamerInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class PlayerStreamerInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'video' : payload.get('video'), - 'links' : payload.get('links'), - 'sid' : payload.get('sid'), - 'status' : payload.get('status'), - 'url' : payload.get('url'), - 'status_callback' : payload.get('status_callback'), - 'status_callback_method' : payload.get('status_callback_method'), - 'ended_reason' : payload.get('ended_reason'), - 'max_duration' : payload.get('max_duration'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = PlayerStreamerContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def playback_grant(self): - return self._proxy.playback_grant - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class PlayerStreamerListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/PlayerStreamers' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return PlayerStreamerInstance(self._version, payload, ) - - """ - - """ - def page(self, order, status, page_size): - - data = values.of({ - 'order': order,'status': status,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return PlayerStreamerPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/media/v1/player_streamer/__init__.py b/twilio/rest/media/v1/player_streamer/__init__.py index 4169809f2a..8d63f98fcc 100644 --- a/twilio/rest/media/v1/player_streamer/__init__.py +++ b/twilio/rest/media/v1/player_streamer/__init__.py @@ -1,487 +1,169 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Media + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.media.v1.player_streamer.playback_grant import PlaybackGrantList - - -class PlayerStreamerList(ListResource): - - def __init__(self, version): - """ - Initialize the PlayerStreamerList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.media.v1.player_streamer.PlayerStreamerList - :rtype: twilio.rest.media.v1.player_streamer.PlayerStreamerList - """ - super(PlayerStreamerList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/PlayerStreamers'.format(**self._solution) - - def create(self, video=values.unset, status_callback=values.unset, - status_callback_method=values.unset, max_duration=values.unset): - """ - Create the PlayerStreamerInstance - - :param bool video: Whether the PlayerStreamer is configured to stream video - :param unicode status_callback: The URL to which Twilio will send PlayerStreamer event updates - :param unicode status_callback_method: The HTTP method Twilio should use to call the `status_callback` URL - :param unicode max_duration: Maximum PlayerStreamer duration in seconds - - :returns: The created PlayerStreamerInstance - :rtype: twilio.rest.media.v1.player_streamer.PlayerStreamerInstance - """ - data = values.of({ - 'Video': video, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'MaxDuration': max_duration, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return PlayerStreamerInstance(self._version, payload, ) +from twilio.base.version import Version - def stream(self, order=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Streams PlayerStreamerInstance 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 PlayerStreamerInstance.Order order: The sort order of the list - :param PlayerStreamerInstance.Status status: Status to filter by - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.media.v1.player_streamer.PlayerStreamerInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(order=order, status=status, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, order=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Lists PlayerStreamerInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param PlayerStreamerInstance.Order order: The sort order of the list - :param PlayerStreamerInstance.Status status: Status to filter by - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.media.v1.player_streamer.PlayerStreamerInstance] - """ - return list(self.stream(order=order, status=status, limit=limit, page_size=page_size, )) - - def page(self, order=values.unset, status=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of PlayerStreamerInstance records from the API. - Request is executed immediately - - :param PlayerStreamerInstance.Order order: The sort order of the list - :param PlayerStreamerInstance.Status status: Status to filter by - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of PlayerStreamerInstance - :rtype: twilio.rest.media.v1.player_streamer.PlayerStreamerPage - """ - data = values.of({ - 'Order': order, - 'Status': status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return PlayerStreamerPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of PlayerStreamerInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of PlayerStreamerInstance - :rtype: twilio.rest.media.v1.player_streamer.PlayerStreamerPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return PlayerStreamerPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a PlayerStreamerContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.media.v1.player_streamer.PlayerStreamerContext - :rtype: twilio.rest.media.v1.player_streamer.PlayerStreamerContext - """ - return PlayerStreamerContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a PlayerStreamerContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.media.v1.player_streamer.PlayerStreamerContext - :rtype: twilio.rest.media.v1.player_streamer.PlayerStreamerContext - """ - return PlayerStreamerContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class PlayerStreamerPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the PlayerStreamerPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.media.v1.player_streamer.PlayerStreamerPage - :rtype: twilio.rest.media.v1.player_streamer.PlayerStreamerPage - """ - super(PlayerStreamerPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of PlayerStreamerInstance - - :param dict payload: Payload response from the API +from twilio.base.page import Page - :returns: twilio.rest.media.v1.player_streamer.PlayerStreamerInstance - :rtype: twilio.rest.media.v1.player_streamer.PlayerStreamerInstance - """ - return PlayerStreamerInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.player_streamer.playback_grant import PlaybackGrantListInstance class PlayerStreamerContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the PlayerStreamerContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.media.v1.player_streamer.PlayerStreamerContext - :rtype: twilio.rest.media.v1.player_streamer.PlayerStreamerContext - """ - super(PlayerStreamerContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/PlayerStreamers/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/PlayerStreamers/${sid}' + self._playback_grant = None - + def fetch(self): + """ Fetch the PlayerStreamerInstance :returns: The fetched PlayerStreamerInstance - :rtype: twilio.rest.media.v1.player_streamer.PlayerStreamerInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return PlayerStreamerInstance(self._version, payload, sid=self._solution['sid'], ) + - def update(self, status): - """ - Update the PlayerStreamerInstance - - :param PlayerStreamerInstance.UpdateStatus status: The status the PlayerStreamer should be transitioned to - - :returns: The updated PlayerStreamerInstance - :rtype: twilio.rest.media.v1.player_streamer.PlayerStreamerInstance - """ - data = values.of({'Status': status, }) + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return PlayerStreamerInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def playback_grant(self): - """ - Access the playback_grant - - :returns: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantList - :rtype: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantList - """ - if self._playback_grant is None: - self._playback_grant = PlaybackGrantList(self._version, sid=self._solution['sid'], ) - return self._playback_grant + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class PlayerStreamerInstance(InstanceResource): - - class Status(object): - CREATED = "created" - STARTED = "started" - ENDED = "ended" - FAILED = "failed" - - class UpdateStatus(object): - ENDED = "ended" - - class Order(object): - ASC = "asc" - DESC = "desc" - - class EndedReason(object): - ENDED_VIA_API = "ended-via-api" - MAX_DURATION_EXCEEDED = "max-duration-exceeded" - STREAM_DISCONNECTED_BY_SOURCE = "stream-disconnected-by-source" - UNEXPECTED_FAILURE = "unexpected-failure" - - def __init__(self, version, payload, sid=None): - """ - Initialize the PlayerStreamerInstance - :returns: twilio.rest.media.v1.player_streamer.PlayerStreamerInstance - :rtype: twilio.rest.media.v1.player_streamer.PlayerStreamerInstance - """ - super(PlayerStreamerInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'video': payload.get('video'), - 'links': payload.get('links'), - 'sid': payload.get('sid'), - 'status': payload.get('status'), - 'url': payload.get('url'), - 'status_callback': payload.get('status_callback'), - 'status_callback_method': payload.get('status_callback_method'), - 'ended_reason': payload.get('ended_reason'), - 'max_duration': deserialize.integer(payload.get('max_duration')), +class PlayerStreamerInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'video' : payload.get('video'), + 'links' : payload.get('links'), + 'sid' : payload.get('sid'), + 'status' : payload.get('status'), + 'url' : payload.get('url'), + 'status_callback' : payload.get('status_callback'), + 'status_callback_method' : payload.get('status_callback_method'), + 'ended_reason' : payload.get('ended_reason'), + 'max_duration' : payload.get('max_duration'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PlayerStreamerContext for this PlayerStreamerInstance - :rtype: twilio.rest.media.v1.player_streamer.PlayerStreamerContext - """ if self._context is None: - self._context = PlayerStreamerContext(self._version, sid=self._solution['sid'], ) + self._context = PlayerStreamerContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def video(self): - """ - :returns: Whether the PlayerStreamer is configured to stream video - :rtype: bool - """ - return self._properties['video'] - - @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def status(self): - """ - :returns: The status of the PlayerStreamer - :rtype: PlayerStreamerInstance.Status - """ - return self._properties['status'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] + def playback_grant(self): + return self._proxy.playback_grant + - @property - def status_callback(self): + def __repr__(self): """ - :returns: The URL to which Twilio will send PlayerStreamer event updates - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['status_callback'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def status_callback_method(self): - """ - :returns: The HTTP method Twilio should use to call the `status_callback` URL - :rtype: unicode - """ - return self._properties['status_callback_method'] - @property - def ended_reason(self): - """ - :returns: The reason why a PlayerStreamer ended - :rtype: PlayerStreamerInstance.EndedReason - """ - return self._properties['ended_reason'] - @property - def max_duration(self): - """ - :returns: Maximum PlayerStreamer duration in seconds - :rtype: unicode - """ - return self._properties['max_duration'] +class PlayerStreamerListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - def fetch(self): - """ - Fetch the PlayerStreamerInstance - - :returns: The fetched PlayerStreamerInstance - :rtype: twilio.rest.media.v1.player_streamer.PlayerStreamerInstance - """ - return self._proxy.fetch() - - def update(self, status): - """ - Update the PlayerStreamerInstance + # Path Solution + self._solution = { } + self._uri = '/PlayerStreamers' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - :param PlayerStreamerInstance.UpdateStatus status: The status the PlayerStreamer should be transitioned to + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: The updated PlayerStreamerInstance - :rtype: twilio.rest.media.v1.player_streamer.PlayerStreamerInstance - """ - return self._proxy.update(status, ) + return PlayerStreamerInstance(self._version, payload, ) + + """ + + """ + def page(self, order, status, page_size): + + data = values.of({ + 'order': order,'status': status,'page_size': page_size, + }) - @property - def playback_grant(self): - """ - Access the playback_grant + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantList - :rtype: twilio.rest.media.v1.player_streamer.playback_grant.PlaybackGrantList - """ - return self._proxy.playback_grant + return PlayerStreamerPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/messaging/v1/brand_registration.py b/twilio/rest/messaging/v1/brand_registration.py deleted file mode 100644 index 30e15ea8d7..0000000000 --- a/twilio/rest/messaging/v1/brand_registration.py +++ /dev/null @@ -1,177 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Messaging - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.brand_registration.brand_vetting import BrandVettingListInstance - - -class BrandRegistrationContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/a2p/BrandRegistrations/${sid}' - - self._brand_vettings = None - - def fetch(self): - - """ - Fetch the BrandRegistrationInstance - - :returns: The fetched BrandRegistrationInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return BrandRegistrationInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self): - data = values.of({ - - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return BrandRegistrationInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class BrandRegistrationInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'customer_profile_bundle_sid' : payload.get('customer_profile_bundle_sid'), - 'a2p_profile_bundle_sid' : payload.get('a2p_profile_bundle_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'brand_type' : payload.get('brand_type'), - 'status' : payload.get('status'), - 'tcr_id' : payload.get('tcr_id'), - 'failure_reason' : payload.get('failure_reason'), - 'url' : payload.get('url'), - 'brand_score' : payload.get('brand_score'), - 'brand_feedback' : payload.get('brand_feedback'), - 'identity_status' : payload.get('identity_status'), - 'russell_3000' : payload.get('russell_3000'), - 'government_entity' : payload.get('government_entity'), - 'tax_exempt_status' : payload.get('tax_exempt_status'), - 'skip_automatic_sec_vet' : payload.get('skip_automatic_sec_vet'), - 'mock' : payload.get('mock'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = BrandRegistrationContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def brand_vettings(self): - return self._proxy.brand_vettings - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class BrandRegistrationListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/a2p/BrandRegistrations' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return BrandRegistrationInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return BrandRegistrationPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/messaging/v1/brand_registration/__init__.py b/twilio/rest/messaging/v1/brand_registration/__init__.py index d987b2225e..30e15ea8d7 100644 --- a/twilio/rest/messaging/v1/brand_registration/__init__.py +++ b/twilio/rest/messaging/v1/brand_registration/__init__.py @@ -1,551 +1,177 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.messaging.v1.brand_registration.brand_vetting import BrandVettingList - - -class BrandRegistrationList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the BrandRegistrationList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.messaging.v1.brand_registration.BrandRegistrationList - :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationList - """ - super(BrandRegistrationList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/a2p/BrandRegistrations'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams BrandRegistrationInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.messaging.v1.brand_registration.BrandRegistrationInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists BrandRegistrationInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.messaging.v1.brand_registration.BrandRegistrationInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of BrandRegistrationInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of BrandRegistrationInstance - :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) +from twilio.base.version import Version - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return BrandRegistrationPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of BrandRegistrationInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of BrandRegistrationInstance - :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return BrandRegistrationPage(self._version, response, self._solution) - - def create(self, customer_profile_bundle_sid, a2p_profile_bundle_sid, - brand_type=values.unset, mock=values.unset, - skip_automatic_sec_vet=values.unset): - """ - Create the BrandRegistrationInstance - - :param unicode customer_profile_bundle_sid: Customer Profile Bundle Sid - :param unicode a2p_profile_bundle_sid: A2P Messaging Profile Bundle Sid - :param unicode brand_type: Type of brand being created. One of: "STANDARD", "STARTER". - :param bool mock: A boolean that specifies whether brand should be a mock or not. If true, brand will be registered as a mock brand. Defaults to false if no value is provided. - :param bool skip_automatic_sec_vet: Skip Automatic Secondary Vetting - - :returns: The created BrandRegistrationInstance - :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationInstance - """ - data = values.of({ - 'CustomerProfileBundleSid': customer_profile_bundle_sid, - 'A2PProfileBundleSid': a2p_profile_bundle_sid, - 'BrandType': brand_type, - 'Mock': mock, - 'SkipAutomaticSecVet': skip_automatic_sec_vet, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return BrandRegistrationInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a BrandRegistrationContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.messaging.v1.brand_registration.BrandRegistrationContext - :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationContext - """ - return BrandRegistrationContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a BrandRegistrationContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.messaging.v1.brand_registration.BrandRegistrationContext - :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationContext - """ - return BrandRegistrationContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class BrandRegistrationPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the BrandRegistrationPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.messaging.v1.brand_registration.BrandRegistrationPage - :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationPage - """ - super(BrandRegistrationPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of BrandRegistrationInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.messaging.v1.brand_registration.BrandRegistrationInstance - :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationInstance - """ - return BrandRegistrationInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.brand_registration.brand_vetting import BrandVettingListInstance class BrandRegistrationContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the BrandRegistrationContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.messaging.v1.brand_registration.BrandRegistrationContext - :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationContext - """ - super(BrandRegistrationContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/a2p/BrandRegistrations/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/a2p/BrandRegistrations/${sid}' + self._brand_vettings = None - + def fetch(self): + """ Fetch the BrandRegistrationInstance :returns: The fetched BrandRegistrationInstance - :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return BrandRegistrationInstance(self._version, payload, sid=self._solution['sid'], ) + + + def update(self): - """ - Update the BrandRegistrationInstance + data = values.of({ + + }) - :returns: The updated BrandRegistrationInstance - :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationInstance - """ - payload = self._version.update(method='POST', uri=self._uri, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return BrandRegistrationInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def brand_vettings(self): - """ - Access the brand_vettings - - :returns: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingList - :rtype: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingList - """ - if self._brand_vettings is None: - self._brand_vettings = BrandVettingList(self._version, brand_sid=self._solution['sid'], ) - return self._brand_vettings + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class BrandRegistrationInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Status(object): - PENDING = "PENDING" - APPROVED = "APPROVED" - FAILED = "FAILED" - IN_REVIEW = "IN_REVIEW" - DELETED = "DELETED" - - class IdentityStatus(object): - SELF_DECLARED = "SELF_DECLARED" - UNVERIFIED = "UNVERIFIED" - VERIFIED = "VERIFIED" - VETTED_VERIFIED = "VETTED_VERIFIED" - - class BrandFeedback(object): - TAX_ID = "TAX_ID" - STOCK_SYMBOL = "STOCK_SYMBOL" - NONPROFIT = "NONPROFIT" - GOVERNMENT_ENTITY = "GOVERNMENT_ENTITY" - OTHERS = "OTHERS" - - def __init__(self, version, payload, sid=None): - """ - Initialize the BrandRegistrationInstance - :returns: twilio.rest.messaging.v1.brand_registration.BrandRegistrationInstance - :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationInstance - """ - super(BrandRegistrationInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'customer_profile_bundle_sid': payload.get('customer_profile_bundle_sid'), - 'a2p_profile_bundle_sid': payload.get('a2p_profile_bundle_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'brand_type': payload.get('brand_type'), - 'status': payload.get('status'), - 'tcr_id': payload.get('tcr_id'), - 'failure_reason': payload.get('failure_reason'), - 'url': payload.get('url'), - 'brand_score': deserialize.integer(payload.get('brand_score')), - 'brand_feedback': payload.get('brand_feedback'), - 'identity_status': payload.get('identity_status'), - 'russell_3000': payload.get('russell_3000'), - 'government_entity': payload.get('government_entity'), - 'tax_exempt_status': payload.get('tax_exempt_status'), - 'skip_automatic_sec_vet': payload.get('skip_automatic_sec_vet'), - 'mock': payload.get('mock'), - 'links': payload.get('links'), +class BrandRegistrationInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'customer_profile_bundle_sid' : payload.get('customer_profile_bundle_sid'), + 'a2p_profile_bundle_sid' : payload.get('a2p_profile_bundle_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'brand_type' : payload.get('brand_type'), + 'status' : payload.get('status'), + 'tcr_id' : payload.get('tcr_id'), + 'failure_reason' : payload.get('failure_reason'), + 'url' : payload.get('url'), + 'brand_score' : payload.get('brand_score'), + 'brand_feedback' : payload.get('brand_feedback'), + 'identity_status' : payload.get('identity_status'), + 'russell_3000' : payload.get('russell_3000'), + 'government_entity' : payload.get('government_entity'), + 'tax_exempt_status' : payload.get('tax_exempt_status'), + 'skip_automatic_sec_vet' : payload.get('skip_automatic_sec_vet'), + 'mock' : payload.get('mock'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: BrandRegistrationContext for this BrandRegistrationInstance - :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationContext - """ if self._context is None: - self._context = BrandRegistrationContext(self._version, sid=self._solution['sid'], ) + self._context = BrandRegistrationContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: A2P BrandRegistration Sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def customer_profile_bundle_sid(self): - """ - :returns: A2P Messaging Profile Bundle BundleSid - :rtype: unicode - """ - return self._properties['customer_profile_bundle_sid'] - - @property - def a2p_profile_bundle_sid(self): - """ - :returns: A2P Messaging Profile Bundle BundleSid - :rtype: unicode - """ - return self._properties['a2p_profile_bundle_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def brand_type(self): - """ - :returns: Type of brand. One of: "STANDARD", "STARTER". - :rtype: unicode - """ - return self._properties['brand_type'] - - @property - def status(self): - """ - :returns: Brand Registration status. - :rtype: BrandRegistrationInstance.Status - """ - return self._properties['status'] - - @property - def tcr_id(self): - """ - :returns: Campaign Registry (TCR) Brand ID - :rtype: unicode - """ - return self._properties['tcr_id'] - - @property - def failure_reason(self): - """ - :returns: A reason why brand registration has failed - :rtype: unicode - """ - return self._properties['failure_reason'] - - @property - def url(self): - """ - :returns: The absolute URL of the Brand Registration - :rtype: unicode - """ - return self._properties['url'] - - @property - def brand_score(self): - """ - :returns: Brand score - :rtype: unicode - """ - return self._properties['brand_score'] - - @property - def brand_feedback(self): - """ - :returns: Brand feedback - :rtype: list[BrandRegistrationInstance.BrandFeedback] - """ - return self._properties['brand_feedback'] - - @property - def identity_status(self): - """ - :returns: Identity Status - :rtype: BrandRegistrationInstance.IdentityStatus - """ - return self._properties['identity_status'] - - @property - def russell_3000(self): - """ - :returns: Russell 3000 - :rtype: bool - """ - return self._properties['russell_3000'] + def brand_vettings(self): + return self._proxy.brand_vettings + - @property - def government_entity(self): + def __repr__(self): """ - :returns: Government Entity - :rtype: bool + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['government_entity'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def tax_exempt_status(self): - """ - :returns: Tax Exempt Status - :rtype: unicode - """ - return self._properties['tax_exempt_status'] - @property - def skip_automatic_sec_vet(self): - """ - :returns: Skip Automatic Secondary Vetting - :rtype: bool - """ - return self._properties['skip_automatic_sec_vet'] - @property - def mock(self): - """ - :returns: A boolean that specifies whether brand should be a mock or not. If true, brand will be registered as a mock brand. Defaults to false if no value is provided. - :rtype: bool - """ - return self._properties['mock'] +class BrandRegistrationListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the BrandRegistrationInstance - - :returns: The fetched BrandRegistrationInstance - :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '/a2p/BrandRegistrations' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - def update(self): - """ - Update the BrandRegistrationInstance + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: The updated BrandRegistrationInstance - :rtype: twilio.rest.messaging.v1.brand_registration.BrandRegistrationInstance - """ - return self._proxy.update() + return BrandRegistrationInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def brand_vettings(self): - """ - Access the brand_vettings + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingList - :rtype: twilio.rest.messaging.v1.brand_registration.brand_vetting.BrandVettingList - """ - return self._proxy.brand_vettings + return BrandRegistrationPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/messaging/v1/deactivation.py b/twilio/rest/messaging/v1/deactivation.py deleted file mode 100644 index 35b593031b..0000000000 --- a/twilio/rest/messaging/v1/deactivation.py +++ /dev/null @@ -1,200 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DeactivationsList(ListResource): - - def __init__(self, version): - """ - Initialize the DeactivationsList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.messaging.v1.deactivation.DeactivationsList - :rtype: twilio.rest.messaging.v1.deactivation.DeactivationsList - """ - super(DeactivationsList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self): - """ - Constructs a DeactivationsContext - - :returns: twilio.rest.messaging.v1.deactivation.DeactivationsContext - :rtype: twilio.rest.messaging.v1.deactivation.DeactivationsContext - """ - return DeactivationsContext(self._version, ) - - def __call__(self): - """ - Constructs a DeactivationsContext - - :returns: twilio.rest.messaging.v1.deactivation.DeactivationsContext - :rtype: twilio.rest.messaging.v1.deactivation.DeactivationsContext - """ - return DeactivationsContext(self._version, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class DeactivationsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the DeactivationsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.messaging.v1.deactivation.DeactivationsPage - :rtype: twilio.rest.messaging.v1.deactivation.DeactivationsPage - """ - super(DeactivationsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DeactivationsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.messaging.v1.deactivation.DeactivationsInstance - :rtype: twilio.rest.messaging.v1.deactivation.DeactivationsInstance - """ - return DeactivationsInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class DeactivationsContext(InstanceContext): - - def __init__(self, version): - """ - Initialize the DeactivationsContext - - :param Version version: Version that contains the resource - - :returns: twilio.rest.messaging.v1.deactivation.DeactivationsContext - :rtype: twilio.rest.messaging.v1.deactivation.DeactivationsContext - """ - super(DeactivationsContext, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Deactivations'.format(**self._solution) - - def fetch(self, date=values.unset): - """ - Fetch the DeactivationsInstance - - :param date date: The date to retrieve deactivated numbers for. - - :returns: The fetched DeactivationsInstance - :rtype: twilio.rest.messaging.v1.deactivation.DeactivationsInstance - """ - data = values.of({'Date': serialize.iso8601_date(date), }) - - payload = self._version.fetch(method='GET', uri=self._uri, params=data, ) - - return DeactivationsInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class DeactivationsInstance(InstanceResource): - - def __init__(self, version, payload): - """ - Initialize the DeactivationsInstance - - :returns: twilio.rest.messaging.v1.deactivation.DeactivationsInstance - :rtype: twilio.rest.messaging.v1.deactivation.DeactivationsInstance - """ - super(DeactivationsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = {'redirect_to': payload.get('redirect_to'), } - - # Context - self._context = None - self._solution = {} - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DeactivationsContext for this DeactivationsInstance - :rtype: twilio.rest.messaging.v1.deactivation.DeactivationsContext - """ - if self._context is None: - self._context = DeactivationsContext(self._version, ) - return self._context - - @property - def redirect_to(self): - """ - :returns: Redirect url to the list of deactivated numbers. - :rtype: unicode - """ - return self._properties['redirect_to'] - - def fetch(self, date=values.unset): - """ - Fetch the DeactivationsInstance - - :param date date: The date to retrieve deactivated numbers for. - - :returns: The fetched DeactivationsInstance - :rtype: twilio.rest.messaging.v1.deactivation.DeactivationsInstance - """ - return self._proxy.fetch(date=date, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) diff --git a/twilio/rest/messaging/v1/domain_cert.py b/twilio/rest/messaging/v1/domain_cert.py deleted file mode 100644 index 21ffcd29e0..0000000000 --- a/twilio/rest/messaging/v1/domain_cert.py +++ /dev/null @@ -1,316 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DomainCertsList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the DomainCertsList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.messaging.v1.domain_cert.DomainCertsList - :rtype: twilio.rest.messaging.v1.domain_cert.DomainCertsList - """ - super(DomainCertsList, self).__init__(version) - - # Path Solution - self._solution = {} - - def get(self, domain_sid): - """ - Constructs a DomainCertsContext - - :param domain_sid: Unique string used to identify the domain that this certificate should be associated with. - - :returns: twilio.rest.messaging.v1.domain_cert.DomainCertsContext - :rtype: twilio.rest.messaging.v1.domain_cert.DomainCertsContext - """ - return DomainCertsContext(self._version, domain_sid=domain_sid, ) - - def __call__(self, domain_sid): - """ - Constructs a DomainCertsContext - - :param domain_sid: Unique string used to identify the domain that this certificate should be associated with. - - :returns: twilio.rest.messaging.v1.domain_cert.DomainCertsContext - :rtype: twilio.rest.messaging.v1.domain_cert.DomainCertsContext - """ - return DomainCertsContext(self._version, domain_sid=domain_sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class DomainCertsPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the DomainCertsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.messaging.v1.domain_cert.DomainCertsPage - :rtype: twilio.rest.messaging.v1.domain_cert.DomainCertsPage - """ - super(DomainCertsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DomainCertsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.messaging.v1.domain_cert.DomainCertsInstance - :rtype: twilio.rest.messaging.v1.domain_cert.DomainCertsInstance - """ - return DomainCertsInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class DomainCertsContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, domain_sid): - """ - Initialize the DomainCertsContext - - :param Version version: Version that contains the resource - :param domain_sid: Unique string used to identify the domain that this certificate should be associated with. - - :returns: twilio.rest.messaging.v1.domain_cert.DomainCertsContext - :rtype: twilio.rest.messaging.v1.domain_cert.DomainCertsContext - """ - super(DomainCertsContext, self).__init__(version) - - # Path Solution - self._solution = {'domain_sid': domain_sid, } - self._uri = '/LinkShortening/Domains/{domain_sid}/Certificate'.format(**self._solution) - - def update(self, tls_cert): - """ - Update the DomainCertsInstance - - :param unicode tls_cert: Certificate and private key information for this domain. - - :returns: The updated DomainCertsInstance - :rtype: twilio.rest.messaging.v1.domain_cert.DomainCertsInstance - """ - data = values.of({'TlsCert': tls_cert, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return DomainCertsInstance(self._version, payload, domain_sid=self._solution['domain_sid'], ) - - def fetch(self): - """ - Fetch the DomainCertsInstance - - :returns: The fetched DomainCertsInstance - :rtype: twilio.rest.messaging.v1.domain_cert.DomainCertsInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DomainCertsInstance(self._version, payload, domain_sid=self._solution['domain_sid'], ) - - def delete(self): - """ - Deletes the DomainCertsInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class DomainCertsInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, domain_sid=None): - """ - Initialize the DomainCertsInstance - - :returns: twilio.rest.messaging.v1.domain_cert.DomainCertsInstance - :rtype: twilio.rest.messaging.v1.domain_cert.DomainCertsInstance - """ - super(DomainCertsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'domain_sid': payload.get('domain_sid'), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'date_expires': deserialize.iso8601_datetime(payload.get('date_expires')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'domain_name': payload.get('domain_name'), - 'certificate_sid': payload.get('certificate_sid'), - 'url': payload.get('url'), - 'validated': payload.get('validated'), - } - - # Context - self._context = None - self._solution = {'domain_sid': domain_sid or self._properties['domain_sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DomainCertsContext for this DomainCertsInstance - :rtype: twilio.rest.messaging.v1.domain_cert.DomainCertsContext - """ - if self._context is None: - self._context = DomainCertsContext(self._version, domain_sid=self._solution['domain_sid'], ) - return self._context - - @property - def domain_sid(self): - """ - :returns: The unique string that we created to identify the Domain resource. - :rtype: unicode - """ - return self._properties['domain_sid'] - - @property - def date_updated(self): - """ - :returns: Date that this Domain was last updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def date_expires(self): - """ - :returns: Expiration date for your private certificate. - :rtype: datetime - """ - return self._properties['date_expires'] - - @property - def date_created(self): - """ - :returns: Date this Domain SID was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def domain_name(self): - """ - :returns: Full url path for this domain. - :rtype: unicode - """ - return self._properties['domain_name'] - - @property - def certificate_sid(self): - """ - :returns: The unique string that we created to identify this Certificate resource. - :rtype: unicode - """ - return self._properties['certificate_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def validated(self): - """ - :returns: Certificate validation field - :rtype: bool - """ - return self._properties['validated'] - - def update(self, tls_cert): - """ - Update the DomainCertsInstance - - :param unicode tls_cert: Certificate and private key information for this domain. - - :returns: The updated DomainCertsInstance - :rtype: twilio.rest.messaging.v1.domain_cert.DomainCertsInstance - """ - return self._proxy.update(tls_cert, ) - - def fetch(self): - """ - Fetch the DomainCertsInstance - - :returns: The fetched DomainCertsInstance - :rtype: twilio.rest.messaging.v1.domain_cert.DomainCertsInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the DomainCertsInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) diff --git a/twilio/rest/messaging/v1/service.py b/twilio/rest/messaging/v1/service.py deleted file mode 100644 index e38ce1d10b..0000000000 --- a/twilio/rest/messaging/v1/service.py +++ /dev/null @@ -1,208 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Messaging - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.service.alpha_sender import AlphaSenderListInstancefrom twilio.rest.service.phone_number import PhoneNumberListInstancefrom twilio.rest.service.short_code import ShortCodeListInstancefrom twilio.rest.service.us_app_to_person import UsAppToPersonListInstancefrom twilio.rest.service.us_app_to_person_usecase import UsAppToPersonUsecaseListInstance - - -class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Services/${sid}' - - self._alpha_senders = None - self._phone_numbers = None - self._short_codes = None - self._us_app_to_person = None - self._us_app_to_person_usecases = None - - def delete(self): - - - - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'inbound_request_url' : payload.get('inbound_request_url'), - 'inbound_method' : payload.get('inbound_method'), - 'fallback_url' : payload.get('fallback_url'), - 'fallback_method' : payload.get('fallback_method'), - 'status_callback' : payload.get('status_callback'), - 'sticky_sender' : payload.get('sticky_sender'), - 'mms_converter' : payload.get('mms_converter'), - 'smart_encoding' : payload.get('smart_encoding'), - 'scan_message_content' : payload.get('scan_message_content'), - 'fallback_to_long_code' : payload.get('fallback_to_long_code'), - 'area_code_geomatch' : payload.get('area_code_geomatch'), - 'synchronous_validation' : payload.get('synchronous_validation'), - 'validity_period' : payload.get('validity_period'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - 'usecase' : payload.get('usecase'), - 'us_app_to_person_registered' : payload.get('us_app_to_person_registered'), - 'use_inbound_webhook_on_number' : payload.get('use_inbound_webhook_on_number'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ServiceContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def alpha_senders(self): - return self._proxy.alpha_senders - @property - def phone_numbers(self): - return self._proxy.phone_numbers - @property - def short_codes(self): - return self._proxy.short_codes - @property - def us_app_to_person(self): - return self._proxy.us_app_to_person - @property - def us_app_to_person_usecases(self): - return self._proxy.us_app_to_person_usecases - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ServiceListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Services' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ServicePage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/messaging/v1/service/__init__.py b/twilio/rest/messaging/v1/service/__init__.py index 6ca9422d87..e38ce1d10b 100644 --- a/twilio/rest/messaging/v1/service/__init__.py +++ b/twilio/rest/messaging/v1/service/__init__.py @@ -1,339 +1,50 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Messaging + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.messaging.v1.service.alpha_sender import AlphaSenderList -from twilio.rest.messaging.v1.service.phone_number import PhoneNumberList -from twilio.rest.messaging.v1.service.short_code import ShortCodeList -from twilio.rest.messaging.v1.service.us_app_to_person import UsAppToPersonList -from twilio.rest.messaging.v1.service.us_app_to_person_usecase import UsAppToPersonUsecaseList - - -class ServiceList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.messaging.v1.service.ServiceList - :rtype: twilio.rest.messaging.v1.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def create(self, friendly_name, inbound_request_url=values.unset, - inbound_method=values.unset, fallback_url=values.unset, - fallback_method=values.unset, status_callback=values.unset, - sticky_sender=values.unset, mms_converter=values.unset, - smart_encoding=values.unset, scan_message_content=values.unset, - fallback_to_long_code=values.unset, area_code_geomatch=values.unset, - validity_period=values.unset, synchronous_validation=values.unset, - usecase=values.unset, use_inbound_webhook_on_number=values.unset): - """ - Create the ServiceInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode inbound_request_url: The URL we call using inbound_method when a message is received by any phone number or short code in the Service. This field will be overridden if the `use_inbound_webhook_on_number` field is enabled. - :param unicode inbound_method: The HTTP method we should use to call inbound_request_url - :param unicode fallback_url: The URL that we call using fallback_method if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. This field will be overridden if the `use_inbound_webhook_on_number` field is enabled. - :param unicode fallback_method: The HTTP method we should use to call fallback_url - :param unicode status_callback: The URL we should call to pass status updates about message delivery - :param bool sticky_sender: Whether to enable Sticky Sender on the Service instance - :param bool mms_converter: Whether to enable the MMS Converter for messages sent through the Service instance - :param bool smart_encoding: Whether to enable Encoding for messages sent through the Service instance - :param ServiceInstance.ScanMessageContent scan_message_content: Reserved - :param bool fallback_to_long_code: Whether to enable Fallback to Long Code for messages sent through the Service instance - :param bool area_code_geomatch: Whether to enable Area Code Geomatch on the Service Instance - :param unicode validity_period: How long, in seconds, messages sent from the Service are valid - :param bool synchronous_validation: Reserved - :param unicode usecase: A string describing the scenario in which the Messaging Service will be used - :param bool use_inbound_webhook_on_number: If enabled, the webhook url configured on the phone number will be used and will override the `inbound_request_url`/`fallback_url` url called when an inbound message is received. - - :returns: The created ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'InboundRequestUrl': inbound_request_url, - 'InboundMethod': inbound_method, - 'FallbackUrl': fallback_url, - 'FallbackMethod': fallback_method, - 'StatusCallback': status_callback, - 'StickySender': sticky_sender, - 'MmsConverter': mms_converter, - 'SmartEncoding': smart_encoding, - 'ScanMessageContent': scan_message_content, - 'FallbackToLongCode': fallback_to_long_code, - 'AreaCodeGeomatch': area_code_geomatch, - 'ValidityPeriod': validity_period, - 'SynchronousValidation': synchronous_validation, - 'Usecase': usecase, - 'UseInboundWebhookOnNumber': use_inbound_webhook_on_number, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.messaging.v1.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.messaging.v1.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServicePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.messaging.v1.service.ServiceContext - :rtype: twilio.rest.messaging.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.messaging.v1.service.ServiceContext - :rtype: twilio.rest.messaging.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base.version import Version +from twilio.base.page import Page -class ServicePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.messaging.v1.service.ServicePage - :rtype: twilio.rest.messaging.v1.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.messaging.v1.service.ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.service.alpha_sender import AlphaSenderListInstancefrom twilio.rest.service.phone_number import PhoneNumberListInstancefrom twilio.rest.service.short_code import ShortCodeListInstancefrom twilio.rest.service.us_app_to_person import UsAppToPersonListInstancefrom twilio.rest.service.us_app_to_person_usecase import UsAppToPersonUsecaseListInstance class ServiceContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.messaging.v1.service.ServiceContext - :rtype: twilio.rest.messaging.v1.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Services/${sid}' + + self._alpha_senders = None self._phone_numbers = None self._short_codes = None - self._alpha_senders = None self._us_app_to_person = None self._us_app_to_person_usecases = None - - def update(self, friendly_name=values.unset, inbound_request_url=values.unset, - inbound_method=values.unset, fallback_url=values.unset, - fallback_method=values.unset, status_callback=values.unset, - sticky_sender=values.unset, mms_converter=values.unset, - smart_encoding=values.unset, scan_message_content=values.unset, - fallback_to_long_code=values.unset, area_code_geomatch=values.unset, - validity_period=values.unset, synchronous_validation=values.unset, - usecase=values.unset, use_inbound_webhook_on_number=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode inbound_request_url: The URL we call using inbound_method when a message is received by any phone number or short code in the Service. This field will be overridden if the `use_inbound_webhook_on_number` field is enabled. - :param unicode inbound_method: The HTTP method we should use to call inbound_request_url - :param unicode fallback_url: The URL that we call using fallback_method if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. This field will be overridden if the `use_inbound_webhook_on_number` field is enabled. - :param unicode fallback_method: The HTTP method we should use to call fallback_url - :param unicode status_callback: The URL we should call to pass status updates about message delivery - :param bool sticky_sender: Whether to enable Sticky Sender on the Service instance - :param bool mms_converter: Whether to enable the MMS Converter for messages sent through the Service instance - :param bool smart_encoding: Whether to enable Encoding for messages sent through the Service instance - :param ServiceInstance.ScanMessageContent scan_message_content: Reserved - :param bool fallback_to_long_code: Whether to enable Fallback to Long Code for messages sent through the Service instance - :param bool area_code_geomatch: Whether to enable Area Code Geomatch on the Service Instance - :param unicode validity_period: How long, in seconds, messages sent from the Service are valid - :param bool synchronous_validation: Reserved - :param unicode usecase: A string describing the scenario in which the Messaging Service will be used - :param bool use_inbound_webhook_on_number: If enabled, the webhook url configured on the phone number will be used and will override the `inbound_request_url`/`fallback_url` url called when an inbound message is received. - - :returns: The updated ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'InboundRequestUrl': inbound_request_url, - 'InboundMethod': inbound_method, - 'FallbackUrl': fallback_url, - 'FallbackMethod': fallback_method, - 'StatusCallback': status_callback, - 'StickySender': sticky_sender, - 'MmsConverter': mms_converter, - 'SmartEncoding': smart_encoding, - 'ScanMessageContent': scan_message_content, - 'FallbackToLongCode': fallback_to_long_code, - 'AreaCodeGeomatch': area_code_geomatch, - 'ValidityPeriod': validity_period, - 'SynchronousValidation': synchronous_validation, - 'Usecase': usecase, - 'UseInboundWebhookOnNumber': use_inbound_webhook_on_number, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - def fetch(self): - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServiceInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - + def delete(self): + + + """ Deletes the ServiceInstance @@ -341,454 +52,157 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def phone_numbers(self): - """ - Access the phone_numbers - - :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberList - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberList - """ - if self._phone_numbers is None: - self._phone_numbers = PhoneNumberList(self._version, service_sid=self._solution['sid'], ) - return self._phone_numbers - - @property - def short_codes(self): - """ - Access the short_codes - - :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeList - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeList + + def fetch(self): + """ - if self._short_codes is None: - self._short_codes = ShortCodeList(self._version, service_sid=self._solution['sid'], ) - return self._short_codes + Fetch the ServiceInstance - @property - def alpha_senders(self): + :returns: The fetched ServiceInstance + #TODO: add rtype docs """ - Access the alpha_senders + payload = self._version.fetch(method='GET', uri=self._uri, ) - :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderList - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderList - """ - if self._alpha_senders is None: - self._alpha_senders = AlphaSenderList(self._version, service_sid=self._solution['sid'], ) - return self._alpha_senders + return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + - @property - def us_app_to_person(self): - """ - Access the us_app_to_person + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonList - :rtype: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonList - """ - if self._us_app_to_person is None: - self._us_app_to_person = UsAppToPersonList( - self._version, - messaging_service_sid=self._solution['sid'], - ) - return self._us_app_to_person + payload = self._version.update(method='post', uri=self._uri, data=data, ) - @property - def us_app_to_person_usecases(self): - """ - Access the us_app_to_person_usecases + return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + - :returns: twilio.rest.messaging.v1.service.us_app_to_person_usecase.UsAppToPersonUsecaseList - :rtype: twilio.rest.messaging.v1.service.us_app_to_person_usecase.UsAppToPersonUsecaseList - """ - if self._us_app_to_person_usecases is None: - self._us_app_to_person_usecases = UsAppToPersonUsecaseList( - self._version, - messaging_service_sid=self._solution['sid'], - ) - return self._us_app_to_person_usecases + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class ServiceInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - class ScanMessageContent(object): - INHERIT = "inherit" - ENABLE = "enable" - DISABLE = "disable" - - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - :returns: twilio.rest.messaging.v1.service.ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'inbound_request_url': payload.get('inbound_request_url'), - 'inbound_method': payload.get('inbound_method'), - 'fallback_url': payload.get('fallback_url'), - 'fallback_method': payload.get('fallback_method'), - 'status_callback': payload.get('status_callback'), - 'sticky_sender': payload.get('sticky_sender'), - 'mms_converter': payload.get('mms_converter'), - 'smart_encoding': payload.get('smart_encoding'), - 'scan_message_content': payload.get('scan_message_content'), - 'fallback_to_long_code': payload.get('fallback_to_long_code'), - 'area_code_geomatch': payload.get('area_code_geomatch'), - 'synchronous_validation': payload.get('synchronous_validation'), - 'validity_period': deserialize.integer(payload.get('validity_period')), - 'url': payload.get('url'), - 'links': payload.get('links'), - 'usecase': payload.get('usecase'), - 'us_app_to_person_registered': payload.get('us_app_to_person_registered'), - 'use_inbound_webhook_on_number': payload.get('use_inbound_webhook_on_number'), +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'inbound_request_url' : payload.get('inbound_request_url'), + 'inbound_method' : payload.get('inbound_method'), + 'fallback_url' : payload.get('fallback_url'), + 'fallback_method' : payload.get('fallback_method'), + 'status_callback' : payload.get('status_callback'), + 'sticky_sender' : payload.get('sticky_sender'), + 'mms_converter' : payload.get('mms_converter'), + 'smart_encoding' : payload.get('smart_encoding'), + 'scan_message_content' : payload.get('scan_message_content'), + 'fallback_to_long_code' : payload.get('fallback_to_long_code'), + 'area_code_geomatch' : payload.get('area_code_geomatch'), + 'synchronous_validation' : payload.get('synchronous_validation'), + 'validity_period' : payload.get('validity_period'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), + 'usecase' : payload.get('usecase'), + 'us_app_to_person_registered' : payload.get('us_app_to_person_registered'), + 'use_inbound_webhook_on_number' : payload.get('use_inbound_webhook_on_number'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServiceContext - """ if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def inbound_request_url(self): - """ - :returns: The URL we call using inbound_method when a message is received by any phone number or short code in the Service. This field will be overridden if the `use_inbound_webhook_on_number` field is enabled. - :rtype: unicode - """ - return self._properties['inbound_request_url'] - - @property - def inbound_method(self): - """ - :returns: The HTTP method we use to call inbound_request_url - :rtype: unicode - """ - return self._properties['inbound_method'] - - @property - def fallback_url(self): - """ - :returns: The URL that we call using fallback_method if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. This field will be overridden if the `use_inbound_webhook_on_number` field is enabled. - :rtype: unicode - """ - return self._properties['fallback_url'] - - @property - def fallback_method(self): - """ - :returns: The HTTP method we use to call fallback_url - :rtype: unicode - """ - return self._properties['fallback_method'] - - @property - def status_callback(self): - """ - :returns: The URL we call to pass status updates about message delivery - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def sticky_sender(self): - """ - :returns: Whether to enable Sticky Sender on the Service instance - :rtype: bool - """ - return self._properties['sticky_sender'] - - @property - def mms_converter(self): - """ - :returns: Whether to enable the MMS Converter for messages sent through the Service instance - :rtype: bool - """ - return self._properties['mms_converter'] - - @property - def smart_encoding(self): - """ - :returns: Whether to enable Encoding for messages sent through the Service instance - :rtype: bool - """ - return self._properties['smart_encoding'] - - @property - def scan_message_content(self): - """ - :returns: Reserved - :rtype: ServiceInstance.ScanMessageContent - """ - return self._properties['scan_message_content'] - - @property - def fallback_to_long_code(self): - """ - :returns: Whether to enable Fallback to Long Code for messages sent through the Service instance - :rtype: bool - """ - return self._properties['fallback_to_long_code'] - - @property - def area_code_geomatch(self): - """ - :returns: Whether to enable Area Code Geomatch on the Service Instance - :rtype: bool - """ - return self._properties['area_code_geomatch'] - - @property - def synchronous_validation(self): - """ - :returns: Reserved - :rtype: bool - """ - return self._properties['synchronous_validation'] - - @property - def validity_period(self): - """ - :returns: How long, in seconds, messages sent from the Service are valid - :rtype: unicode - """ - return self._properties['validity_period'] - - @property - def url(self): - """ - :returns: The absolute URL of the Service resource - :rtype: unicode - """ - return self._properties['url'] - + def alpha_senders(self): + return self._proxy.alpha_senders @property - def links(self): - """ - :returns: The absolute URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - + def phone_numbers(self): + return self._proxy.phone_numbers @property - def usecase(self): - """ - :returns: A string describing the scenario in which the Messaging Service will be used - :rtype: unicode - """ - return self._properties['usecase'] - + def short_codes(self): + return self._proxy.short_codes @property - def us_app_to_person_registered(self): - """ - :returns: Whether US A2P campaign is registered for this Service. - :rtype: bool - """ - return self._properties['us_app_to_person_registered'] - + def us_app_to_person(self): + return self._proxy.us_app_to_person @property - def use_inbound_webhook_on_number(self): - """ - :returns: If enabled, the webhook url configured on the phone number will be used and will override the `inbound_request_url`/`fallback_url` url called when an inbound message is received. - :rtype: bool - """ - return self._properties['use_inbound_webhook_on_number'] - - def update(self, friendly_name=values.unset, inbound_request_url=values.unset, - inbound_method=values.unset, fallback_url=values.unset, - fallback_method=values.unset, status_callback=values.unset, - sticky_sender=values.unset, mms_converter=values.unset, - smart_encoding=values.unset, scan_message_content=values.unset, - fallback_to_long_code=values.unset, area_code_geomatch=values.unset, - validity_period=values.unset, synchronous_validation=values.unset, - usecase=values.unset, use_inbound_webhook_on_number=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode inbound_request_url: The URL we call using inbound_method when a message is received by any phone number or short code in the Service. This field will be overridden if the `use_inbound_webhook_on_number` field is enabled. - :param unicode inbound_method: The HTTP method we should use to call inbound_request_url - :param unicode fallback_url: The URL that we call using fallback_method if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. This field will be overridden if the `use_inbound_webhook_on_number` field is enabled. - :param unicode fallback_method: The HTTP method we should use to call fallback_url - :param unicode status_callback: The URL we should call to pass status updates about message delivery - :param bool sticky_sender: Whether to enable Sticky Sender on the Service instance - :param bool mms_converter: Whether to enable the MMS Converter for messages sent through the Service instance - :param bool smart_encoding: Whether to enable Encoding for messages sent through the Service instance - :param ServiceInstance.ScanMessageContent scan_message_content: Reserved - :param bool fallback_to_long_code: Whether to enable Fallback to Long Code for messages sent through the Service instance - :param bool area_code_geomatch: Whether to enable Area Code Geomatch on the Service Instance - :param unicode validity_period: How long, in seconds, messages sent from the Service are valid - :param bool synchronous_validation: Reserved - :param unicode usecase: A string describing the scenario in which the Messaging Service will be used - :param bool use_inbound_webhook_on_number: If enabled, the webhook url configured on the phone number will be used and will override the `inbound_request_url`/`fallback_url` url called when an inbound message is received. - - :returns: The updated ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServiceInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - inbound_request_url=inbound_request_url, - inbound_method=inbound_method, - fallback_url=fallback_url, - fallback_method=fallback_method, - status_callback=status_callback, - sticky_sender=sticky_sender, - mms_converter=mms_converter, - smart_encoding=smart_encoding, - scan_message_content=scan_message_content, - fallback_to_long_code=fallback_to_long_code, - area_code_geomatch=area_code_geomatch, - validity_period=validity_period, - synchronous_validation=synchronous_validation, - usecase=usecase, - use_inbound_webhook_on_number=use_inbound_webhook_on_number, - ) - - def fetch(self): - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - :rtype: twilio.rest.messaging.v1.service.ServiceInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + def us_app_to_person_usecases(self): + return self._proxy.us_app_to_person_usecases + - @property - def phone_numbers(self): + def __repr__(self): """ - Access the phone_numbers - - :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberList - :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberList + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.phone_numbers + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def short_codes(self): - """ - Access the short_codes - :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeList - :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeList - """ - return self._proxy.short_codes - @property - def alpha_senders(self): - """ - Access the alpha_senders +class ServiceListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderList - :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderList - """ - return self._proxy.alpha_senders + # Path Solution + self._solution = { } + self._uri = '/Services' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def us_app_to_person(self): - """ - Access the us_app_to_person + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonList - :rtype: twilio.rest.messaging.v1.service.us_app_to_person.UsAppToPersonList - """ - return self._proxy.us_app_to_person + return ServiceInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def us_app_to_person_usecases(self): - """ - Access the us_app_to_person_usecases + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.messaging.v1.service.us_app_to_person_usecase.UsAppToPersonUsecaseList - :rtype: twilio.rest.messaging.v1.service.us_app_to_person_usecase.UsAppToPersonUsecaseList - """ - return self._proxy.us_app_to_person_usecases + return ServicePage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/microvisor/v1/device.py b/twilio/rest/microvisor/v1/device.py deleted file mode 100644 index eb03b28851..0000000000 --- a/twilio/rest/microvisor/v1/device.py +++ /dev/null @@ -1,158 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Microvisor - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.device.device_config import DeviceConfigListInstancefrom twilio.rest.device.device_secret import DeviceSecretListInstance - - -class DeviceContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Devices/${sid}' - - self._device_configs = None - self._device_secrets = None - - def fetch(self): - - """ - Fetch the DeviceInstance - - :returns: The fetched DeviceInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DeviceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return DeviceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class DeviceInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'account_sid' : payload.get('account_sid'), - 'app' : payload.get('app'), - 'logging' : payload.get('logging'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = DeviceContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def device_configs(self): - return self._proxy.device_configs - @property - def device_secrets(self): - return self._proxy.device_secrets - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class DeviceListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Devices' - - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return DevicePage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/microvisor/v1/device/__init__.py b/twilio/rest/microvisor/v1/device/__init__.py index 9cbb4f54b7..eb03b28851 100644 --- a/twilio/rest/microvisor/v1/device/__init__.py +++ b/twilio/rest/microvisor/v1/device/__init__.py @@ -1,403 +1,158 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Microvisor + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class DeviceList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the DeviceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.microvisor.v1.device.DeviceList - :rtype: twilio.rest.microvisor.v1.device.DeviceList - """ - super(DeviceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Devices'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams DeviceInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.microvisor.v1.device.DeviceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DeviceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.microvisor.v1.device.DeviceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DeviceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of DeviceInstance - :rtype: twilio.rest.microvisor.v1.device.DevicePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return DevicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DeviceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DeviceInstance - :rtype: twilio.rest.microvisor.v1.device.DevicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DevicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a DeviceContext - - :param sid: A string that uniquely identifies this Device. - - :returns: twilio.rest.microvisor.v1.device.DeviceContext - :rtype: twilio.rest.microvisor.v1.device.DeviceContext - """ - return DeviceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a DeviceContext - - :param sid: A string that uniquely identifies this Device. +from twilio.base.version import Version - :returns: twilio.rest.microvisor.v1.device.DeviceContext - :rtype: twilio.rest.microvisor.v1.device.DeviceContext - """ - return DeviceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class DevicePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the DevicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.microvisor.v1.device.DevicePage - :rtype: twilio.rest.microvisor.v1.device.DevicePage - """ - super(DevicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DeviceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.microvisor.v1.device.DeviceInstance - :rtype: twilio.rest.microvisor.v1.device.DeviceInstance - """ - return DeviceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.device.device_config import DeviceConfigListInstancefrom twilio.rest.device.device_secret import DeviceSecretListInstance class DeviceContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the DeviceContext - - :param Version version: Version that contains the resource - :param sid: A string that uniquely identifies this Device. - - :returns: twilio.rest.microvisor.v1.device.DeviceContext - :rtype: twilio.rest.microvisor.v1.device.DeviceContext - """ - super(DeviceContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Devices/{sid}'.format(**self._solution) - + self._solution = { 'sid': sid, } + self._uri = '/Devices/${sid}' + + self._device_configs = None + self._device_secrets = None + def fetch(self): + """ Fetch the DeviceInstance :returns: The fetched DeviceInstance - :rtype: twilio.rest.microvisor.v1.device.DeviceInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return DeviceInstance(self._version, payload, sid=self._solution['sid'], ) + - def update(self, unique_name=values.unset, target_app=values.unset, - logging_enabled=values.unset): - """ - Update the DeviceInstance - - :param unicode unique_name: A unique, developer-assigned name for this Device. - :param unicode target_app: The target App SID or unique name. - :param bool logging_enabled: Whether to enable logging. - - :returns: The updated DeviceInstance - :rtype: twilio.rest.microvisor.v1.device.DeviceInstance - """ + + + def update(self, body): data = values.of({ - 'UniqueName': unique_name, - 'TargetApp': target_app, - 'LoggingEnabled': logging_enabled, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return DeviceInstance(self._version, payload, sid=self._solution['sid'], ) + + + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class DeviceInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, sid=None): - """ - Initialize the DeviceInstance - - :returns: twilio.rest.microvisor.v1.device.DeviceInstance - :rtype: twilio.rest.microvisor.v1.device.DeviceInstance - """ - super(DeviceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'account_sid': payload.get('account_sid'), - 'app': payload.get('app'), - 'logging': payload.get('logging'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class DeviceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'account_sid' : payload.get('account_sid'), + 'app' : payload.get('app'), + 'logging' : payload.get('logging'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DeviceContext for this DeviceInstance - :rtype: twilio.rest.microvisor.v1.device.DeviceContext - """ if self._context is None: - self._context = DeviceContext(self._version, sid=self._solution['sid'], ) + self._context = DeviceContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: A string that uniquely identifies this Device. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: A developer-defined string that uniquely identifies the Device. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: Account SID. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def app(self): - """ - :returns: Information about the target App and the App reported by this Device. - :rtype: dict - """ - return self._properties['app'] - + def device_configs(self): + return self._proxy.device_configs @property - def logging(self): - """ - :returns: Object specifying whether application logging is enabled for this Device. - :rtype: dict - """ - return self._properties['logging'] + def device_secrets(self): + return self._proxy.device_secrets + - @property - def date_created(self): - """ - :returns: The date that this Device was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this Device was last updated. - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): + def __repr__(self): """ - :returns: The URL of this resource. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def links(self): - """ - :returns: The absolute URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - def fetch(self): - """ - Fetch the DeviceInstance - :returns: The fetched DeviceInstance - :rtype: twilio.rest.microvisor.v1.device.DeviceInstance - """ - return self._proxy.fetch() +class DeviceListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - def update(self, unique_name=values.unset, target_app=values.unset, - logging_enabled=values.unset): - """ - Update the DeviceInstance + # Path Solution + self._solution = { } + self._uri = '/Devices' + + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - :param unicode unique_name: A unique, developer-assigned name for this Device. - :param unicode target_app: The target App SID or unique name. - :param bool logging_enabled: Whether to enable logging. + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: The updated DeviceInstance - :rtype: twilio.rest.microvisor.v1.device.DeviceInstance - """ - return self._proxy.update( - unique_name=unique_name, - target_app=target_app, - logging_enabled=logging_enabled, - ) + return DevicePage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/notify/v1/service.py b/twilio/rest/notify/v1/service.py deleted file mode 100644 index 23bafef584..0000000000 --- a/twilio/rest/notify/v1/service.py +++ /dev/null @@ -1,193 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Notify - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.service.binding import BindingListInstancefrom twilio.rest.service.notification import NotificationListInstance - - -class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Services/${sid}' - - self._bindings = None - self._notifications = None - - def delete(self): - - - - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'apn_credential_sid' : payload.get('apn_credential_sid'), - 'gcm_credential_sid' : payload.get('gcm_credential_sid'), - 'fcm_credential_sid' : payload.get('fcm_credential_sid'), - 'messaging_service_sid' : payload.get('messaging_service_sid'), - 'facebook_messenger_page_id' : payload.get('facebook_messenger_page_id'), - 'default_apn_notification_protocol_version' : payload.get('default_apn_notification_protocol_version'), - 'default_gcm_notification_protocol_version' : payload.get('default_gcm_notification_protocol_version'), - 'default_fcm_notification_protocol_version' : payload.get('default_fcm_notification_protocol_version'), - 'log_enabled' : payload.get('log_enabled'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - 'alexa_skill_id' : payload.get('alexa_skill_id'), - 'default_alexa_notification_protocol_version' : payload.get('default_alexa_notification_protocol_version'), - 'delivery_callback_url' : payload.get('delivery_callback_url'), - 'delivery_callback_enabled' : payload.get('delivery_callback_enabled'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ServiceContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def bindings(self): - return self._proxy.bindings - @property - def notifications(self): - return self._proxy.notifications - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ServiceListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Services' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - """ - - """ - def page(self, friendly_name, page_size): - - data = values.of({ - 'friendly_name': friendly_name,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ServicePage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/notify/v1/service/__init__.py b/twilio/rest/notify/v1/service/__init__.py index 586c12b2af..23bafef584 100644 --- a/twilio/rest/notify/v1/service/__init__.py +++ b/twilio/rest/notify/v1/service/__init__.py @@ -1,275 +1,47 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Notify + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.notify.v1.service.binding import BindingList -from twilio.rest.notify.v1.service.notification import NotificationList - - -class ServiceList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.notify.v1.service.ServiceList - :rtype: twilio.rest.notify.v1.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def create(self, friendly_name=values.unset, apn_credential_sid=values.unset, - gcm_credential_sid=values.unset, messaging_service_sid=values.unset, - facebook_messenger_page_id=values.unset, - default_apn_notification_protocol_version=values.unset, - default_gcm_notification_protocol_version=values.unset, - fcm_credential_sid=values.unset, - default_fcm_notification_protocol_version=values.unset, - log_enabled=values.unset, alexa_skill_id=values.unset, - default_alexa_notification_protocol_version=values.unset, - delivery_callback_url=values.unset, - delivery_callback_enabled=values.unset): - """ - Create the ServiceInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode apn_credential_sid: The SID of the Credential to use for APN Bindings - :param unicode gcm_credential_sid: The SID of the Credential to use for GCM Bindings - :param unicode messaging_service_sid: The SID of the Messaging Service to use for SMS Bindings - :param unicode facebook_messenger_page_id: Deprecated - :param unicode default_apn_notification_protocol_version: The protocol version to use for sending APNS notifications - :param unicode default_gcm_notification_protocol_version: The protocol version to use for sending GCM notifications - :param unicode fcm_credential_sid: The SID of the Credential to use for FCM Bindings - :param unicode default_fcm_notification_protocol_version: The protocol version to use for sending FCM notifications - :param bool log_enabled: Whether to log notifications - :param unicode alexa_skill_id: Deprecated - :param unicode default_alexa_notification_protocol_version: Deprecated - :param unicode delivery_callback_url: Webhook URL - :param bool delivery_callback_enabled: Enable delivery callbacks - - :returns: The created ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'ApnCredentialSid': apn_credential_sid, - 'GcmCredentialSid': gcm_credential_sid, - 'MessagingServiceSid': messaging_service_sid, - 'FacebookMessengerPageId': facebook_messenger_page_id, - 'DefaultApnNotificationProtocolVersion': default_apn_notification_protocol_version, - 'DefaultGcmNotificationProtocolVersion': default_gcm_notification_protocol_version, - 'FcmCredentialSid': fcm_credential_sid, - 'DefaultFcmNotificationProtocolVersion': default_fcm_notification_protocol_version, - 'LogEnabled': log_enabled, - 'AlexaSkillId': alexa_skill_id, - 'DefaultAlexaNotificationProtocolVersion': default_alexa_notification_protocol_version, - 'DeliveryCallbackUrl': delivery_callback_url, - 'DeliveryCallbackEnabled': delivery_callback_enabled, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) +from twilio.base.version import Version - return ServiceInstance(self._version, payload, ) - - def stream(self, friendly_name=values.unset, limit=None, page_size=None): - """ - Streams ServiceInstance 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 unicode friendly_name: The string that identifies the Service resources to read - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.notify.v1.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(friendly_name=friendly_name, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, friendly_name=values.unset, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode friendly_name: The string that identifies the Service resources to read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.notify.v1.service.ServiceInstance] - """ - return list(self.stream(friendly_name=friendly_name, limit=limit, page_size=page_size, )) - - def page(self, friendly_name=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param unicode friendly_name: The string that identifies the Service resources to read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServicePage - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.notify.v1.service.ServiceContext - :rtype: twilio.rest.notify.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.notify.v1.service.ServiceContext - :rtype: twilio.rest.notify.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ServicePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.notify.v1.service.ServicePage - :rtype: twilio.rest.notify.v1.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.notify.v1.service.ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.service.binding import BindingListInstancefrom twilio.rest.service.notification import NotificationListInstance class ServiceContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.notify.v1.service.ServiceContext - :rtype: twilio.rest.notify.v1.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Services/${sid}' + self._bindings = None self._notifications = None - + def delete(self): + + + """ Deletes the ServiceInstance @@ -277,413 +49,145 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - + def fetch(self): + """ Fetch the ServiceInstance :returns: The fetched ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServiceInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + - def update(self, friendly_name=values.unset, apn_credential_sid=values.unset, - gcm_credential_sid=values.unset, messaging_service_sid=values.unset, - facebook_messenger_page_id=values.unset, - default_apn_notification_protocol_version=values.unset, - default_gcm_notification_protocol_version=values.unset, - fcm_credential_sid=values.unset, - default_fcm_notification_protocol_version=values.unset, - log_enabled=values.unset, alexa_skill_id=values.unset, - default_alexa_notification_protocol_version=values.unset, - delivery_callback_url=values.unset, - delivery_callback_enabled=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode apn_credential_sid: The SID of the Credential to use for APN Bindings - :param unicode gcm_credential_sid: The SID of the Credential to use for GCM Bindings - :param unicode messaging_service_sid: The SID of the Messaging Service to use for SMS Bindings - :param unicode facebook_messenger_page_id: Deprecated - :param unicode default_apn_notification_protocol_version: The protocol version to use for sending APNS notifications - :param unicode default_gcm_notification_protocol_version: The protocol version to use for sending GCM notifications - :param unicode fcm_credential_sid: The SID of the Credential to use for FCM Bindings - :param unicode default_fcm_notification_protocol_version: The protocol version to use for sending FCM notifications - :param bool log_enabled: Whether to log notifications - :param unicode alexa_skill_id: Deprecated - :param unicode default_alexa_notification_protocol_version: Deprecated - :param unicode delivery_callback_url: Webhook URL - :param bool delivery_callback_enabled: Enable delivery callbacks - - :returns: The updated ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServiceInstance - """ + + + def update(self, body): data = values.of({ - 'FriendlyName': friendly_name, - 'ApnCredentialSid': apn_credential_sid, - 'GcmCredentialSid': gcm_credential_sid, - 'MessagingServiceSid': messaging_service_sid, - 'FacebookMessengerPageId': facebook_messenger_page_id, - 'DefaultApnNotificationProtocolVersion': default_apn_notification_protocol_version, - 'DefaultGcmNotificationProtocolVersion': default_gcm_notification_protocol_version, - 'FcmCredentialSid': fcm_credential_sid, - 'DefaultFcmNotificationProtocolVersion': default_fcm_notification_protocol_version, - 'LogEnabled': log_enabled, - 'AlexaSkillId': alexa_skill_id, - 'DefaultAlexaNotificationProtocolVersion': default_alexa_notification_protocol_version, - 'DeliveryCallbackUrl': delivery_callback_url, - 'DeliveryCallbackEnabled': delivery_callback_enabled, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def bindings(self): - """ - Access the bindings - - :returns: twilio.rest.notify.v1.service.binding.BindingList - :rtype: twilio.rest.notify.v1.service.binding.BindingList - """ - if self._bindings is None: - self._bindings = BindingList(self._version, service_sid=self._solution['sid'], ) - return self._bindings - - @property - def notifications(self): - """ - Access the notifications - - :returns: twilio.rest.notify.v1.service.notification.NotificationList - :rtype: twilio.rest.notify.v1.service.notification.NotificationList - """ - if self._notifications is None: - self._notifications = NotificationList(self._version, service_sid=self._solution['sid'], ) - return self._notifications + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class ServiceInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - :returns: twilio.rest.notify.v1.service.ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'apn_credential_sid': payload.get('apn_credential_sid'), - 'gcm_credential_sid': payload.get('gcm_credential_sid'), - 'fcm_credential_sid': payload.get('fcm_credential_sid'), - 'messaging_service_sid': payload.get('messaging_service_sid'), - 'facebook_messenger_page_id': payload.get('facebook_messenger_page_id'), - 'default_apn_notification_protocol_version': payload.get('default_apn_notification_protocol_version'), - 'default_gcm_notification_protocol_version': payload.get('default_gcm_notification_protocol_version'), - 'default_fcm_notification_protocol_version': payload.get('default_fcm_notification_protocol_version'), - 'log_enabled': payload.get('log_enabled'), - 'url': payload.get('url'), - 'links': payload.get('links'), - 'alexa_skill_id': payload.get('alexa_skill_id'), - 'default_alexa_notification_protocol_version': payload.get('default_alexa_notification_protocol_version'), - 'delivery_callback_url': payload.get('delivery_callback_url'), - 'delivery_callback_enabled': payload.get('delivery_callback_enabled'), +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'apn_credential_sid' : payload.get('apn_credential_sid'), + 'gcm_credential_sid' : payload.get('gcm_credential_sid'), + 'fcm_credential_sid' : payload.get('fcm_credential_sid'), + 'messaging_service_sid' : payload.get('messaging_service_sid'), + 'facebook_messenger_page_id' : payload.get('facebook_messenger_page_id'), + 'default_apn_notification_protocol_version' : payload.get('default_apn_notification_protocol_version'), + 'default_gcm_notification_protocol_version' : payload.get('default_gcm_notification_protocol_version'), + 'default_fcm_notification_protocol_version' : payload.get('default_fcm_notification_protocol_version'), + 'log_enabled' : payload.get('log_enabled'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), + 'alexa_skill_id' : payload.get('alexa_skill_id'), + 'default_alexa_notification_protocol_version' : payload.get('default_alexa_notification_protocol_version'), + 'delivery_callback_url' : payload.get('delivery_callback_url'), + 'delivery_callback_enabled' : payload.get('delivery_callback_enabled'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServiceContext - """ if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def apn_credential_sid(self): - """ - :returns: The SID of the Credential to use for APN Bindings - :rtype: unicode - """ - return self._properties['apn_credential_sid'] - - @property - def gcm_credential_sid(self): - """ - :returns: The SID of the Credential to use for GCM Bindings - :rtype: unicode - """ - return self._properties['gcm_credential_sid'] - - @property - def fcm_credential_sid(self): - """ - :returns: The SID of the Credential to use for FCM Bindings - :rtype: unicode - """ - return self._properties['fcm_credential_sid'] - - @property - def messaging_service_sid(self): - """ - :returns: The SID of the Messaging Service to use for SMS Bindings - :rtype: unicode - """ - return self._properties['messaging_service_sid'] - - @property - def facebook_messenger_page_id(self): - """ - :returns: Deprecated - :rtype: unicode - """ - return self._properties['facebook_messenger_page_id'] - - @property - def default_apn_notification_protocol_version(self): - """ - :returns: The protocol version to use for sending APNS notifications - :rtype: unicode - """ - return self._properties['default_apn_notification_protocol_version'] - - @property - def default_gcm_notification_protocol_version(self): - """ - :returns: The protocol version to use for sending GCM notifications - :rtype: unicode - """ - return self._properties['default_gcm_notification_protocol_version'] - - @property - def default_fcm_notification_protocol_version(self): - """ - :returns: The protocol version to use for sending FCM notifications - :rtype: unicode - """ - return self._properties['default_fcm_notification_protocol_version'] - - @property - def log_enabled(self): - """ - :returns: Whether to log notifications - :rtype: bool - """ - return self._properties['log_enabled'] - - @property - def url(self): - """ - :returns: The absolute URL of the Service resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The URLs of the resources related to the service - :rtype: unicode - """ - return self._properties['links'] - - @property - def alexa_skill_id(self): - """ - :returns: Deprecated - :rtype: unicode - """ - return self._properties['alexa_skill_id'] - - @property - def default_alexa_notification_protocol_version(self): - """ - :returns: Deprecated - :rtype: unicode - """ - return self._properties['default_alexa_notification_protocol_version'] - + def bindings(self): + return self._proxy.bindings @property - def delivery_callback_url(self): - """ - :returns: Webhook URL - :rtype: unicode - """ - return self._properties['delivery_callback_url'] + def notifications(self): + return self._proxy.notifications + - @property - def delivery_callback_enabled(self): + def __repr__(self): """ - :returns: Enable delivery callbacks - :rtype: bool + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['delivery_callback_enabled'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the ServiceInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def fetch(self): - """ - Fetch the ServiceInstance +class ServiceListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The fetched ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServiceInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, apn_credential_sid=values.unset, - gcm_credential_sid=values.unset, messaging_service_sid=values.unset, - facebook_messenger_page_id=values.unset, - default_apn_notification_protocol_version=values.unset, - default_gcm_notification_protocol_version=values.unset, - fcm_credential_sid=values.unset, - default_fcm_notification_protocol_version=values.unset, - log_enabled=values.unset, alexa_skill_id=values.unset, - default_alexa_notification_protocol_version=values.unset, - delivery_callback_url=values.unset, - delivery_callback_enabled=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode apn_credential_sid: The SID of the Credential to use for APN Bindings - :param unicode gcm_credential_sid: The SID of the Credential to use for GCM Bindings - :param unicode messaging_service_sid: The SID of the Messaging Service to use for SMS Bindings - :param unicode facebook_messenger_page_id: Deprecated - :param unicode default_apn_notification_protocol_version: The protocol version to use for sending APNS notifications - :param unicode default_gcm_notification_protocol_version: The protocol version to use for sending GCM notifications - :param unicode fcm_credential_sid: The SID of the Credential to use for FCM Bindings - :param unicode default_fcm_notification_protocol_version: The protocol version to use for sending FCM notifications - :param bool log_enabled: Whether to log notifications - :param unicode alexa_skill_id: Deprecated - :param unicode default_alexa_notification_protocol_version: Deprecated - :param unicode delivery_callback_url: Webhook URL - :param bool delivery_callback_enabled: Enable delivery callbacks - - :returns: The updated ServiceInstance - :rtype: twilio.rest.notify.v1.service.ServiceInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - apn_credential_sid=apn_credential_sid, - gcm_credential_sid=gcm_credential_sid, - messaging_service_sid=messaging_service_sid, - facebook_messenger_page_id=facebook_messenger_page_id, - default_apn_notification_protocol_version=default_apn_notification_protocol_version, - default_gcm_notification_protocol_version=default_gcm_notification_protocol_version, - fcm_credential_sid=fcm_credential_sid, - default_fcm_notification_protocol_version=default_fcm_notification_protocol_version, - log_enabled=log_enabled, - alexa_skill_id=alexa_skill_id, - default_alexa_notification_protocol_version=default_alexa_notification_protocol_version, - delivery_callback_url=delivery_callback_url, - delivery_callback_enabled=delivery_callback_enabled, - ) + # Path Solution + self._solution = { } + self._uri = '/Services' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def bindings(self): - """ - Access the bindings + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.notify.v1.service.binding.BindingList - :rtype: twilio.rest.notify.v1.service.binding.BindingList - """ - return self._proxy.bindings + return ServiceInstance(self._version, payload, ) + + """ + + """ + def page(self, friendly_name, page_size): + + data = values.of({ + 'friendly_name': friendly_name,'page_size': page_size, + }) - @property - def notifications(self): - """ - Access the notifications + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.notify.v1.service.notification.NotificationList - :rtype: twilio.rest.notify.v1.service.notification.NotificationList - """ - return self._proxy.notifications + return ServicePage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/numbers/v2/regulatory_compliance.py b/twilio/rest/numbers/v2/regulatory_compliance.py deleted file mode 100644 index a8dea448dd..0000000000 --- a/twilio/rest/numbers/v2/regulatory_compliance.py +++ /dev/null @@ -1,53 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Numbers - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.rest.regulatory_compliance.bundle import BundleListInstancefrom twilio.rest.regulatory_compliance.end_user import EndUserListInstancefrom twilio.rest.regulatory_compliance.end_user_type import EndUserTypeListInstancefrom twilio.rest.regulatory_compliance.regulation import RegulationListInstancefrom twilio.rest.regulatory_compliance.supporting_document import SupportingDocumentListInstancefrom twilio.rest.regulatory_compliance.supporting_document_type import SupportingDocumentTypeListInstance - - - - -class RegulatoryComplianceListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/RegulatoryCompliance' - - self._bundles = None - self._end_users = None - self._end_user_types = None - self._regulations = None - self._supporting_documents = None - self._supporting_document_types = None - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/numbers/v2/regulatory_compliance/__init__.py b/twilio/rest/numbers/v2/regulatory_compliance/__init__.py index 78c81f6b76..a8dea448dd 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/__init__.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/__init__.py @@ -1,186 +1,53 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Numbers + 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 twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.numbers.v2.regulatory_compliance.bundle import BundleList -from twilio.rest.numbers.v2.regulatory_compliance.end_user import EndUserList -from twilio.rest.numbers.v2.regulatory_compliance.end_user_type import EndUserTypeList -from twilio.rest.numbers.v2.regulatory_compliance.regulation import RegulationList -from twilio.rest.numbers.v2.regulatory_compliance.supporting_document import SupportingDocumentList -from twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type import SupportingDocumentTypeList +from twilio.base.version import Version +# from twilio.rest.regulatory_compliance.bundle import BundleListInstancefrom twilio.rest.regulatory_compliance.end_user import EndUserListInstancefrom twilio.rest.regulatory_compliance.end_user_type import EndUserTypeListInstancefrom twilio.rest.regulatory_compliance.regulation import RegulationListInstancefrom twilio.rest.regulatory_compliance.supporting_document import SupportingDocumentListInstancefrom twilio.rest.regulatory_compliance.supporting_document_type import SupportingDocumentTypeListInstance -class RegulatoryComplianceList(ListResource): - def __init__(self, version): - """ - Initialize the RegulatoryComplianceList - :param Version version: Version that contains the resource - :returns: twilio.rest.numbers.v2.regulatory_compliance.RegulatoryComplianceList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.RegulatoryComplianceList - """ - super(RegulatoryComplianceList, self).__init__(version) +class RegulatoryComplianceListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {} - - # Components + self._solution = { } + self._uri = '/RegulatoryCompliance' + self._bundles = None self._end_users = None self._end_user_types = None self._regulations = None self._supporting_documents = None self._supporting_document_types = None - - @property - def bundles(self): - """ - Access the bundles - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleList - """ - if self._bundles is None: - self._bundles = BundleList(self._version, ) - return self._bundles - - @property - def end_users(self): - """ - Access the end_users - - :returns: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user.EndUserList - """ - if self._end_users is None: - self._end_users = EndUserList(self._version, ) - return self._end_users - - @property - def end_user_types(self): - """ - Access the end_user_types - - :returns: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypeList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.end_user_type.EndUserTypeList - """ - if self._end_user_types is None: - self._end_user_types = EndUserTypeList(self._version, ) - return self._end_user_types - - @property - def regulations(self): - """ - Access the regulations - - :returns: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.regulation.RegulationList - """ - if self._regulations is None: - self._regulations = RegulationList(self._version, ) - return self._regulations - - @property - def supporting_documents(self): - """ - Access the supporting_documents - - :returns: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document.SupportingDocumentList - """ - if self._supporting_documents is None: - self._supporting_documents = SupportingDocumentList(self._version, ) - return self._supporting_documents - - @property - def supporting_document_types(self): - """ - Access the supporting_document_types - - :returns: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypeList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type.SupportingDocumentTypeList - """ - if self._supporting_document_types is None: - self._supporting_document_types = SupportingDocumentTypeList(self._version, ) - return self._supporting_document_types - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RegulatoryCompliancePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the RegulatoryCompliancePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.numbers.v2.regulatory_compliance.RegulatoryCompliancePage - :rtype: twilio.rest.numbers.v2.regulatory_compliance.RegulatoryCompliancePage - """ - super(RegulatoryCompliancePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RegulatoryComplianceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.numbers.v2.regulatory_compliance.RegulatoryComplianceInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.RegulatoryComplianceInstance - """ - return RegulatoryComplianceInstance(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class RegulatoryComplianceInstance(InstanceResource): - - def __init__(self, version, payload): - """ - Initialize the RegulatoryComplianceInstance - - :returns: twilio.rest.numbers.v2.regulatory_compliance.RegulatoryComplianceInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.RegulatoryComplianceInstance - """ - super(RegulatoryComplianceInstance, self).__init__(version) + return '' - # Context - self._context = None - self._solution = {} - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle.py deleted file mode 100644 index 62b54f4fd5..0000000000 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle.py +++ /dev/null @@ -1,193 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Numbers - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.bundle.bundle_copy import BundleCopyListInstancefrom twilio.rest.bundle.evaluation import EvaluationListInstancefrom twilio.rest.bundle.item_assignment import ItemAssignmentListInstancefrom twilio.rest.bundle.replace_items import ReplaceItemsListInstance - - -class BundleContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/RegulatoryCompliance/Bundles/${sid}' - - self._bundle_copies = None - self._evaluations = None - self._item_assignments = None - self._replace_items = None - - def delete(self): - - - - """ - Deletes the BundleInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the BundleInstance - - :returns: The fetched BundleInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return BundleInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return BundleInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class BundleInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'regulation_sid' : payload.get('regulation_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'status' : payload.get('status'), - 'valid_until' : payload.get('valid_until'), - 'email' : payload.get('email'), - 'status_callback' : payload.get('status_callback'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = BundleContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def bundle_copies(self): - return self._proxy.bundle_copies - @property - def evaluations(self): - return self._proxy.evaluations - @property - def item_assignments(self): - return self._proxy.item_assignments - @property - def replace_items(self): - return self._proxy.replace_items - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class BundleListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/RegulatoryCompliance/Bundles' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return BundleInstance(self._version, payload, ) - - """ - - """ - def page(self, status, friendly_name, regulation_sid, iso_country, number_type, has_valid_until_date, sort_by, sort_direction, valid_until_date, valid_until_date, valid_until_date, page_size): - - data = values.of({ - 'status': status,'friendly_name': friendly_name,'regulation_sid': regulation_sid,'iso_country': iso_country,'number_type': number_type,'has_valid_until_date': has_valid_until_date,'sort_by': sort_by,'sort_direction': sort_direction,'valid_until_date': valid_until_date,'valid_until_date': valid_until_date,'valid_until_date': valid_until_date,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return BundlePage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py index ee6eac9fb4..62b54f4fd5 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Numbers + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,669 +19,175 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.numbers.v2.regulatory_compliance.bundle.bundle_copy import BundleCopyList -from twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation import EvaluationList -from twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment import ItemAssignmentList -from twilio.rest.numbers.v2.regulatory_compliance.bundle.replace_items import ReplaceItemsList - - -class BundleList(ListResource): - - def __init__(self, version): - """ - Initialize the BundleList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleList - """ - super(BundleList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/RegulatoryCompliance/Bundles'.format(**self._solution) - - def create(self, friendly_name, email, status_callback=values.unset, - regulation_sid=values.unset, iso_country=values.unset, - end_user_type=values.unset, number_type=values.unset): - """ - Create the BundleInstance - - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode email: The email address - :param unicode status_callback: The URL we call to inform your application of status changes. - :param unicode regulation_sid: The unique string of a regulation. - :param unicode iso_country: The ISO country code of the country - :param BundleInstance.EndUserType end_user_type: The type of End User of the Bundle resource - :param unicode number_type: The type of phone number - - :returns: The created BundleInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Email': email, - 'StatusCallback': status_callback, - 'RegulationSid': regulation_sid, - 'IsoCountry': iso_country, - 'EndUserType': end_user_type, - 'NumberType': number_type, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return BundleInstance(self._version, payload, ) - - def stream(self, status=values.unset, friendly_name=values.unset, - regulation_sid=values.unset, iso_country=values.unset, - number_type=values.unset, has_valid_until_date=values.unset, - sort_by=values.unset, sort_direction=values.unset, - valid_until_date_before=values.unset, valid_until_date=values.unset, - valid_until_date_after=values.unset, limit=None, page_size=None): - """ - Streams BundleInstance 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 BundleInstance.Status status: The verification status of the Bundle resource - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode regulation_sid: The unique string of a regulation. - :param unicode iso_country: The ISO country code of the country - :param unicode number_type: The type of phone number - :param bool has_valid_until_date: Indicates that the Bundle is a valid Bundle until a specified expiration date. - :param BundleInstance.SortBy sort_by: Can be `valid-until` or `date-updated`. Defaults to `date-created`. - :param BundleInstance.SortDirection sort_direction: Default is `DESC`. Can be `ASC` or `DESC`. - :param datetime valid_until_date_before: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. - :param datetime valid_until_date: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. - :param datetime valid_until_date_after: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - friendly_name=friendly_name, - regulation_sid=regulation_sid, - iso_country=iso_country, - number_type=number_type, - has_valid_until_date=has_valid_until_date, - sort_by=sort_by, - sort_direction=sort_direction, - valid_until_date_before=valid_until_date_before, - valid_until_date=valid_until_date, - valid_until_date_after=valid_until_date_after, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, status=values.unset, friendly_name=values.unset, - regulation_sid=values.unset, iso_country=values.unset, - number_type=values.unset, has_valid_until_date=values.unset, - sort_by=values.unset, sort_direction=values.unset, - valid_until_date_before=values.unset, valid_until_date=values.unset, - valid_until_date_after=values.unset, limit=None, page_size=None): - """ - Lists BundleInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param BundleInstance.Status status: The verification status of the Bundle resource - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode regulation_sid: The unique string of a regulation. - :param unicode iso_country: The ISO country code of the country - :param unicode number_type: The type of phone number - :param bool has_valid_until_date: Indicates that the Bundle is a valid Bundle until a specified expiration date. - :param BundleInstance.SortBy sort_by: Can be `valid-until` or `date-updated`. Defaults to `date-created`. - :param BundleInstance.SortDirection sort_direction: Default is `DESC`. Can be `ASC` or `DESC`. - :param datetime valid_until_date_before: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. - :param datetime valid_until_date: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. - :param datetime valid_until_date_after: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleInstance] - """ - return list(self.stream( - status=status, - friendly_name=friendly_name, - regulation_sid=regulation_sid, - iso_country=iso_country, - number_type=number_type, - has_valid_until_date=has_valid_until_date, - sort_by=sort_by, - sort_direction=sort_direction, - valid_until_date_before=valid_until_date_before, - valid_until_date=valid_until_date, - valid_until_date_after=valid_until_date_after, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, friendly_name=values.unset, - regulation_sid=values.unset, iso_country=values.unset, - number_type=values.unset, has_valid_until_date=values.unset, - sort_by=values.unset, sort_direction=values.unset, - valid_until_date_before=values.unset, valid_until_date=values.unset, - valid_until_date_after=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of BundleInstance records from the API. - Request is executed immediately - - :param BundleInstance.Status status: The verification status of the Bundle resource - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode regulation_sid: The unique string of a regulation. - :param unicode iso_country: The ISO country code of the country - :param unicode number_type: The type of phone number - :param bool has_valid_until_date: Indicates that the Bundle is a valid Bundle until a specified expiration date. - :param BundleInstance.SortBy sort_by: Can be `valid-until` or `date-updated`. Defaults to `date-created`. - :param BundleInstance.SortDirection sort_direction: Default is `DESC`. Can be `ASC` or `DESC`. - :param datetime valid_until_date_before: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. - :param datetime valid_until_date: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. - :param datetime valid_until_date_after: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of BundleInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundlePage - """ - data = values.of({ - 'Status': status, - 'FriendlyName': friendly_name, - 'RegulationSid': regulation_sid, - 'IsoCountry': iso_country, - 'NumberType': number_type, - 'HasValidUntilDate': has_valid_until_date, - 'SortBy': sort_by, - 'SortDirection': sort_direction, - 'ValidUntilDate<': serialize.iso8601_datetime(valid_until_date_before), - 'ValidUntilDate': serialize.iso8601_datetime(valid_until_date), - 'ValidUntilDate>': serialize.iso8601_datetime(valid_until_date_after), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return BundlePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of BundleInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of BundleInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundlePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return BundlePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a BundleContext - - :param sid: The unique string that identifies the resource. - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleContext - """ - return BundleContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a BundleContext - - :param sid: The unique string that identifies the resource. - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleContext - """ - return BundleContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class BundlePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the BundlePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API +from twilio.base.version import Version - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundlePage - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundlePage - """ - super(BundlePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of BundleInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleInstance - """ - return BundleInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.bundle.bundle_copy import BundleCopyListInstancefrom twilio.rest.bundle.evaluation import EvaluationListInstancefrom twilio.rest.bundle.item_assignment import ItemAssignmentListInstancefrom twilio.rest.bundle.replace_items import ReplaceItemsListInstance class BundleContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the BundleContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource. - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleContext - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleContext - """ - super(BundleContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/RegulatoryCompliance/Bundles/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/RegulatoryCompliance/Bundles/${sid}' + + self._bundle_copies = None self._evaluations = None self._item_assignments = None - self._bundle_copies = None self._replace_items = None + + def delete(self): + + + """ + Deletes the BundleInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the BundleInstance :returns: The fetched BundleInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return BundleInstance(self._version, payload, sid=self._solution['sid'], ) + - def update(self, status=values.unset, status_callback=values.unset, - friendly_name=values.unset, email=values.unset): - """ - Update the BundleInstance - - :param BundleInstance.Status status: The verification status of the Bundle resource - :param unicode status_callback: The URL we call to inform your application of status changes. - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode email: The email address - - :returns: The updated BundleInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleInstance - """ + + + def update(self, body): data = values.of({ - 'Status': status, - 'StatusCallback': status_callback, - 'FriendlyName': friendly_name, - 'Email': email, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return BundleInstance(self._version, payload, sid=self._solution['sid'], ) + + - def delete(self): - """ - Deletes the BundleInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def evaluations(self): - """ - Access the evaluations - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationList - """ - if self._evaluations is None: - self._evaluations = EvaluationList(self._version, bundle_sid=self._solution['sid'], ) - return self._evaluations - - @property - def item_assignments(self): - """ - Access the item_assignments - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentList - """ - if self._item_assignments is None: - self._item_assignments = ItemAssignmentList(self._version, bundle_sid=self._solution['sid'], ) - return self._item_assignments - - @property - def bundle_copies(self): - """ - Access the bundle_copies - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.bundle_copy.BundleCopyList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.bundle_copy.BundleCopyList - """ - if self._bundle_copies is None: - self._bundle_copies = BundleCopyList(self._version, bundle_sid=self._solution['sid'], ) - return self._bundle_copies - - @property - def replace_items(self): - """ - Access the replace_items - - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.replace_items.ReplaceItemsList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.replace_items.ReplaceItemsList - """ - if self._replace_items is None: - self._replace_items = ReplaceItemsList(self._version, bundle_sid=self._solution['sid'], ) - return self._replace_items + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class BundleInstance(InstanceResource): + return '' - class Status(object): - DRAFT = "draft" - PENDING_REVIEW = "pending-review" - IN_REVIEW = "in-review" - TWILIO_REJECTED = "twilio-rejected" - TWILIO_APPROVED = "twilio-approved" - PROVISIONALLY_APPROVED = "provisionally-approved" - class EndUserType(object): - INDIVIDUAL = "individual" - BUSINESS = "business" - - class SortBy(object): - VALID_UNTIL = "valid-until" - DATE_UPDATED = "date-updated" - - class SortDirection(object): - ASC = "ASC" - DESC = "DESC" - - def __init__(self, version, payload, sid=None): - """ - Initialize the BundleInstance - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleInstance - """ - super(BundleInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'regulation_sid': payload.get('regulation_sid'), - 'friendly_name': payload.get('friendly_name'), - 'status': payload.get('status'), - 'valid_until': deserialize.iso8601_datetime(payload.get('valid_until')), - 'email': payload.get('email'), - 'status_callback': payload.get('status_callback'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class BundleInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'regulation_sid' : payload.get('regulation_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'status' : payload.get('status'), + 'valid_until' : payload.get('valid_until'), + 'email' : payload.get('email'), + 'status_callback' : payload.get('status_callback'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: BundleContext for this BundleInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleContext - """ if self._context is None: - self._context = BundleContext(self._version, sid=self._solution['sid'], ) + self._context = BundleContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def regulation_sid(self): - """ - :returns: The unique string of a regulation. - :rtype: unicode - """ - return self._properties['regulation_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def status(self): - """ - :returns: The verification status of the Bundle resource - :rtype: BundleInstance.Status - """ - return self._properties['status'] - - @property - def valid_until(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource will be valid until. - :rtype: datetime - """ - return self._properties['valid_until'] - - @property - def email(self): - """ - :returns: The email address - :rtype: unicode - """ - return self._properties['email'] - - @property - def status_callback(self): - """ - :returns: The URL we call to inform your application of status changes. - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - + def bundle_copies(self): + return self._proxy.bundle_copies @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - + def evaluations(self): + return self._proxy.evaluations @property - def url(self): - """ - :returns: The absolute URL of the Bundle resource - :rtype: unicode - """ - return self._properties['url'] - + def item_assignments(self): + return self._proxy.item_assignments @property - def links(self): - """ - :returns: The URLs of the Assigned Items of the Bundle resource - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the BundleInstance - - :returns: The fetched BundleInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleInstance - """ - return self._proxy.fetch() - - def update(self, status=values.unset, status_callback=values.unset, - friendly_name=values.unset, email=values.unset): - """ - Update the BundleInstance - - :param BundleInstance.Status status: The verification status of the Bundle resource - :param unicode status_callback: The URL we call to inform your application of status changes. - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode email: The email address - - :returns: The updated BundleInstance - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.BundleInstance - """ - return self._proxy.update( - status=status, - status_callback=status_callback, - friendly_name=friendly_name, - email=email, - ) + def replace_items(self): + return self._proxy.replace_items + - def delete(self): + def __repr__(self): """ - Deletes the BundleInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.delete() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def evaluations(self): - """ - Access the evaluations - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation.EvaluationList - """ - return self._proxy.evaluations - @property - def item_assignments(self): - """ - Access the item_assignments +class BundleListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment.ItemAssignmentList - """ - return self._proxy.item_assignments + # Path Solution + self._solution = { } + self._uri = '/RegulatoryCompliance/Bundles' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def bundle_copies(self): - """ - Access the bundle_copies + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.bundle_copy.BundleCopyList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.bundle_copy.BundleCopyList - """ - return self._proxy.bundle_copies + return BundleInstance(self._version, payload, ) + + """ + + """ + def page(self, status, friendly_name, regulation_sid, iso_country, number_type, has_valid_until_date, sort_by, sort_direction, valid_until_date, valid_until_date, valid_until_date, page_size): + + data = values.of({ + 'status': status,'friendly_name': friendly_name,'regulation_sid': regulation_sid,'iso_country': iso_country,'number_type': number_type,'has_valid_until_date': has_valid_until_date,'sort_by': sort_by,'sort_direction': sort_direction,'valid_until_date': valid_until_date,'valid_until_date': valid_until_date,'valid_until_date': valid_until_date,'page_size': page_size, + }) - @property - def replace_items(self): - """ - Access the replace_items + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.numbers.v2.regulatory_compliance.bundle.replace_items.ReplaceItemsList - :rtype: twilio.rest.numbers.v2.regulatory_compliance.bundle.replace_items.ReplaceItemsList - """ - return self._proxy.replace_items + return BundlePage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/DeployedDevices/__init__.py b/twilio/rest/preview/DeployedDevices/__init__.py new file mode 100644 index 0000000000..5d48a1aa9a --- /dev/null +++ b/twilio/rest/preview/DeployedDevices/__init__.py @@ -0,0 +1,44 @@ +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + 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 twilio.base.version import Version +from twilio.base.domain import Domain +from twilio.rest.preview.deployed_devices.fleet import FleetList + + +class DeployedDevices(Version): + + def __init__(self, domain: Domain): + """ + Initialize the DeployedDevices version of Preview + + :param domain: The Twilio.preview domain + """ + super().__init__(domain) + self.version = 'DeployedDevices' + self._fleets = None + + @property + def fleets(self) -> FleetList: + if self._fleets is None: + self._fleets = FleetList(self) + return self._fleets + + def __repr__(self) -> str: + """ + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str + """ + return '' diff --git a/twilio/rest/preview/hosted_numbers/__init__.py b/twilio/rest/preview/HostedNumbers/__init__.py similarity index 55% rename from twilio/rest/preview/hosted_numbers/__init__.py rename to twilio/rest/preview/HostedNumbers/__init__.py index 74eaa01930..89a5a9903c 100644 --- a/twilio/rest/preview/hosted_numbers/__init__.py +++ b/twilio/rest/preview/HostedNumbers/__init__.py @@ -1,52 +1,51 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + 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 twilio.base.version import Version +from twilio.base.domain import Domain from twilio.rest.preview.hosted_numbers.authorization_document import AuthorizationDocumentList from twilio.rest.preview.hosted_numbers.hosted_number_order import HostedNumberOrderList class HostedNumbers(Version): - def __init__(self, domain): + def __init__(self, domain: Domain): """ Initialize the HostedNumbers version of Preview - :returns: HostedNumbers version of Preview - :rtype: twilio.rest.preview.hosted_numbers.HostedNumbers.HostedNumbers + :param domain: The Twilio.preview domain """ - super(HostedNumbers, self).__init__(domain) + super().__init__(domain) self.version = 'HostedNumbers' self._authorization_documents = None self._hosted_number_orders = None - + @property - def authorization_documents(self): - """ - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentList - """ + def authorization_documents(self) -> AuthorizationDocumentList: if self._authorization_documents is None: self._authorization_documents = AuthorizationDocumentList(self) return self._authorization_documents @property - def hosted_number_orders(self): - """ - :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderList - """ + def hosted_number_orders(self) -> HostedNumberOrderList: if self._hosted_number_orders is None: self._hosted_number_orders = HostedNumberOrderList(self) return self._hosted_number_orders - def __repr__(self): + def __repr__(self) -> str: """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/preview/deployed_devices/__init__.py b/twilio/rest/preview/deployed_devices/__init__.py deleted file mode 100644 index 1bb97fcce3..0000000000 --- a/twilio/rest/preview/deployed_devices/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base.version import Version -from twilio.rest.preview.deployed_devices.fleet import FleetList - - -class DeployedDevices(Version): - - def __init__(self, domain): - """ - Initialize the DeployedDevices version of Preview - - :returns: DeployedDevices version of Preview - :rtype: twilio.rest.preview.deployed_devices.DeployedDevices.DeployedDevices - """ - super(DeployedDevices, self).__init__(domain) - self.version = 'DeployedDevices' - self._fleets = None - - @property - def fleets(self): - """ - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetList - """ - if self._fleets is None: - self._fleets = FleetList(self) - return self._fleets - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/preview/deployed_devices/fleet.py b/twilio/rest/preview/deployed_devices/fleet.py deleted file mode 100644 index f8c759275b..0000000000 --- a/twilio/rest/preview/deployed_devices/fleet.py +++ /dev/null @@ -1,190 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.fleet.certificate import CertificateListInstancefrom twilio.rest.fleet.deployment import DeploymentListInstancefrom twilio.rest.fleet.device import DeviceListInstancefrom twilio.rest.fleet.key import KeyListInstance - - -class FleetContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Fleets/${sid}' - - self._certificates = None - self._deployments = None - self._devices = None - self._keys = None - - def delete(self): - - - - """ - Deletes the FleetInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the FleetInstance - - :returns: The fetched FleetInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FleetInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return FleetInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class FleetInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'url' : payload.get('url'), - 'unique_name' : payload.get('unique_name'), - 'friendly_name' : payload.get('friendly_name'), - 'account_sid' : payload.get('account_sid'), - 'default_deployment_sid' : payload.get('default_deployment_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = FleetContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def certificates(self): - return self._proxy.certificates - @property - def deployments(self): - return self._proxy.deployments - @property - def devices(self): - return self._proxy.devices - @property - def keys(self): - return self._proxy.keys - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class FleetListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Fleets' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return FleetInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return FleetPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/preview/deployed_devices/fleet/__init__.py b/twilio/rest/preview/deployed_devices/fleet/__init__.py index ae5c09614f..f8c759275b 100644 --- a/twilio/rest/preview/deployed_devices/fleet/__init__.py +++ b/twilio/rest/preview/deployed_devices/fleet/__init__.py @@ -1,247 +1,49 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.preview.deployed_devices.fleet.certificate import CertificateList -from twilio.rest.preview.deployed_devices.fleet.deployment import DeploymentList -from twilio.rest.preview.deployed_devices.fleet.device import DeviceList -from twilio.rest.preview.deployed_devices.fleet.key import KeyList - - -class FleetList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the FleetList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.deployed_devices.fleet.FleetList - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetList - """ - super(FleetList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Fleets'.format(**self._solution) - - def create(self, friendly_name=values.unset): - """ - Create the FleetInstance - - :param unicode friendly_name: A human readable description for this Fleet. - - :returns: The created FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return FleetInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams FleetInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.preview.deployed_devices.fleet.FleetInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists FleetInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.deployed_devices.fleet.FleetInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) +from twilio.base.version import Version - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of FleetInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return FleetPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FleetInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FleetPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a FleetContext - - :param sid: A string that uniquely identifies the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.FleetContext - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetContext - """ - return FleetContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a FleetContext - - :param sid: A string that uniquely identifies the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.FleetContext - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetContext - """ - return FleetContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FleetPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the FleetPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.deployed_devices.fleet.FleetPage - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetPage - """ - super(FleetPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FleetInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.deployed_devices.fleet.FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetInstance - """ - return FleetInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.fleet.certificate import CertificateListInstancefrom twilio.rest.fleet.deployment import DeploymentListInstancefrom twilio.rest.fleet.device import DeviceListInstancefrom twilio.rest.fleet.key import KeyListInstance class FleetContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the FleetContext - - :param Version version: Version that contains the resource - :param sid: A string that uniquely identifies the Fleet. - - :returns: twilio.rest.preview.deployed_devices.fleet.FleetContext - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetContext - """ - super(FleetContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Fleets/{sid}'.format(**self._solution) - - # Dependents - self._devices = None - self._deployments = None + self._solution = { 'sid': sid, } + self._uri = '/Fleets/${sid}' + self._certificates = None + self._deployments = None + self._devices = None self._keys = None - - def fetch(self): - """ - Fetch the FleetInstance - - :returns: The fetched FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FleetInstance(self._version, payload, sid=self._solution['sid'], ) - + def delete(self): + + + """ Deletes the FleetInstance @@ -249,279 +51,140 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, friendly_name=values.unset, - default_deployment_sid=values.unset): + + def fetch(self): + """ - Update the FleetInstance - - :param unicode friendly_name: A human readable description for this Fleet. - :param unicode default_deployment_sid: A default Deployment SID. + Fetch the FleetInstance - :returns: The updated FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetInstance + :returns: The fetched FleetInstance + #TODO: add rtype docs """ - data = values.of({'FriendlyName': friendly_name, 'DefaultDeploymentSid': default_deployment_sid, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.fetch(method='GET', uri=self._uri, ) return FleetInstance(self._version, payload, sid=self._solution['sid'], ) + - @property - def devices(self): - """ - Access the devices + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: twilio.rest.preview.deployed_devices.fleet.device.DeviceList - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceList - """ - if self._devices is None: - self._devices = DeviceList(self._version, fleet_sid=self._solution['sid'], ) - return self._devices + payload = self._version.update(method='post', uri=self._uri, data=data, ) - @property - def deployments(self): - """ - Access the deployments - - :returns: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentList - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentList - """ - if self._deployments is None: - self._deployments = DeploymentList(self._version, fleet_sid=self._solution['sid'], ) - return self._deployments - - @property - def certificates(self): - """ - Access the certificates + return FleetInstance(self._version, payload, sid=self._solution['sid'], ) + + - :returns: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateList - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateList - """ - if self._certificates is None: - self._certificates = CertificateList(self._version, fleet_sid=self._solution['sid'], ) - return self._certificates - - @property - def keys(self): - """ - Access the keys - - :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyList - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyList - """ - if self._keys is None: - self._keys = KeyList(self._version, fleet_sid=self._solution['sid'], ) - return self._keys + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class FleetInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, sid=None): - """ - Initialize the FleetInstance - - :returns: twilio.rest.preview.deployed_devices.fleet.FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetInstance - """ - super(FleetInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'url': payload.get('url'), - 'unique_name': payload.get('unique_name'), - 'friendly_name': payload.get('friendly_name'), - 'account_sid': payload.get('account_sid'), - 'default_deployment_sid': payload.get('default_deployment_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'links': payload.get('links'), +class FleetInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'url' : payload.get('url'), + 'unique_name' : payload.get('unique_name'), + 'friendly_name' : payload.get('friendly_name'), + 'account_sid' : payload.get('account_sid'), + 'default_deployment_sid' : payload.get('default_deployment_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FleetContext for this FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetContext - """ if self._context is None: - self._context = FleetContext(self._version, sid=self._solution['sid'], ) + self._context = FleetContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: A string that uniquely identifies this Fleet. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def url(self): - """ - :returns: URL of this Fleet. - :rtype: unicode - """ - return self._properties['url'] - - @property - def unique_name(self): - """ - :returns: A unique, addressable name of this Fleet. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def friendly_name(self): - """ - :returns: A human readable description for this Fleet. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def account_sid(self): - """ - :returns: The unique SID that identifies this Account. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def default_deployment_sid(self): - """ - :returns: The unique SID that identifies this Fleet's default Deployment. - :rtype: unicode - """ - return self._properties['default_deployment_sid'] - - @property - def date_created(self): - """ - :returns: The date this Fleet was created. - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Fleet was updated. - :rtype: datetime - """ - return self._properties['date_updated'] - + def certificates(self): + return self._proxy.certificates @property - def links(self): - """ - :returns: Nested resource URLs. - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the FleetInstance - - :returns: The fetched FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the FleetInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, - default_deployment_sid=values.unset): - """ - Update the FleetInstance - - :param unicode friendly_name: A human readable description for this Fleet. - :param unicode default_deployment_sid: A default Deployment SID. - - :returns: The updated FleetInstance - :rtype: twilio.rest.preview.deployed_devices.fleet.FleetInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - default_deployment_sid=default_deployment_sid, - ) - + def deployments(self): + return self._proxy.deployments @property def devices(self): - """ - Access the devices - - :returns: twilio.rest.preview.deployed_devices.fleet.device.DeviceList - :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceList - """ return self._proxy.devices - @property - def deployments(self): - """ - Access the deployments + def keys(self): + return self._proxy.keys + - :returns: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentList - :rtype: twilio.rest.preview.deployed_devices.fleet.deployment.DeploymentList + def __repr__(self): """ - return self._proxy.deployments - - @property - def certificates(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Access the certificates + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateList - :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateList - """ - return self._proxy.certificates - @property - def keys(self): - """ - Access the keys - :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyList - :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyList - """ - return self._proxy.keys +class FleetListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) + + # Path Solution + self._solution = { } + self._uri = '/Fleets' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return FleetInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return FleetPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/hosted_numbers/authorization_document.py b/twilio/rest/preview/hosted_numbers/authorization_document.py deleted file mode 100644 index 777154691b..0000000000 --- a/twilio/rest/preview/hosted_numbers/authorization_document.py +++ /dev/null @@ -1,166 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.authorization_document.dependent_hosted_number_order import DependentHostedNumberOrderListInstance - - -class AuthorizationDocumentContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/AuthorizationDocuments/${sid}' - - self._dependent_hosted_number_orders = None - - def fetch(self): - - """ - Fetch the AuthorizationDocumentInstance - - :returns: The fetched AuthorizationDocumentInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AuthorizationDocumentInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return AuthorizationDocumentInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class AuthorizationDocumentInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'address_sid' : payload.get('address_sid'), - 'status' : payload.get('status'), - 'email' : payload.get('email'), - 'cc_emails' : payload.get('cc_emails'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = AuthorizationDocumentContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def dependent_hosted_number_orders(self): - return self._proxy.dependent_hosted_number_orders - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class AuthorizationDocumentListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/AuthorizationDocuments' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return AuthorizationDocumentInstance(self._version, payload, ) - - """ - - """ - def page(self, email, status, page_size): - - data = values.of({ - 'email': email,'status': status,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return AuthorizationDocumentPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py b/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py index 96d01a6f30..777154691b 100644 --- a/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py +++ b/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,491 +19,148 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order import DependentHostedNumberOrderList - - -class AuthorizationDocumentList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the AuthorizationDocumentList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentList - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentList - """ - super(AuthorizationDocumentList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/AuthorizationDocuments'.format(**self._solution) - - def stream(self, email=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Streams AuthorizationDocumentInstance 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 unicode email: Email. - :param AuthorizationDocumentInstance.Status status: The Status of this AuthorizationDocument. - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(email=email, status=status, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, email=values.unset, status=values.unset, limit=None, - page_size=None): - """ - Lists AuthorizationDocumentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode email: Email. - :param AuthorizationDocumentInstance.Status status: The Status of this AuthorizationDocument. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance] - """ - return list(self.stream(email=email, status=status, limit=limit, page_size=page_size, )) - - def page(self, email=values.unset, status=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of AuthorizationDocumentInstance records from the API. - Request is executed immediately - - :param unicode email: Email. - :param AuthorizationDocumentInstance.Status status: The Status of this AuthorizationDocument. - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentPage - """ - data = values.of({ - 'Email': email, - 'Status': status, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AuthorizationDocumentPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AuthorizationDocumentInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AuthorizationDocumentPage(self._version, response, self._solution) - - def create(self, hosted_number_order_sids, address_sid, email, contact_title, - contact_phone_number, cc_emails=values.unset): - """ - Create the AuthorizationDocumentInstance - - :param list[unicode] hosted_number_order_sids: A list of HostedNumberOrder sids. - :param unicode address_sid: Address sid. - :param unicode email: Email. - :param unicode contact_title: Title of signee of this Authorization Document. - :param unicode contact_phone_number: Authorization Document's signee's phone number. - :param list[unicode] cc_emails: A list of emails. - - :returns: The created AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance - """ - data = values.of({ - 'HostedNumberOrderSids': serialize.map(hosted_number_order_sids, lambda e: e), - 'AddressSid': address_sid, - 'Email': email, - 'ContactTitle': contact_title, - 'ContactPhoneNumber': contact_phone_number, - 'CcEmails': serialize.map(cc_emails, lambda e: e), - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return AuthorizationDocumentInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a AuthorizationDocumentContext - - :param sid: AuthorizationDocument sid. - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentContext - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentContext - """ - return AuthorizationDocumentContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a AuthorizationDocumentContext - - :param sid: AuthorizationDocument sid. - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentContext - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentContext - """ - return AuthorizationDocumentContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base.version import Version +from twilio.base.page import Page -class AuthorizationDocumentPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the AuthorizationDocumentPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentPage - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentPage - """ - super(AuthorizationDocumentPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AuthorizationDocumentInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance - """ - return AuthorizationDocumentInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.authorization_document.dependent_hosted_number_order import DependentHostedNumberOrderListInstance class AuthorizationDocumentContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the AuthorizationDocumentContext - - :param Version version: Version that contains the resource - :param sid: AuthorizationDocument sid. - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentContext - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentContext - """ - super(AuthorizationDocumentContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/AuthorizationDocuments/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/AuthorizationDocuments/${sid}' + self._dependent_hosted_number_orders = None - + def fetch(self): + """ Fetch the AuthorizationDocumentInstance :returns: The fetched AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return AuthorizationDocumentInstance(self._version, payload, sid=self._solution['sid'], ) + - def update(self, hosted_number_order_sids=values.unset, - address_sid=values.unset, email=values.unset, cc_emails=values.unset, - status=values.unset, contact_title=values.unset, - contact_phone_number=values.unset): - """ - Update the AuthorizationDocumentInstance - - :param list[unicode] hosted_number_order_sids: A list of HostedNumberOrder sids. - :param unicode address_sid: Address sid. - :param unicode email: Email. - :param list[unicode] cc_emails: A list of emails. - :param AuthorizationDocumentInstance.Status status: The Status of this AuthorizationDocument. - :param unicode contact_title: Title of signee of this Authorization Document. - :param unicode contact_phone_number: Authorization Document's signee's phone number. - - :returns: The updated AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance - """ + + + def update(self, body): data = values.of({ - 'HostedNumberOrderSids': serialize.map(hosted_number_order_sids, lambda e: e), - 'AddressSid': address_sid, - 'Email': email, - 'CcEmails': serialize.map(cc_emails, lambda e: e), - 'Status': status, - 'ContactTitle': contact_title, - 'ContactPhoneNumber': contact_phone_number, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return AuthorizationDocumentInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def dependent_hosted_number_orders(self): - """ - Access the dependent_hosted_number_orders - - :returns: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderList - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderList - """ - if self._dependent_hosted_number_orders is None: - self._dependent_hosted_number_orders = DependentHostedNumberOrderList( - self._version, - signing_document_sid=self._solution['sid'], - ) - return self._dependent_hosted_number_orders + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class AuthorizationDocumentInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - class Status(object): - OPENED = "opened" - SIGNING = "signing" - SIGNED = "signed" - CANCELED = "canceled" - FAILED = "failed" - - def __init__(self, version, payload, sid=None): - """ - Initialize the AuthorizationDocumentInstance - :returns: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance - """ - super(AuthorizationDocumentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'address_sid': payload.get('address_sid'), - 'status': payload.get('status'), - 'email': payload.get('email'), - 'cc_emails': payload.get('cc_emails'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class AuthorizationDocumentInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'address_sid' : payload.get('address_sid'), + 'status' : payload.get('status'), + 'email' : payload.get('email'), + 'cc_emails' : payload.get('cc_emails'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AuthorizationDocumentContext for this AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentContext - """ if self._context is None: - self._context = AuthorizationDocumentContext(self._version, sid=self._solution['sid'], ) + self._context = AuthorizationDocumentContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: AuthorizationDocument sid. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def address_sid(self): - """ - :returns: Address sid. - :rtype: unicode - """ - return self._properties['address_sid'] - - @property - def status(self): - """ - :returns: The Status of this AuthorizationDocument. - :rtype: AuthorizationDocumentInstance.Status - """ - return self._properties['status'] - - @property - def email(self): - """ - :returns: Email. - :rtype: unicode - """ - return self._properties['email'] - - @property - def cc_emails(self): - """ - :returns: A list of emails. - :rtype: list[unicode] - """ - return self._properties['cc_emails'] + def dependent_hosted_number_orders(self): + return self._proxy.dependent_hosted_number_orders + - @property - def date_created(self): + def __repr__(self): """ - :returns: The date this AuthorizationDocument was created. - :rtype: datetime + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['date_created'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def date_updated(self): - """ - :returns: The date this AuthorizationDocument was updated. - :rtype: datetime - """ - return self._properties['date_updated'] - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] +class AuthorizationDocumentListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - def fetch(self): - """ - Fetch the AuthorizationDocumentInstance + # Path Solution + self._solution = { } + self._uri = '/AuthorizationDocuments' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - :returns: The fetched AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance - """ - return self._proxy.fetch() + payload = self._version.create(method='post', uri=self._uri, data=data, ) - def update(self, hosted_number_order_sids=values.unset, - address_sid=values.unset, email=values.unset, cc_emails=values.unset, - status=values.unset, contact_title=values.unset, - contact_phone_number=values.unset): - """ - Update the AuthorizationDocumentInstance - - :param list[unicode] hosted_number_order_sids: A list of HostedNumberOrder sids. - :param unicode address_sid: Address sid. - :param unicode email: Email. - :param list[unicode] cc_emails: A list of emails. - :param AuthorizationDocumentInstance.Status status: The Status of this AuthorizationDocument. - :param unicode contact_title: Title of signee of this Authorization Document. - :param unicode contact_phone_number: Authorization Document's signee's phone number. - - :returns: The updated AuthorizationDocumentInstance - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.AuthorizationDocumentInstance - """ - return self._proxy.update( - hosted_number_order_sids=hosted_number_order_sids, - address_sid=address_sid, - email=email, - cc_emails=cc_emails, - status=status, - contact_title=contact_title, - contact_phone_number=contact_phone_number, - ) + return AuthorizationDocumentInstance(self._version, payload, ) + + """ + + """ + def page(self, email, status, page_size): + + data = values.of({ + 'email': email,'status': status,'page_size': page_size, + }) - @property - def dependent_hosted_number_orders(self): - """ - Access the dependent_hosted_number_orders + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderList - :rtype: twilio.rest.preview.hosted_numbers.authorization_document.dependent_hosted_number_order.DependentHostedNumberOrderList - """ - return self._proxy.dependent_hosted_number_orders + return AuthorizationDocumentPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/marketplace/__init__.py b/twilio/rest/preview/marketplace/__init__.py index bcf31a09a1..f729f0b79e 100644 --- a/twilio/rest/preview/marketplace/__init__.py +++ b/twilio/rest/preview/marketplace/__init__.py @@ -1,52 +1,51 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + 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 twilio.base.version import Version +from twilio.base.domain import Domain from twilio.rest.preview.marketplace.available_add_on import AvailableAddOnList from twilio.rest.preview.marketplace.installed_add_on import InstalledAddOnList class Marketplace(Version): - def __init__(self, domain): + def __init__(self, domain: Domain): """ Initialize the Marketplace version of Preview - :returns: Marketplace version of Preview - :rtype: twilio.rest.preview.marketplace.Marketplace.Marketplace + :param domain: The Twilio.preview domain """ - super(Marketplace, self).__init__(domain) + super().__init__(domain) self.version = 'marketplace' self._available_add_ons = None self._installed_add_ons = None - + @property - def available_add_ons(self): - """ - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnList - """ + def available_add_ons(self) -> AvailableAddOnList: if self._available_add_ons is None: self._available_add_ons = AvailableAddOnList(self) return self._available_add_ons @property - def installed_add_ons(self): - """ - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnList - """ + def installed_add_ons(self) -> InstalledAddOnList: if self._installed_add_ons is None: self._installed_add_ons = InstalledAddOnList(self) return self._installed_add_ons - def __repr__(self): + def __repr__(self) -> str: """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/preview/marketplace/available_add_on.py b/twilio/rest/preview/marketplace/available_add_on.py deleted file mode 100644 index 05433aa45d..0000000000 --- a/twilio/rest/preview/marketplace/available_add_on.py +++ /dev/null @@ -1,139 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.available_add_on.available_add_on_extension import AvailableAddOnExtensionListInstance - - -class AvailableAddOnContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/AvailableAddOns/${sid}' - - self._extensions = None - - def fetch(self): - - """ - Fetch the AvailableAddOnInstance - - :returns: The fetched AvailableAddOnInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AvailableAddOnInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class AvailableAddOnInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'friendly_name' : payload.get('friendly_name'), - 'description' : payload.get('description'), - 'pricing_type' : payload.get('pricing_type'), - 'configuration_schema' : payload.get('configuration_schema'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = AvailableAddOnContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def extensions(self): - return self._proxy.extensions - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class AvailableAddOnListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/AvailableAddOns' - - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return AvailableAddOnPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/preview/marketplace/available_add_on/__init__.py b/twilio/rest/preview/marketplace/available_add_on/__init__.py index 17c54971d6..05433aa45d 100644 --- a/twilio/rest/preview/marketplace/available_add_on/__init__.py +++ b/twilio/rest/preview/marketplace/available_add_on/__init__.py @@ -1,373 +1,139 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Preview + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.preview.marketplace.available_add_on.available_add_on_extension import AvailableAddOnExtensionList - - -class AvailableAddOnList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the AvailableAddOnList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnList - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnList - """ - super(AvailableAddOnList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/AvailableAddOns'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AvailableAddOnInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.preview.marketplace.available_add_on.AvailableAddOnInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AvailableAddOnInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.marketplace.available_add_on.AvailableAddOnInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AvailableAddOnInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AvailableAddOnInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AvailableAddOnPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AvailableAddOnInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AvailableAddOnInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) +from twilio.base.version import Version - return AvailableAddOnPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a AvailableAddOnContext - - :param sid: The SID of the AvailableAddOn resource to fetch - - :returns: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnContext - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnContext - """ - return AvailableAddOnContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a AvailableAddOnContext - - :param sid: The SID of the AvailableAddOn resource to fetch - - :returns: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnContext - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnContext - """ - return AvailableAddOnContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AvailableAddOnPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the AvailableAddOnPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnPage - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnPage - """ - super(AvailableAddOnPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AvailableAddOnInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnInstance - """ - return AvailableAddOnInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.available_add_on.available_add_on_extension import AvailableAddOnExtensionListInstance class AvailableAddOnContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the AvailableAddOnContext - - :param Version version: Version that contains the resource - :param sid: The SID of the AvailableAddOn resource to fetch - - :returns: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnContext - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnContext - """ - super(AvailableAddOnContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/AvailableAddOns/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/AvailableAddOns/${sid}' + self._extensions = None - + def fetch(self): + """ Fetch the AvailableAddOnInstance :returns: The fetched AvailableAddOnInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return AvailableAddOnInstance(self._version, payload, sid=self._solution['sid'], ) + - @property - def extensions(self): - """ - Access the extensions - - :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionList - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionList - """ - if self._extensions is None: - self._extensions = AvailableAddOnExtensionList( - self._version, - available_add_on_sid=self._solution['sid'], - ) - return self._extensions + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class AvailableAddOnInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the AvailableAddOnInstance - - :returns: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnInstance - """ - super(AvailableAddOnInstance, self).__init__(version) - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'friendly_name': payload.get('friendly_name'), - 'description': payload.get('description'), - 'pricing_type': payload.get('pricing_type'), - 'configuration_schema': payload.get('configuration_schema'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class AvailableAddOnInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'friendly_name' : payload.get('friendly_name'), + 'description' : payload.get('description'), + 'pricing_type' : payload.get('pricing_type'), + 'configuration_schema' : payload.get('configuration_schema'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AvailableAddOnContext for this AvailableAddOnInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnContext - """ if self._context is None: - self._context = AvailableAddOnContext(self._version, sid=self._solution['sid'], ) + self._context = AvailableAddOnContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def description(self): - """ - :returns: A short description of the Add-on's functionality - :rtype: unicode - """ - return self._properties['description'] - - @property - def pricing_type(self): - """ - :returns: How customers are charged for using this Add-on - :rtype: unicode - """ - return self._properties['pricing_type'] - - @property - def configuration_schema(self): - """ - :returns: The JSON object with the configuration that must be provided when installing a given Add-on - :rtype: dict - """ - return self._properties['configuration_schema'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] + def extensions(self): + return self._proxy.extensions + - @property - def links(self): + def __repr__(self): """ - :returns: The URLs of related resources - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['links'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the AvailableAddOnInstance - :returns: The fetched AvailableAddOnInstance - :rtype: twilio.rest.preview.marketplace.available_add_on.AvailableAddOnInstance - """ - return self._proxy.fetch() - @property - def extensions(self): - """ - Access the extensions +class AvailableAddOnListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionList - :rtype: twilio.rest.preview.marketplace.available_add_on.available_add_on_extension.AvailableAddOnExtensionList - """ - return self._proxy.extensions + # Path Solution + self._solution = { } + self._uri = '/AvailableAddOns' + + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AvailableAddOnPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/marketplace/installed_add_on.py b/twilio/rest/preview/marketplace/installed_add_on.py deleted file mode 100644 index 95bb869d77..0000000000 --- a/twilio/rest/preview/marketplace/installed_add_on.py +++ /dev/null @@ -1,179 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.installed_add_on.installed_add_on_extension import InstalledAddOnExtensionListInstance - - -class InstalledAddOnContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/InstalledAddOns/${sid}' - - self._extensions = None - - def delete(self): - - - - """ - Deletes the InstalledAddOnInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the InstalledAddOnInstance - - :returns: The fetched InstalledAddOnInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return InstalledAddOnInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return InstalledAddOnInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class InstalledAddOnInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'description' : payload.get('description'), - 'configuration' : payload.get('configuration'), - 'unique_name' : payload.get('unique_name'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = InstalledAddOnContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def extensions(self): - return self._proxy.extensions - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class InstalledAddOnListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/InstalledAddOns' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return InstalledAddOnInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return InstalledAddOnPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/preview/marketplace/installed_add_on/__init__.py b/twilio/rest/preview/marketplace/installed_add_on/__init__.py index 2d92f73620..95bb869d77 100644 --- a/twilio/rest/preview/marketplace/installed_add_on/__init__.py +++ b/twilio/rest/preview/marketplace/installed_add_on/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,229 +19,28 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension import InstalledAddOnExtensionList - - -class InstalledAddOnList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the InstalledAddOnList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnList - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnList - """ - super(InstalledAddOnList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/InstalledAddOns'.format(**self._solution) - - def create(self, available_add_on_sid, accept_terms_of_service, - configuration=values.unset, unique_name=values.unset): - """ - Create the InstalledAddOnInstance - - :param unicode available_add_on_sid: The SID of the AvaliableAddOn to install - :param bool accept_terms_of_service: Whether the Terms of Service were accepted - :param dict configuration: The JSON object representing the configuration - :param unicode unique_name: An application-defined string that uniquely identifies the resource - - :returns: The created InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance - """ - data = values.of({ - 'AvailableAddOnSid': available_add_on_sid, - 'AcceptTermsOfService': accept_terms_of_service, - 'Configuration': serialize.object(configuration), - 'UniqueName': unique_name, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return InstalledAddOnInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams InstalledAddOnInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists InstalledAddOnInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of InstalledAddOnInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return InstalledAddOnPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of InstalledAddOnInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return InstalledAddOnPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a InstalledAddOnContext - - :param sid: The SID of the InstalledAddOn resource to fetch +from twilio.base.version import Version - :returns: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnContext - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnContext - """ - return InstalledAddOnContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a InstalledAddOnContext - - :param sid: The SID of the InstalledAddOn resource to fetch - - :returns: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnContext - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnContext - """ - return InstalledAddOnContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class InstalledAddOnPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the InstalledAddOnPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnPage - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnPage - """ - super(InstalledAddOnPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of InstalledAddOnInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance - """ - return InstalledAddOnInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.installed_add_on.installed_add_on_extension import InstalledAddOnExtensionListInstance class InstalledAddOnContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the InstalledAddOnContext - - :param Version version: Version that contains the resource - :param sid: The SID of the InstalledAddOn resource to fetch - - :returns: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnContext - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnContext - """ - super(InstalledAddOnContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/InstalledAddOns/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/InstalledAddOns/${sid}' + self._extensions = None - + def delete(self): + + + """ Deletes the InstalledAddOnInstance @@ -242,231 +48,132 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - + def fetch(self): + """ Fetch the InstalledAddOnInstance :returns: The fetched InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return InstalledAddOnInstance(self._version, payload, sid=self._solution['sid'], ) + - def update(self, configuration=values.unset, unique_name=values.unset): - """ - Update the InstalledAddOnInstance - - :param dict configuration: The JSON object representing the configuration - :param unicode unique_name: An application-defined string that uniquely identifies the resource - - :returns: The updated InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance - """ - data = values.of({'Configuration': serialize.object(configuration), 'UniqueName': unique_name, }) + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return InstalledAddOnInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def extensions(self): - """ - Access the extensions - - :returns: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionList - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionList - """ - if self._extensions is None: - self._extensions = InstalledAddOnExtensionList( - self._version, - installed_add_on_sid=self._solution['sid'], - ) - return self._extensions + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class InstalledAddOnInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, sid=None): - """ - Initialize the InstalledAddOnInstance - :returns: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance - """ - super(InstalledAddOnInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'description': payload.get('description'), - 'configuration': payload.get('configuration'), - 'unique_name': payload.get('unique_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class InstalledAddOnInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'description' : payload.get('description'), + 'configuration' : payload.get('configuration'), + 'unique_name' : payload.get('unique_name'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: InstalledAddOnContext for this InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnContext - """ if self._context is None: - self._context = InstalledAddOnContext(self._version, sid=self._solution['sid'], ) + self._context = InstalledAddOnContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def description(self): - """ - :returns: A short description of the Add-on's functionality - :rtype: unicode - """ - return self._properties['description'] - - @property - def configuration(self): - """ - :returns: The JSON object that represents the current configuration of installed Add-on - :rtype: dict - """ - return self._properties['configuration'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] + def extensions(self): + return self._proxy.extensions + - @property - def url(self): + def __repr__(self): """ - :returns: The absolute URL of the resource - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - def delete(self): - """ - Deletes the InstalledAddOnInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() +class InstalledAddOnListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - def fetch(self): - """ - Fetch the InstalledAddOnInstance - - :returns: The fetched InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance - """ - return self._proxy.fetch() - - def update(self, configuration=values.unset, unique_name=values.unset): - """ - Update the InstalledAddOnInstance + # Path Solution + self._solution = { } + self._uri = '/InstalledAddOns' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - :param dict configuration: The JSON object representing the configuration - :param unicode unique_name: An application-defined string that uniquely identifies the resource + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: The updated InstalledAddOnInstance - :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance - """ - return self._proxy.update(configuration=configuration, unique_name=unique_name, ) + return InstalledAddOnInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def extensions(self): - """ - Access the extensions + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionList - :rtype: twilio.rest.preview.marketplace.installed_add_on.installed_add_on_extension.InstalledAddOnExtensionList - """ - return self._proxy.extensions + return InstalledAddOnPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/sync/__init__.py b/twilio/rest/preview/sync/__init__.py index 6a56a99bb6..bbc3c2cbb6 100644 --- a/twilio/rest/preview/sync/__init__.py +++ b/twilio/rest/preview/sync/__init__.py @@ -1,41 +1,43 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + 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 twilio.base.version import Version +from twilio.base.domain import Domain from twilio.rest.preview.sync.service import ServiceList class Sync(Version): - def __init__(self, domain): + def __init__(self, domain: Domain): """ Initialize the Sync version of Preview - :returns: Sync version of Preview - :rtype: twilio.rest.preview.sync.Sync.Sync + :param domain: The Twilio.preview domain """ - super(Sync, self).__init__(domain) + super().__init__(domain) self.version = 'Sync' self._services = None - + @property - def services(self): - """ - :rtype: twilio.rest.preview.sync.service.ServiceList - """ + def services(self) -> ServiceList: if self._services is None: self._services = ServiceList(self) return self._services - def __repr__(self): + def __repr__(self) -> str: """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/preview/sync/service.py b/twilio/rest/preview/sync/service.py deleted file mode 100644 index 3375409326..0000000000 --- a/twilio/rest/preview/sync/service.py +++ /dev/null @@ -1,187 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.service.document import DocumentListInstancefrom twilio.rest.service.sync_list import SyncListListInstancefrom twilio.rest.service.sync_map import SyncMapListInstance - - -class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Services/${sid}' - - self._documents = None - self._sync_lists = None - self._sync_maps = None - - def delete(self): - - - - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'webhook_url' : payload.get('webhook_url'), - 'reachability_webhooks_enabled' : payload.get('reachability_webhooks_enabled'), - 'acl_enabled' : payload.get('acl_enabled'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ServiceContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def documents(self): - return self._proxy.documents - @property - def sync_lists(self): - return self._proxy.sync_lists - @property - def sync_maps(self): - return self._proxy.sync_maps - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ServiceListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Services' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ServicePage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/preview/sync/service/__init__.py b/twilio/rest/preview/sync/service/__init__.py index b96080453d..3375409326 100644 --- a/twilio/rest/preview/sync/service/__init__.py +++ b/twilio/rest/preview/sync/service/__init__.py @@ -1,255 +1,48 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.preview.sync.service.document import DocumentList -from twilio.rest.preview.sync.service.sync_list import SyncListList -from twilio.rest.preview.sync.service.sync_map import SyncMapList - - -class ServiceList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.sync.service.ServiceList - :rtype: twilio.rest.preview.sync.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def create(self, friendly_name=values.unset, webhook_url=values.unset, - reachability_webhooks_enabled=values.unset, - acl_enabled=values.unset): - """ - Create the ServiceInstance - - :param unicode friendly_name: The friendly_name - :param unicode webhook_url: The webhook_url - :param bool reachability_webhooks_enabled: The reachability_webhooks_enabled - :param bool acl_enabled: The acl_enabled - - :returns: The created ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'WebhookUrl': webhook_url, - 'ReachabilityWebhooksEnabled': reachability_webhooks_enabled, - 'AclEnabled': acl_enabled, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.preview.sync.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) +from twilio.base.version import Version - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServicePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.ServiceContext - :rtype: twilio.rest.preview.sync.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.ServiceContext - :rtype: twilio.rest.preview.sync.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ServicePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.sync.service.ServicePage - :rtype: twilio.rest.preview.sync.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.sync.service.ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.service.document import DocumentListInstancefrom twilio.rest.service.sync_list import SyncListListInstancefrom twilio.rest.service.sync_map import SyncMapListInstance class ServiceContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.ServiceContext - :rtype: twilio.rest.preview.sync.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Services/${sid}' + self._documents = None self._sync_lists = None self._sync_maps = None - - def fetch(self): - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServiceInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - + def delete(self): + + + """ Deletes the ServiceInstance @@ -257,279 +50,138 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ServiceInstance - def update(self, webhook_url=values.unset, friendly_name=values.unset, - reachability_webhooks_enabled=values.unset, - acl_enabled=values.unset): + :returns: The fetched ServiceInstance + #TODO: add rtype docs """ - Update the ServiceInstance + payload = self._version.fetch(method='GET', uri=self._uri, ) - :param unicode webhook_url: The webhook_url - :param unicode friendly_name: The friendly_name - :param bool reachability_webhooks_enabled: The reachability_webhooks_enabled - :param bool acl_enabled: The acl_enabled + return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + - :returns: The updated ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServiceInstance - """ + + + def update(self, body): data = values.of({ - 'WebhookUrl': webhook_url, - 'FriendlyName': friendly_name, - 'ReachabilityWebhooksEnabled': reachability_webhooks_enabled, - 'AclEnabled': acl_enabled, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def documents(self): - """ - Access the documents - - :returns: twilio.rest.preview.sync.service.document.DocumentList - :rtype: twilio.rest.preview.sync.service.document.DocumentList - """ - if self._documents is None: - self._documents = DocumentList(self._version, service_sid=self._solution['sid'], ) - return self._documents - - @property - def sync_lists(self): - """ - Access the sync_lists - - :returns: twilio.rest.preview.sync.service.sync_list.SyncListList - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListList - """ - if self._sync_lists is None: - self._sync_lists = SyncListList(self._version, service_sid=self._solution['sid'], ) - return self._sync_lists - - @property - def sync_maps(self): - """ - Access the sync_maps - - :returns: twilio.rest.preview.sync.service.sync_map.SyncMapList - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapList - """ - if self._sync_maps is None: - self._sync_maps = SyncMapList(self._version, service_sid=self._solution['sid'], ) - return self._sync_maps + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class ServiceInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - :returns: twilio.rest.preview.sync.service.ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'webhook_url': payload.get('webhook_url'), - 'reachability_webhooks_enabled': payload.get('reachability_webhooks_enabled'), - 'acl_enabled': payload.get('acl_enabled'), - 'links': payload.get('links'), +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'webhook_url' : payload.get('webhook_url'), + 'reachability_webhooks_enabled' : payload.get('reachability_webhooks_enabled'), + 'acl_enabled' : payload.get('acl_enabled'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServiceContext - """ if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def webhook_url(self): - """ - :returns: The webhook_url - :rtype: unicode - """ - return self._properties['webhook_url'] - - @property - def reachability_webhooks_enabled(self): - """ - :returns: The reachability_webhooks_enabled - :rtype: bool - """ - return self._properties['reachability_webhooks_enabled'] - + def documents(self): + return self._proxy.documents @property - def acl_enabled(self): - """ - :returns: The acl_enabled - :rtype: bool - """ - return self._properties['acl_enabled'] - + def sync_lists(self): + return self._proxy.sync_lists @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServiceInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ServiceInstance + def sync_maps(self): + return self._proxy.sync_maps + - :returns: True if delete succeeds, False otherwise - :rtype: bool + def __repr__(self): """ - return self._proxy.delete() - - def update(self, webhook_url=values.unset, friendly_name=values.unset, - reachability_webhooks_enabled=values.unset, - acl_enabled=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the ServiceInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode webhook_url: The webhook_url - :param unicode friendly_name: The friendly_name - :param bool reachability_webhooks_enabled: The reachability_webhooks_enabled - :param bool acl_enabled: The acl_enabled - :returns: The updated ServiceInstance - :rtype: twilio.rest.preview.sync.service.ServiceInstance - """ - return self._proxy.update( - webhook_url=webhook_url, - friendly_name=friendly_name, - reachability_webhooks_enabled=reachability_webhooks_enabled, - acl_enabled=acl_enabled, - ) - @property - def documents(self): - """ - Access the documents +class ServiceListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.preview.sync.service.document.DocumentList - :rtype: twilio.rest.preview.sync.service.document.DocumentList - """ - return self._proxy.documents + # Path Solution + self._solution = { } + self._uri = '/Services' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def sync_lists(self): - """ - Access the sync_lists + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.preview.sync.service.sync_list.SyncListList - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListList - """ - return self._proxy.sync_lists + return ServiceInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def sync_maps(self): - """ - Access the sync_maps + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.preview.sync.service.sync_map.SyncMapList - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapList - """ - return self._proxy.sync_maps + return ServicePage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/sync/service/document.py b/twilio/rest/preview/sync/service/document.py deleted file mode 100644 index f45bcfcedd..0000000000 --- a/twilio/rest/preview/sync/service/document.py +++ /dev/null @@ -1,180 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.document.document_permission import DocumentPermissionListInstance - - -class DocumentContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Documents/${sid}' - - self._document_permissions = None - - def delete(self): - - - - """ - Deletes the DocumentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the DocumentInstance - - :returns: The fetched DocumentInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - def update(self, if_match, body): - data = values.of({ - 'if_match': if_match,'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class DocumentInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - 'revision' : payload.get('revision'), - 'data' : payload.get('data'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'created_by' : payload.get('created_by'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = DocumentContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def document_permissions(self): - return self._proxy.document_permissions - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class DocumentListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Documents' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return DocumentPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/preview/sync/service/document/__init__.py b/twilio/rest/preview/sync/service/document/__init__.py index 5f40b4f725..f45bcfcedd 100644 --- a/twilio/rest/preview/sync/service/document/__init__.py +++ b/twilio/rest/preview/sync/service/document/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,240 +19,28 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.preview.sync.service.document.document_permission import DocumentPermissionList - - -class DocumentList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid): - """ - Initialize the DocumentList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.preview.sync.service.document.DocumentList - :rtype: twilio.rest.preview.sync.service.document.DocumentList - """ - super(DocumentList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Documents'.format(**self._solution) - - def create(self, unique_name=values.unset, data=values.unset): - """ - Create the DocumentInstance - - :param unicode unique_name: The unique_name - :param dict data: The data - - :returns: The created DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentInstance - """ - data = values.of({'UniqueName': unique_name, 'Data': serialize.object(data), }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams DocumentInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.preview.sync.service.document.DocumentInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DocumentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.document.DocumentInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DocumentInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return DocumentPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DocumentInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DocumentPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a DocumentContext - - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.document.DocumentContext - :rtype: twilio.rest.preview.sync.service.document.DocumentContext - """ - return DocumentContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a DocumentContext +from twilio.base.version import Version - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.document.DocumentContext - :rtype: twilio.rest.preview.sync.service.document.DocumentContext - """ - return DocumentContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class DocumentPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the DocumentPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.preview.sync.service.document.DocumentPage - :rtype: twilio.rest.preview.sync.service.document.DocumentPage - """ - super(DocumentPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DocumentInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.sync.service.document.DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentInstance - """ - return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.document.document_permission import DocumentPermissionListInstance class DocumentContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the DocumentContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.document.DocumentContext - :rtype: twilio.rest.preview.sync.service.document.DocumentContext - """ - super(DocumentContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Documents/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Documents/${sid}' + self._document_permissions = None - - def fetch(self): - """ - Fetch the DocumentInstance - - :returns: The fetched DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DocumentInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the DocumentInstance @@ -253,240 +48,133 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, data, if_match=values.unset): + + def fetch(self): + """ - Update the DocumentInstance - - :param dict data: The data - :param unicode if_match: The If-Match HTTP request header + Fetch the DocumentInstance - :returns: The updated DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentInstance + :returns: The fetched DocumentInstance + #TODO: add rtype docs """ - data = values.of({'Data': serialize.object(data), }) - headers = values.of({'If-Match': if_match, }) + payload = self._version.fetch(method='GET', uri=self._uri, ) - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) + return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - return DocumentInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + + + def update(self, if_match, body): + data = values.of({ + 'if_match': if_match,'body': body, + }) - @property - def document_permissions(self): - """ - Access the document_permissions + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionList - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionList - """ - if self._document_permissions is None: - self._document_permissions = DocumentPermissionList( - self._version, - service_sid=self._solution['service_sid'], - document_sid=self._solution['sid'], - ) - return self._document_permissions + return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class DocumentInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the DocumentInstance - :returns: twilio.rest.preview.sync.service.document.DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentInstance - """ - super(DocumentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'url': payload.get('url'), - 'links': payload.get('links'), - 'revision': payload.get('revision'), - 'data': payload.get('data'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'created_by': payload.get('created_by'), +class DocumentInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), + 'revision' : payload.get('revision'), + 'data' : payload.get('data'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'created_by' : payload.get('created_by'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DocumentContext for this DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentContext - """ if self._context is None: self._context = DocumentContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def revision(self): - """ - :returns: The revision - :rtype: unicode - """ - return self._properties['revision'] - - @property - def data(self): - """ - :returns: The data - :rtype: dict - """ - return self._properties['data'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch the DocumentInstance - - :returns: The fetched DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the DocumentInstance + def document_permissions(self): + return self._proxy.document_permissions + - :returns: True if delete succeeds, False otherwise - :rtype: bool + def __repr__(self): """ - return self._proxy.delete() - - def update(self, data, if_match=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the DocumentInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param dict data: The data - :param unicode if_match: The If-Match HTTP request header - :returns: The updated DocumentInstance - :rtype: twilio.rest.preview.sync.service.document.DocumentInstance - """ - return self._proxy.update(data, if_match=if_match, ) - @property - def document_permissions(self): - """ - Access the document_permissions +class DocumentListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionList - :rtype: twilio.rest.preview.sync.service.document.document_permission.DocumentPermissionList - """ - return self._proxy.document_permissions + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Documents' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return DocumentPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/sync/service/sync_list.py b/twilio/rest/preview/sync/service/sync_list.py deleted file mode 100644 index 4950fa95e8..0000000000 --- a/twilio/rest/preview/sync/service/sync_list.py +++ /dev/null @@ -1,170 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.sync_list.sync_list_item import SyncListItemListInstancefrom twilio.rest.sync_list.sync_list_permission import SyncListPermissionListInstance - - -class SyncListContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Lists/${sid}' - - self._sync_list_items = None - self._sync_list_permissions = None - - def delete(self): - - - - """ - Deletes the SyncListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the SyncListInstance - - :returns: The fetched SyncListInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class SyncListInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - 'revision' : payload.get('revision'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'created_by' : payload.get('created_by'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = SyncListContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def sync_list_items(self): - return self._proxy.sync_list_items - @property - def sync_list_permissions(self): - return self._proxy.sync_list_permissions - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class SyncListListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Lists' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return SyncListPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/preview/sync/service/sync_list/__init__.py b/twilio/rest/preview/sync/service/sync_list/__init__.py index 05e2b02c8d..4950fa95e8 100644 --- a/twilio/rest/preview/sync/service/sync_list/__init__.py +++ b/twilio/rest/preview/sync/service/sync_list/__init__.py @@ -1,251 +1,47 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.preview.sync.service.sync_list.sync_list_item import SyncListItemList -from twilio.rest.preview.sync.service.sync_list.sync_list_permission import SyncListPermissionList - - -class SyncListList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid): - """ - Initialize the SyncListList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.preview.sync.service.sync_list.SyncListList - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListList - """ - super(SyncListList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Lists'.format(**self._solution) - - def create(self, unique_name=values.unset): - """ - Create the SyncListInstance - - :param unicode unique_name: The unique_name - - :returns: The created SyncListInstance - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListInstance - """ - data = values.of({'UniqueName': unique_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams SyncListInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.preview.sync.service.sync_list.SyncListInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SyncListInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.sync_list.SyncListInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncListInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SyncListInstance - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SyncListPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncListInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncListInstance - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncListPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SyncListContext - - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.sync_list.SyncListContext - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListContext - """ - return SyncListContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SyncListContext +from twilio.base.version import Version - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.sync_list.SyncListContext - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListContext - """ - return SyncListContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SyncListPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the SyncListPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.preview.sync.service.sync_list.SyncListPage - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListPage - """ - super(SyncListPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncListInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.sync.service.sync_list.SyncListInstance - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListInstance - """ - return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.sync_list.sync_list_item import SyncListItemListInstancefrom twilio.rest.sync_list.sync_list_permission import SyncListPermissionListInstance class SyncListContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the SyncListContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.sync_list.SyncListContext - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListContext - """ - super(SyncListContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Lists/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Lists/${sid}' + self._sync_list_items = None self._sync_list_permissions = None - - def fetch(self): - """ - Fetch the SyncListInstance - - :returns: The fetched SyncListInstance - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SyncListInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the SyncListInstance @@ -253,223 +49,122 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def sync_list_items(self): + + def fetch(self): + """ - Access the sync_list_items + Fetch the SyncListInstance - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemList - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemList + :returns: The fetched SyncListInstance + #TODO: add rtype docs """ - if self._sync_list_items is None: - self._sync_list_items = SyncListItemList( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['sid'], - ) - return self._sync_list_items + payload = self._version.fetch(method='GET', uri=self._uri, ) - @property - def sync_list_permissions(self): - """ - Access the sync_list_permissions + return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionList - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionList - """ - if self._sync_list_permissions is None: - self._sync_list_permissions = SyncListPermissionList( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['sid'], - ) - return self._sync_list_permissions + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class SyncListInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the SyncListInstance - :returns: twilio.rest.preview.sync.service.sync_list.SyncListInstance - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListInstance - """ - super(SyncListInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'url': payload.get('url'), - 'links': payload.get('links'), - 'revision': payload.get('revision'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'created_by': payload.get('created_by'), +class SyncListInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), + 'revision' : payload.get('revision'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'created_by' : payload.get('created_by'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncListContext for this SyncListInstance - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListContext - """ if self._context is None: self._context = SyncListContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def revision(self): - """ - :returns: The revision - :rtype: unicode - """ - return self._properties['revision'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - + def sync_list_items(self): + return self._proxy.sync_list_items @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch the SyncListInstance - - :returns: The fetched SyncListInstance - :rtype: twilio.rest.preview.sync.service.sync_list.SyncListInstance - """ - return self._proxy.fetch() + def sync_list_permissions(self): + return self._proxy.sync_list_permissions + - def delete(self): + def __repr__(self): """ - Deletes the SyncListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.delete() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def sync_list_items(self): - """ - Access the sync_list_items - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemList - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemList - """ - return self._proxy.sync_list_items - @property - def sync_list_permissions(self): - """ - Access the sync_list_permissions +class SyncListListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionList - :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_permission.SyncListPermissionList - """ - return self._proxy.sync_list_permissions + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Lists' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SyncListPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/sync/service/sync_map.py b/twilio/rest/preview/sync/service/sync_map.py deleted file mode 100644 index af4c6e78fe..0000000000 --- a/twilio/rest/preview/sync/service/sync_map.py +++ /dev/null @@ -1,170 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.sync_map.sync_map_item import SyncMapItemListInstancefrom twilio.rest.sync_map.sync_map_permission import SyncMapPermissionListInstance - - -class SyncMapContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Maps/${sid}' - - self._sync_map_items = None - self._sync_map_permissions = None - - def delete(self): - - - - """ - Deletes the SyncMapInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the SyncMapInstance - - :returns: The fetched SyncMapInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class SyncMapInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - 'revision' : payload.get('revision'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'created_by' : payload.get('created_by'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = SyncMapContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def sync_map_items(self): - return self._proxy.sync_map_items - @property - def sync_map_permissions(self): - return self._proxy.sync_map_permissions - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class SyncMapListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Maps' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return SyncMapPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/preview/sync/service/sync_map/__init__.py b/twilio/rest/preview/sync/service/sync_map/__init__.py index 9d6d4e6ca7..af4c6e78fe 100644 --- a/twilio/rest/preview/sync/service/sync_map/__init__.py +++ b/twilio/rest/preview/sync/service/sync_map/__init__.py @@ -1,251 +1,47 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.preview.sync.service.sync_map.sync_map_item import SyncMapItemList -from twilio.rest.preview.sync.service.sync_map.sync_map_permission import SyncMapPermissionList - - -class SyncMapList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid): - """ - Initialize the SyncMapList - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - - :returns: twilio.rest.preview.sync.service.sync_map.SyncMapList - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapList - """ - super(SyncMapList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Maps'.format(**self._solution) - - def create(self, unique_name=values.unset): - """ - Create the SyncMapInstance - - :param unicode unique_name: The unique_name - - :returns: The created SyncMapInstance - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapInstance - """ - data = values.of({'UniqueName': unique_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams SyncMapInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.preview.sync.service.sync_map.SyncMapInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SyncMapInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.sync.service.sync_map.SyncMapInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncMapInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SyncMapInstance - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SyncMapPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncMapInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncMapInstance - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncMapPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SyncMapContext - - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.sync_map.SyncMapContext - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapContext - """ - return SyncMapContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SyncMapContext +from twilio.base.version import Version - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.sync_map.SyncMapContext - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapContext - """ - return SyncMapContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SyncMapPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the SyncMapPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The service_sid - - :returns: twilio.rest.preview.sync.service.sync_map.SyncMapPage - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapPage - """ - super(SyncMapPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncMapInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.sync.service.sync_map.SyncMapInstance - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapInstance - """ - return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.sync_map.sync_map_item import SyncMapItemListInstancefrom twilio.rest.sync_map.sync_map_permission import SyncMapPermissionListInstance class SyncMapContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the SyncMapContext - - :param Version version: Version that contains the resource - :param service_sid: The service_sid - :param sid: The sid - - :returns: twilio.rest.preview.sync.service.sync_map.SyncMapContext - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapContext - """ - super(SyncMapContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Maps/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Maps/${sid}' + self._sync_map_items = None self._sync_map_permissions = None - - def fetch(self): - """ - Fetch the SyncMapInstance - - :returns: The fetched SyncMapInstance - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SyncMapInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the SyncMapInstance @@ -253,223 +49,122 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def sync_map_items(self): + + def fetch(self): + """ - Access the sync_map_items + Fetch the SyncMapInstance - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemList - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemList + :returns: The fetched SyncMapInstance + #TODO: add rtype docs """ - if self._sync_map_items is None: - self._sync_map_items = SyncMapItemList( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['sid'], - ) - return self._sync_map_items + payload = self._version.fetch(method='GET', uri=self._uri, ) - @property - def sync_map_permissions(self): - """ - Access the sync_map_permissions + return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionList - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionList - """ - if self._sync_map_permissions is None: - self._sync_map_permissions = SyncMapPermissionList( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['sid'], - ) - return self._sync_map_permissions + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class SyncMapInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the SyncMapInstance - :returns: twilio.rest.preview.sync.service.sync_map.SyncMapInstance - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapInstance - """ - super(SyncMapInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'url': payload.get('url'), - 'links': payload.get('links'), - 'revision': payload.get('revision'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'created_by': payload.get('created_by'), +class SyncMapInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), + 'revision' : payload.get('revision'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'created_by' : payload.get('created_by'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncMapContext for this SyncMapInstance - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapContext - """ if self._context is None: self._context = SyncMapContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The service_sid - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def revision(self): - """ - :returns: The revision - :rtype: unicode - """ - return self._properties['revision'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - + def sync_map_items(self): + return self._proxy.sync_map_items @property - def created_by(self): - """ - :returns: The created_by - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch the SyncMapInstance - - :returns: The fetched SyncMapInstance - :rtype: twilio.rest.preview.sync.service.sync_map.SyncMapInstance - """ - return self._proxy.fetch() + def sync_map_permissions(self): + return self._proxy.sync_map_permissions + - def delete(self): + def __repr__(self): """ - Deletes the SyncMapInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.delete() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def sync_map_items(self): - """ - Access the sync_map_items - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemList - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemList - """ - return self._proxy.sync_map_items - @property - def sync_map_permissions(self): - """ - Access the sync_map_permissions +class SyncMapListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionList - :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_permission.SyncMapPermissionList - """ - return self._proxy.sync_map_permissions + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Maps' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SyncMapPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/understand/__init__.py b/twilio/rest/preview/understand/__init__.py index a7f7ef6217..ee504554f3 100644 --- a/twilio/rest/preview/understand/__init__.py +++ b/twilio/rest/preview/understand/__init__.py @@ -1,41 +1,43 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + 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 twilio.base.version import Version +from twilio.base.domain import Domain from twilio.rest.preview.understand.assistant import AssistantList class Understand(Version): - def __init__(self, domain): + def __init__(self, domain: Domain): """ Initialize the Understand version of Preview - :returns: Understand version of Preview - :rtype: twilio.rest.preview.understand.Understand.Understand + :param domain: The Twilio.preview domain """ - super(Understand, self).__init__(domain) + super().__init__(domain) self.version = 'understand' self._assistants = None - + @property - def assistants(self): - """ - :rtype: twilio.rest.preview.understand.assistant.AssistantList - """ + def assistants(self) -> AssistantList: if self._assistants is None: self._assistants = AssistantList(self) return self._assistants - def __repr__(self): + def __repr__(self) -> str: """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/preview/understand/assistant.py b/twilio/rest/preview/understand/assistant.py deleted file mode 100644 index 6b16fbb1b3..0000000000 --- a/twilio/rest/preview/understand/assistant.py +++ /dev/null @@ -1,209 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.assistant.assistant_fallback_actions import AssistantFallbackActionsListInstancefrom twilio.rest.assistant.assistant_initiation_actions import AssistantInitiationActionsListInstancefrom twilio.rest.assistant.dialogue import DialogueListInstancefrom twilio.rest.assistant.field_type import FieldTypeListInstancefrom twilio.rest.assistant.model_build import ModelBuildListInstancefrom twilio.rest.assistant.query import QueryListInstancefrom twilio.rest.assistant.style_sheet import StyleSheetListInstancefrom twilio.rest.assistant.task import TaskListInstance - - -class AssistantContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Assistants/${sid}' - - self._assistant_fallback_actions = None - self._assistant_initiation_actions = None - self._dialogues = None - self._field_types = None - self._model_builds = None - self._queries = None - self._style_sheet = None - self._tasks = None - - def delete(self): - - - - """ - Deletes the AssistantInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the AssistantInstance - - :returns: The fetched AssistantInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AssistantInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return AssistantInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class AssistantInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'friendly_name' : payload.get('friendly_name'), - 'latest_model_build_sid' : payload.get('latest_model_build_sid'), - 'links' : payload.get('links'), - 'log_queries' : payload.get('log_queries'), - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'url' : payload.get('url'), - 'callback_url' : payload.get('callback_url'), - 'callback_events' : payload.get('callback_events'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = AssistantContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def assistant_fallback_actions(self): - return self._proxy.assistant_fallback_actions - @property - def assistant_initiation_actions(self): - return self._proxy.assistant_initiation_actions - @property - def dialogues(self): - return self._proxy.dialogues - @property - def field_types(self): - return self._proxy.field_types - @property - def model_builds(self): - return self._proxy.model_builds - @property - def queries(self): - return self._proxy.queries - @property - def style_sheet(self): - return self._proxy.style_sheet - @property - def tasks(self): - return self._proxy.tasks - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class AssistantListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Assistants' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return AssistantInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return AssistantPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/preview/understand/assistant/__init__.py b/twilio/rest/preview/understand/assistant/__init__.py index f951c05fe7..6b16fbb1b3 100644 --- a/twilio/rest/preview/understand/assistant/__init__.py +++ b/twilio/rest/preview/understand/assistant/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,696 +19,191 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.preview.understand.assistant.assistant_fallback_actions import AssistantFallbackActionsList -from twilio.rest.preview.understand.assistant.assistant_initiation_actions import AssistantInitiationActionsList -from twilio.rest.preview.understand.assistant.dialogue import DialogueList -from twilio.rest.preview.understand.assistant.field_type import FieldTypeList -from twilio.rest.preview.understand.assistant.model_build import ModelBuildList -from twilio.rest.preview.understand.assistant.query import QueryList -from twilio.rest.preview.understand.assistant.style_sheet import StyleSheetList -from twilio.rest.preview.understand.assistant.task import TaskList - - -class AssistantList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the AssistantList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.understand.assistant.AssistantList - :rtype: twilio.rest.preview.understand.assistant.AssistantList - """ - super(AssistantList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Assistants'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AssistantInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.preview.understand.assistant.AssistantInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) +from twilio.base.version import Version - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AssistantInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.understand.assistant.AssistantInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AssistantInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AssistantInstance - :rtype: twilio.rest.preview.understand.assistant.AssistantPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AssistantPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AssistantInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AssistantInstance - :rtype: twilio.rest.preview.understand.assistant.AssistantPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AssistantPage(self._version, response, self._solution) - - def create(self, friendly_name=values.unset, log_queries=values.unset, - unique_name=values.unset, callback_url=values.unset, - callback_events=values.unset, fallback_actions=values.unset, - initiation_actions=values.unset, style_sheet=values.unset): - """ - Create the AssistantInstance - - :param unicode friendly_name: A text description for the Assistant. It is non-unique and can up to 255 characters long. - :param bool log_queries: A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. Defaults to true if no value is provided. - :param unicode unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - :param unicode callback_url: A user-provided URL to send event callbacks to. - :param unicode callback_events: Space-separated list of callback events that will trigger callbacks. - :param dict fallback_actions: The JSON actions to be executed when the user's input is not recognized as matching any Task. - :param dict initiation_actions: The JSON actions to be executed on inbound phone calls when the Assistant has to say something first. - :param dict style_sheet: The JSON object that holds the style sheet for the assistant - - :returns: The created AssistantInstance - :rtype: twilio.rest.preview.understand.assistant.AssistantInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'LogQueries': log_queries, - 'UniqueName': unique_name, - 'CallbackUrl': callback_url, - 'CallbackEvents': callback_events, - 'FallbackActions': serialize.object(fallback_actions), - 'InitiationActions': serialize.object(initiation_actions), - 'StyleSheet': serialize.object(style_sheet), - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return AssistantInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a AssistantContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.preview.understand.assistant.AssistantContext - :rtype: twilio.rest.preview.understand.assistant.AssistantContext - """ - return AssistantContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a AssistantContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.preview.understand.assistant.AssistantContext - :rtype: twilio.rest.preview.understand.assistant.AssistantContext - """ - return AssistantContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AssistantPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the AssistantPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.understand.assistant.AssistantPage - :rtype: twilio.rest.preview.understand.assistant.AssistantPage - """ - super(AssistantPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AssistantInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.assistant.AssistantInstance - :rtype: twilio.rest.preview.understand.assistant.AssistantInstance - """ - return AssistantInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.assistant.assistant_fallback_actions import AssistantFallbackActionsListInstancefrom twilio.rest.assistant.assistant_initiation_actions import AssistantInitiationActionsListInstancefrom twilio.rest.assistant.dialogue import DialogueListInstancefrom twilio.rest.assistant.field_type import FieldTypeListInstancefrom twilio.rest.assistant.model_build import ModelBuildListInstancefrom twilio.rest.assistant.query import QueryListInstancefrom twilio.rest.assistant.style_sheet import StyleSheetListInstancefrom twilio.rest.assistant.task import TaskListInstance class AssistantContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the AssistantContext - - :param Version version: Version that contains the resource - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.preview.understand.assistant.AssistantContext - :rtype: twilio.rest.preview.understand.assistant.AssistantContext - """ - super(AssistantContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Assistants/{sid}'.format(**self._solution) - - # Dependents - self._field_types = None - self._tasks = None - self._model_builds = None - self._queries = None + self._solution = { 'sid': sid, } + self._uri = '/Assistants/${sid}' + self._assistant_fallback_actions = None self._assistant_initiation_actions = None self._dialogues = None + self._field_types = None + self._model_builds = None + self._queries = None self._style_sheet = None + self._tasks = None + + def delete(self): + + + + """ + Deletes the AssistantInstance + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the AssistantInstance :returns: The fetched AssistantInstance - :rtype: twilio.rest.preview.understand.assistant.AssistantInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return AssistantInstance(self._version, payload, sid=self._solution['sid'], ) + - def update(self, friendly_name=values.unset, log_queries=values.unset, - unique_name=values.unset, callback_url=values.unset, - callback_events=values.unset, fallback_actions=values.unset, - initiation_actions=values.unset, style_sheet=values.unset): - """ - Update the AssistantInstance - - :param unicode friendly_name: A text description for the Assistant. It is non-unique and can up to 255 characters long. - :param bool log_queries: A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. Defaults to true if no value is provided. - :param unicode unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - :param unicode callback_url: A user-provided URL to send event callbacks to. - :param unicode callback_events: Space-separated list of callback events that will trigger callbacks. - :param dict fallback_actions: The JSON actions to be executed when the user's input is not recognized as matching any Task. - :param dict initiation_actions: The JSON actions to be executed on inbound phone calls when the Assistant has to say something first. - :param dict style_sheet: The JSON object that holds the style sheet for the assistant - - :returns: The updated AssistantInstance - :rtype: twilio.rest.preview.understand.assistant.AssistantInstance - """ + + + def update(self, body): data = values.of({ - 'FriendlyName': friendly_name, - 'LogQueries': log_queries, - 'UniqueName': unique_name, - 'CallbackUrl': callback_url, - 'CallbackEvents': callback_events, - 'FallbackActions': serialize.object(fallback_actions), - 'InitiationActions': serialize.object(initiation_actions), - 'StyleSheet': serialize.object(style_sheet), + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return AssistantInstance(self._version, payload, sid=self._solution['sid'], ) + + - def delete(self): - """ - Deletes the AssistantInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def field_types(self): - """ - Access the field_types - - :returns: twilio.rest.preview.understand.assistant.field_type.FieldTypeList - :rtype: twilio.rest.preview.understand.assistant.field_type.FieldTypeList - """ - if self._field_types is None: - self._field_types = FieldTypeList(self._version, assistant_sid=self._solution['sid'], ) - return self._field_types - - @property - def tasks(self): - """ - Access the tasks - - :returns: twilio.rest.preview.understand.assistant.task.TaskList - :rtype: twilio.rest.preview.understand.assistant.task.TaskList - """ - if self._tasks is None: - self._tasks = TaskList(self._version, assistant_sid=self._solution['sid'], ) - return self._tasks - - @property - def model_builds(self): - """ - Access the model_builds - - :returns: twilio.rest.preview.understand.assistant.model_build.ModelBuildList - :rtype: twilio.rest.preview.understand.assistant.model_build.ModelBuildList - """ - if self._model_builds is None: - self._model_builds = ModelBuildList(self._version, assistant_sid=self._solution['sid'], ) - return self._model_builds - - @property - def queries(self): - """ - Access the queries - - :returns: twilio.rest.preview.understand.assistant.query.QueryList - :rtype: twilio.rest.preview.understand.assistant.query.QueryList - """ - if self._queries is None: - self._queries = QueryList(self._version, assistant_sid=self._solution['sid'], ) - return self._queries - - @property - def assistant_fallback_actions(self): - """ - Access the assistant_fallback_actions - - :returns: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsList - :rtype: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsList - """ - if self._assistant_fallback_actions is None: - self._assistant_fallback_actions = AssistantFallbackActionsList( - self._version, - assistant_sid=self._solution['sid'], - ) - return self._assistant_fallback_actions - - @property - def assistant_initiation_actions(self): - """ - Access the assistant_initiation_actions - - :returns: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsList - :rtype: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsList - """ - if self._assistant_initiation_actions is None: - self._assistant_initiation_actions = AssistantInitiationActionsList( - self._version, - assistant_sid=self._solution['sid'], - ) - return self._assistant_initiation_actions - - @property - def dialogues(self): - """ - Access the dialogues - - :returns: twilio.rest.preview.understand.assistant.dialogue.DialogueList - :rtype: twilio.rest.preview.understand.assistant.dialogue.DialogueList - """ - if self._dialogues is None: - self._dialogues = DialogueList(self._version, assistant_sid=self._solution['sid'], ) - return self._dialogues - - @property - def style_sheet(self): - """ - Access the style_sheet - - :returns: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetList - :rtype: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetList - """ - if self._style_sheet is None: - self._style_sheet = StyleSheetList(self._version, assistant_sid=self._solution['sid'], ) - return self._style_sheet + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class AssistantInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the AssistantInstance - :returns: twilio.rest.preview.understand.assistant.AssistantInstance - :rtype: twilio.rest.preview.understand.assistant.AssistantInstance - """ - super(AssistantInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'latest_model_build_sid': payload.get('latest_model_build_sid'), - 'links': payload.get('links'), - 'log_queries': payload.get('log_queries'), - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'url': payload.get('url'), - 'callback_url': payload.get('callback_url'), - 'callback_events': payload.get('callback_events'), +class AssistantInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'friendly_name' : payload.get('friendly_name'), + 'latest_model_build_sid' : payload.get('latest_model_build_sid'), + 'links' : payload.get('links'), + 'log_queries' : payload.get('log_queries'), + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'url' : payload.get('url'), + 'callback_url' : payload.get('callback_url'), + 'callback_events' : payload.get('callback_events'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AssistantContext for this AssistantInstance - :rtype: twilio.rest.preview.understand.assistant.AssistantContext - """ if self._context is None: - self._context = AssistantContext(self._version, sid=self._solution['sid'], ) + self._context = AssistantContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def account_sid(self): - """ - :returns: The unique ID of the Account that created this Assistant. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: A text description for the Assistant. It is non-unique and can up to 255 characters long. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def latest_model_build_sid(self): - """ - :returns: The unique ID (Sid) of the latest model build. Null if no model has been built. - :rtype: unicode - """ - return self._properties['latest_model_build_sid'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def log_queries(self): - """ - :returns: A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. - :rtype: bool - """ - return self._properties['log_queries'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: A user-provided string that uniquely identifies this resource as an alternative to the sid. You can use the unique name in the URL path. Unique up to 64 characters long. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - + def assistant_fallback_actions(self): + return self._proxy.assistant_fallback_actions @property - def callback_url(self): - """ - :returns: A user-provided URL to send event callbacks to. - :rtype: unicode - """ - return self._properties['callback_url'] - + def assistant_initiation_actions(self): + return self._proxy.assistant_initiation_actions @property - def callback_events(self): - """ - :returns: Space-separated list of callback events that will trigger callbacks. - :rtype: unicode - """ - return self._properties['callback_events'] - - def fetch(self): - """ - Fetch the AssistantInstance - - :returns: The fetched AssistantInstance - :rtype: twilio.rest.preview.understand.assistant.AssistantInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, log_queries=values.unset, - unique_name=values.unset, callback_url=values.unset, - callback_events=values.unset, fallback_actions=values.unset, - initiation_actions=values.unset, style_sheet=values.unset): - """ - Update the AssistantInstance - - :param unicode friendly_name: A text description for the Assistant. It is non-unique and can up to 255 characters long. - :param bool log_queries: A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. Defaults to true if no value is provided. - :param unicode unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - :param unicode callback_url: A user-provided URL to send event callbacks to. - :param unicode callback_events: Space-separated list of callback events that will trigger callbacks. - :param dict fallback_actions: The JSON actions to be executed when the user's input is not recognized as matching any Task. - :param dict initiation_actions: The JSON actions to be executed on inbound phone calls when the Assistant has to say something first. - :param dict style_sheet: The JSON object that holds the style sheet for the assistant - - :returns: The updated AssistantInstance - :rtype: twilio.rest.preview.understand.assistant.AssistantInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - log_queries=log_queries, - unique_name=unique_name, - callback_url=callback_url, - callback_events=callback_events, - fallback_actions=fallback_actions, - initiation_actions=initiation_actions, - style_sheet=style_sheet, - ) - - def delete(self): - """ - Deletes the AssistantInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - + def dialogues(self): + return self._proxy.dialogues @property def field_types(self): - """ - Access the field_types - - :returns: twilio.rest.preview.understand.assistant.field_type.FieldTypeList - :rtype: twilio.rest.preview.understand.assistant.field_type.FieldTypeList - """ return self._proxy.field_types - - @property - def tasks(self): - """ - Access the tasks - - :returns: twilio.rest.preview.understand.assistant.task.TaskList - :rtype: twilio.rest.preview.understand.assistant.task.TaskList - """ - return self._proxy.tasks - @property def model_builds(self): - """ - Access the model_builds - - :returns: twilio.rest.preview.understand.assistant.model_build.ModelBuildList - :rtype: twilio.rest.preview.understand.assistant.model_build.ModelBuildList - """ return self._proxy.model_builds - @property def queries(self): - """ - Access the queries - - :returns: twilio.rest.preview.understand.assistant.query.QueryList - :rtype: twilio.rest.preview.understand.assistant.query.QueryList - """ return self._proxy.queries - @property - def assistant_fallback_actions(self): - """ - Access the assistant_fallback_actions + def style_sheet(self): + return self._proxy.style_sheet + @property + def tasks(self): + return self._proxy.tasks + - :returns: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsList - :rtype: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsList + def __repr__(self): """ - return self._proxy.assistant_fallback_actions - - @property - def assistant_initiation_actions(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Access the assistant_initiation_actions + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsList - :rtype: twilio.rest.preview.understand.assistant.assistant_initiation_actions.AssistantInitiationActionsList - """ - return self._proxy.assistant_initiation_actions - @property - def dialogues(self): - """ - Access the dialogues - :returns: twilio.rest.preview.understand.assistant.dialogue.DialogueList - :rtype: twilio.rest.preview.understand.assistant.dialogue.DialogueList - """ - return self._proxy.dialogues +class AssistantListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - @property - def style_sheet(self): - """ - Access the style_sheet + # Path Solution + self._solution = { } + self._uri = '/Assistants' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - :returns: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetList - :rtype: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetList - """ - return self._proxy.style_sheet + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return AssistantInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AssistantPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/understand/assistant/field_type.py b/twilio/rest/preview/understand/assistant/field_type.py deleted file mode 100644 index df0f26e148..0000000000 --- a/twilio/rest/preview/understand/assistant/field_type.py +++ /dev/null @@ -1,178 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.field_type.field_value import FieldValueListInstance - - -class FieldTypeContext(InstanceContext): - def __init__(self, version: Version, assistant_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'assistant_sid': assistant_sid, 'sid': sid, } - self._uri = '/Assistants/${assistant_sid}/FieldTypes/${sid}' - - self._field_values = None - - def delete(self): - - - - """ - Deletes the FieldTypeInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the FieldTypeInstance - - :returns: The fetched FieldTypeInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class FieldTypeInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'friendly_name' : payload.get('friendly_name'), - 'links' : payload.get('links'), - 'assistant_sid' : payload.get('assistant_sid'), - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'url' : payload.get('url'), - } - - self._context = None - self._solution = { - 'assistant_sid': assistant_sid or self._properties['assistant_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = FieldTypeContext( - self._version, - assistant_sid=self._solution['assistant_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def field_values(self): - return self._proxy.field_values - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class FieldTypeListInstance(ListResource): - def __init__(self, version: Version, assistant_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'assistant_sid': assistant_sid, } - self._uri = '/Assistants/${assistant_sid}/FieldTypes' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return FieldTypePage(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/preview/understand/assistant/field_type/__init__.py b/twilio/rest/preview/understand/assistant/field_type/__init__.py index 4980ff0107..df0f26e148 100644 --- a/twilio/rest/preview/understand/assistant/field_type/__init__.py +++ b/twilio/rest/preview/understand/assistant/field_type/__init__.py @@ -1,472 +1,178 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.preview.understand.assistant.field_type.field_value import FieldValueList - - -class FieldTypeList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the FieldTypeList - - :param Version version: Version that contains the resource - :param assistant_sid: The unique ID of the Assistant. - - :returns: twilio.rest.preview.understand.assistant.field_type.FieldTypeList - :rtype: twilio.rest.preview.understand.assistant.field_type.FieldTypeList - """ - super(FieldTypeList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - self._uri = '/Assistants/{assistant_sid}/FieldTypes'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams FieldTypeInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.preview.understand.assistant.field_type.FieldTypeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists FieldTypeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.understand.assistant.field_type.FieldTypeInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of FieldTypeInstance records from the API. - Request is executed immediately +from twilio.base.version import Version - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of FieldTypeInstance - :rtype: twilio.rest.preview.understand.assistant.field_type.FieldTypePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return FieldTypePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FieldTypeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FieldTypeInstance - :rtype: twilio.rest.preview.understand.assistant.field_type.FieldTypePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FieldTypePage(self._version, response, self._solution) - - def create(self, unique_name, friendly_name=values.unset): - """ - Create the FieldTypeInstance - - :param unicode unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - :param unicode friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. - - :returns: The created FieldTypeInstance - :rtype: twilio.rest.preview.understand.assistant.field_type.FieldTypeInstance - """ - data = values.of({'UniqueName': unique_name, 'FriendlyName': friendly_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - - def get(self, sid): - """ - Constructs a FieldTypeContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.assistant.field_type.FieldTypeContext - :rtype: twilio.rest.preview.understand.assistant.field_type.FieldTypeContext - """ - return FieldTypeContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a FieldTypeContext - - :param sid: The sid - - :returns: twilio.rest.preview.understand.assistant.field_type.FieldTypeContext - :rtype: twilio.rest.preview.understand.assistant.field_type.FieldTypeContext - """ - return FieldTypeContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FieldTypePage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ +from twilio.base.page import Page - def __init__(self, version, response, solution): - """ - Initialize the FieldTypePage +# from twilio.rest.field_type.field_value import FieldValueListInstance - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The unique ID of the Assistant. - :returns: twilio.rest.preview.understand.assistant.field_type.FieldTypePage - :rtype: twilio.rest.preview.understand.assistant.field_type.FieldTypePage - """ - super(FieldTypePage, self).__init__(version, response) +class FieldTypeContext(InstanceContext): + def __init__(self, version: Version, assistant_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FieldTypeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.assistant.field_type.FieldTypeInstance - :rtype: twilio.rest.preview.understand.assistant.field_type.FieldTypeInstance - """ - return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FieldTypeContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ + self._solution = { 'assistant_sid': assistant_sid, 'sid': sid, } + self._uri = '/Assistants/${assistant_sid}/FieldTypes/${sid}' + + self._field_values = None + + def delete(self): + + - def __init__(self, version, assistant_sid, sid): """ - Initialize the FieldTypeContext - - :param Version version: Version that contains the resource - :param assistant_sid: The assistant_sid - :param sid: The sid + Deletes the FieldTypeInstance - :returns: twilio.rest.preview.understand.assistant.field_type.FieldTypeContext - :rtype: twilio.rest.preview.understand.assistant.field_type.FieldTypeContext + :returns: True if delete succeeds, False otherwise + :rtype: bool """ - super(FieldTypeContext, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'sid': sid, } - self._uri = '/Assistants/{assistant_sid}/FieldTypes/{sid}'.format(**self._solution) - - # Dependents - self._field_values = None - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the FieldTypeInstance :returns: The fetched FieldTypeInstance - :rtype: twilio.rest.preview.understand.assistant.field_type.FieldTypeInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return FieldTypeInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) + return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) + - def update(self, friendly_name=values.unset, unique_name=values.unset): - """ - Update the FieldTypeInstance + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :param unicode friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. - :param unicode unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: The updated FieldTypeInstance - :rtype: twilio.rest.preview.understand.assistant.field_type.FieldTypeInstance - """ - data = values.of({'FriendlyName': friendly_name, 'UniqueName': unique_name, }) + return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) + + - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return FieldTypeInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the FieldTypeInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def field_values(self): - """ - Access the field_values - - :returns: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueList - :rtype: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueList - """ - if self._field_values is None: - self._field_values = FieldValueList( - self._version, - assistant_sid=self._solution['assistant_sid'], - field_type_sid=self._solution['sid'], - ) - return self._field_values + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class FieldTypeInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, assistant_sid, sid=None): - """ - Initialize the FieldTypeInstance - :returns: twilio.rest.preview.understand.assistant.field_type.FieldTypeInstance - :rtype: twilio.rest.preview.understand.assistant.field_type.FieldTypeInstance - """ - super(FieldTypeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'links': payload.get('links'), - 'assistant_sid': payload.get('assistant_sid'), - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'url': payload.get('url'), +class FieldTypeInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'friendly_name' : payload.get('friendly_name'), + 'links' : payload.get('links'), + 'assistant_sid' : payload.get('assistant_sid'), + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'url' : payload.get('url'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FieldTypeContext for this FieldTypeInstance - :rtype: twilio.rest.preview.understand.assistant.field_type.FieldTypeContext - """ if self._context is None: self._context = FieldTypeContext( self._version, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], + assistant_sid=self._solution['assistant_sid'],sid=self._solution['sid'], ) return self._context @property - def account_sid(self): - """ - :returns: The unique ID of the Account that created this Field Type. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def assistant_sid(self): - """ - :returns: The unique ID of the Assistant. - :rtype: unicode - """ - return self._properties['assistant_sid'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the FieldTypeInstance - - :returns: The fetched FieldTypeInstance - :rtype: twilio.rest.preview.understand.assistant.field_type.FieldTypeInstance - """ - return self._proxy.fetch() + def field_values(self): + return self._proxy.field_values + - def update(self, friendly_name=values.unset, unique_name=values.unset): + def __repr__(self): """ - Update the FieldTypeInstance - - :param unicode friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. - :param unicode unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - - :returns: The updated FieldTypeInstance - :rtype: twilio.rest.preview.understand.assistant.field_type.FieldTypeInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update(friendly_name=friendly_name, unique_name=unique_name, ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the FieldTypeInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - @property - def field_values(self): - """ - Access the field_values +class FieldTypeListInstance(ListResource): + def __init__(self, version: Version, assistant_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueList - :rtype: twilio.rest.preview.understand.assistant.field_type.field_value.FieldValueList - """ - return self._proxy.field_values + # Path Solution + self._solution = { 'assistant_sid': assistant_sid, } + self._uri = '/Assistants/${assistant_sid}/FieldTypes' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return FieldTypePage(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/understand/assistant/task.py b/twilio/rest/preview/understand/assistant/task.py deleted file mode 100644 index 11578ca482..0000000000 --- a/twilio/rest/preview/understand/assistant/task.py +++ /dev/null @@ -1,191 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.task.field import FieldListInstancefrom twilio.rest.task.sample import SampleListInstancefrom twilio.rest.task.task_actions import TaskActionsListInstancefrom twilio.rest.task.task_statistics import TaskStatisticsListInstance - - -class TaskContext(InstanceContext): - def __init__(self, version: Version, assistant_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'assistant_sid': assistant_sid, 'sid': sid, } - self._uri = '/Assistants/${assistant_sid}/Tasks/${sid}' - - self._fields = None - self._samples = None - self._task_actions = None - self._statistics = None - - def delete(self): - - - - """ - Deletes the TaskInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the TaskInstance - - :returns: The fetched TaskInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TaskInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return TaskInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class TaskInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'friendly_name' : payload.get('friendly_name'), - 'links' : payload.get('links'), - 'assistant_sid' : payload.get('assistant_sid'), - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'actions_url' : payload.get('actions_url'), - 'url' : payload.get('url'), - } - - self._context = None - self._solution = { - 'assistant_sid': assistant_sid or self._properties['assistant_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = TaskContext( - self._version, - assistant_sid=self._solution['assistant_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def fields(self): - return self._proxy.fields - @property - def samples(self): - return self._proxy.samples - @property - def task_actions(self): - return self._proxy.task_actions - @property - def statistics(self): - return self._proxy.statistics - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class TaskListInstance(ListResource): - def __init__(self, version: Version, assistant_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'assistant_sid': assistant_sid, } - self._uri = '/Assistants/${assistant_sid}/Tasks' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return TaskInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return TaskPage(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/preview/understand/assistant/task/__init__.py b/twilio/rest/preview/understand/assistant/task/__init__.py index 9aac68ff08..11578ca482 100644 --- a/twilio/rest/preview/understand/assistant/task/__init__.py +++ b/twilio/rest/preview/understand/assistant/task/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,283 +19,31 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.preview.understand.assistant.task.field import FieldList -from twilio.rest.preview.understand.assistant.task.sample import SampleList -from twilio.rest.preview.understand.assistant.task.task_actions import TaskActionsList -from twilio.rest.preview.understand.assistant.task.task_statistics import TaskStatisticsList - - -class TaskList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid): - """ - Initialize the TaskList - - :param Version version: Version that contains the resource - :param assistant_sid: The unique ID of the Assistant. - - :returns: twilio.rest.preview.understand.assistant.task.TaskList - :rtype: twilio.rest.preview.understand.assistant.task.TaskList - """ - super(TaskList, self).__init__(version) - - # Path Solution - self._solution = {'assistant_sid': assistant_sid, } - self._uri = '/Assistants/{assistant_sid}/Tasks'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams TaskInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.preview.understand.assistant.task.TaskInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists TaskInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.understand.assistant.task.TaskInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of TaskInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of TaskInstance - :rtype: twilio.rest.preview.understand.assistant.task.TaskPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return TaskPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TaskInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TaskInstance - :rtype: twilio.rest.preview.understand.assistant.task.TaskPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TaskPage(self._version, response, self._solution) - - def create(self, unique_name, friendly_name=values.unset, actions=values.unset, - actions_url=values.unset): - """ - Create the TaskInstance - - :param unicode unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - :param unicode friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. - :param dict actions: A user-provided JSON object encoded as a string to specify the actions for this task. It is optional and non-unique. - :param unicode actions_url: User-provided HTTP endpoint where from the assistant fetches actions - - :returns: The created TaskInstance - :rtype: twilio.rest.preview.understand.assistant.task.TaskInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'FriendlyName': friendly_name, - 'Actions': serialize.object(actions), - 'ActionsUrl': actions_url, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return TaskInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - - def get(self, sid): - """ - Constructs a TaskContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.preview.understand.assistant.task.TaskContext - :rtype: twilio.rest.preview.understand.assistant.task.TaskContext - """ - return TaskContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a TaskContext - - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.preview.understand.assistant.task.TaskContext - :rtype: twilio.rest.preview.understand.assistant.task.TaskContext - """ - return TaskContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TaskPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the TaskPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param assistant_sid: The unique ID of the Assistant. - - :returns: twilio.rest.preview.understand.assistant.task.TaskPage - :rtype: twilio.rest.preview.understand.assistant.task.TaskPage - """ - super(TaskPage, self).__init__(version, response) +from twilio.base.version import Version - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TaskInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.understand.assistant.task.TaskInstance - :rtype: twilio.rest.preview.understand.assistant.task.TaskInstance - """ - return TaskInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.task.field import FieldListInstancefrom twilio.rest.task.sample import SampleListInstancefrom twilio.rest.task.task_actions import TaskActionsListInstancefrom twilio.rest.task.task_statistics import TaskStatisticsListInstance class TaskContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, assistant_sid, sid): - """ - Initialize the TaskContext - - :param Version version: Version that contains the resource - :param assistant_sid: The unique ID of the Assistant. - :param sid: A 34 character string that uniquely identifies this resource. - - :returns: twilio.rest.preview.understand.assistant.task.TaskContext - :rtype: twilio.rest.preview.understand.assistant.task.TaskContext - """ - super(TaskContext, self).__init__(version) + def __init__(self, version: Version, assistant_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'assistant_sid': assistant_sid, 'sid': sid, } - self._uri = '/Assistants/{assistant_sid}/Tasks/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'assistant_sid': assistant_sid, 'sid': sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks/${sid}' + self._fields = None self._samples = None self._task_actions = None self._statistics = None - - def fetch(self): - """ - Fetch the TaskInstance - - :returns: The fetched TaskInstance - :rtype: twilio.rest.preview.understand.assistant.task.TaskInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TaskInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset, unique_name=values.unset, - actions=values.unset, actions_url=values.unset): - """ - Update the TaskInstance - - :param unicode friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. - :param unicode unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - :param dict actions: A user-provided JSON object encoded as a string to specify the actions for this task. It is optional and non-unique. - :param unicode actions_url: User-provided HTTP endpoint where from the assistant fetches actions - - :returns: The updated TaskInstance - :rtype: twilio.rest.preview.understand.assistant.task.TaskInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'UniqueName': unique_name, - 'Actions': serialize.object(actions), - 'ActionsUrl': actions_url, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return TaskInstance( - self._version, - payload, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the TaskInstance @@ -296,295 +51,141 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def fields(self): + + def fetch(self): + """ - Access the fields + Fetch the TaskInstance - :returns: twilio.rest.preview.understand.assistant.task.field.FieldList - :rtype: twilio.rest.preview.understand.assistant.task.field.FieldList + :returns: The fetched TaskInstance + #TODO: add rtype docs """ - if self._fields is None: - self._fields = FieldList( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['sid'], - ) - return self._fields + payload = self._version.fetch(method='GET', uri=self._uri, ) - @property - def samples(self): - """ - Access the samples + return TaskInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) + - :returns: twilio.rest.preview.understand.assistant.task.sample.SampleList - :rtype: twilio.rest.preview.understand.assistant.task.sample.SampleList - """ - if self._samples is None: - self._samples = SampleList( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['sid'], - ) - return self._samples + + + def update(self, body): + data = values.of({ + 'body': body, + }) - @property - def task_actions(self): - """ - Access the task_actions + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsList - :rtype: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsList - """ - if self._task_actions is None: - self._task_actions = TaskActionsList( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['sid'], - ) - return self._task_actions + return TaskInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], ) + + - @property - def statistics(self): - """ - Access the statistics - - :returns: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsList - :rtype: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsList - """ - if self._statistics is None: - self._statistics = TaskStatisticsList( - self._version, - assistant_sid=self._solution['assistant_sid'], - task_sid=self._solution['sid'], - ) - return self._statistics + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class TaskInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version, payload, assistant_sid, sid=None): - """ - Initialize the TaskInstance - :returns: twilio.rest.preview.understand.assistant.task.TaskInstance - :rtype: twilio.rest.preview.understand.assistant.task.TaskInstance - """ - super(TaskInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'links': payload.get('links'), - 'assistant_sid': payload.get('assistant_sid'), - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'actions_url': payload.get('actions_url'), - 'url': payload.get('url'), +class TaskInstance(InstanceResource): + def __init__(self, version, payload, assistant_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'friendly_name' : payload.get('friendly_name'), + 'links' : payload.get('links'), + 'assistant_sid' : payload.get('assistant_sid'), + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'actions_url' : payload.get('actions_url'), + 'url' : payload.get('url'), } - # Context self._context = None - self._solution = {'assistant_sid': assistant_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'assistant_sid': assistant_sid or self._properties['assistant_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TaskContext for this TaskInstance - :rtype: twilio.rest.preview.understand.assistant.task.TaskContext - """ if self._context is None: self._context = TaskContext( self._version, - assistant_sid=self._solution['assistant_sid'], - sid=self._solution['sid'], + assistant_sid=self._solution['assistant_sid'],sid=self._solution['sid'], ) return self._context @property - def account_sid(self): - """ - :returns: The unique ID of the Account that created this Task. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The date that this resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date that this resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - @property - def assistant_sid(self): - """ - :returns: The unique ID of the Assistant. - :rtype: unicode - """ - return self._properties['assistant_sid'] - - @property - def sid(self): - """ - :returns: A 34 character string that uniquely identifies this resource. - :rtype: unicode - """ - return self._properties['sid'] - + def fields(self): + return self._proxy.fields @property - def unique_name(self): - """ - :returns: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - :rtype: unicode - """ - return self._properties['unique_name'] - + def samples(self): + return self._proxy.samples @property - def actions_url(self): - """ - :returns: User-provided HTTP endpoint where from the assistant fetches actions - :rtype: unicode - """ - return self._properties['actions_url'] - + def task_actions(self): + return self._proxy.task_actions @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the TaskInstance - - :returns: The fetched TaskInstance - :rtype: twilio.rest.preview.understand.assistant.task.TaskInstance - """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset, unique_name=values.unset, - actions=values.unset, actions_url=values.unset): - """ - Update the TaskInstance - - :param unicode friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. - :param unicode unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - :param dict actions: A user-provided JSON object encoded as a string to specify the actions for this task. It is optional and non-unique. - :param unicode actions_url: User-provided HTTP endpoint where from the assistant fetches actions - - :returns: The updated TaskInstance - :rtype: twilio.rest.preview.understand.assistant.task.TaskInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - unique_name=unique_name, - actions=actions, - actions_url=actions_url, - ) + def statistics(self): + return self._proxy.statistics + - def delete(self): + def __repr__(self): """ - Deletes the TaskInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.delete() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def fields(self): - """ - Access the fields - :returns: twilio.rest.preview.understand.assistant.task.field.FieldList - :rtype: twilio.rest.preview.understand.assistant.task.field.FieldList - """ - return self._proxy.fields - @property - def samples(self): - """ - Access the samples +class TaskListInstance(ListResource): + def __init__(self, version: Version, assistant_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.preview.understand.assistant.task.sample.SampleList - :rtype: twilio.rest.preview.understand.assistant.task.sample.SampleList - """ - return self._proxy.samples + # Path Solution + self._solution = { 'assistant_sid': assistant_sid, } + self._uri = '/Assistants/${assistant_sid}/Tasks' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def task_actions(self): - """ - Access the task_actions + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsList - :rtype: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsList - """ - return self._proxy.task_actions + return TaskInstance(self._version, payload, assistant_sid=self._solution['assistant_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def statistics(self): - """ - Access the statistics + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsList - :rtype: twilio.rest.preview.understand.assistant.task.task_statistics.TaskStatisticsList - """ - return self._proxy.statistics + return TaskPage(self._version, payload, assistant_sid=self._solution['assistant_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/preview/wireless/__init__.py b/twilio/rest/preview/wireless/__init__.py index 97442a024e..2e8093f513 100644 --- a/twilio/rest/preview/wireless/__init__.py +++ b/twilio/rest/preview/wireless/__init__.py @@ -1,12 +1,19 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / +""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + 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 twilio.base.version import Version +from twilio.base.domain import Domain from twilio.rest.preview.wireless.command import CommandList from twilio.rest.preview.wireless.rate_plan import RatePlanList from twilio.rest.preview.wireless.sim import SimList @@ -14,50 +21,39 @@ class Wireless(Version): - def __init__(self, domain): + def __init__(self, domain: Domain): """ Initialize the Wireless version of Preview - :returns: Wireless version of Preview - :rtype: twilio.rest.preview.wireless.Wireless.Wireless + :param domain: The Twilio.preview domain """ - super(Wireless, self).__init__(domain) + super().__init__(domain) self.version = 'wireless' self._commands = None self._rate_plans = None self._sims = None - + @property - def commands(self): - """ - :rtype: twilio.rest.preview.wireless.command.CommandList - """ + def commands(self) -> CommandList: if self._commands is None: self._commands = CommandList(self) return self._commands @property - def rate_plans(self): - """ - :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanList - """ + def rate_plans(self) -> RatePlanList: if self._rate_plans is None: self._rate_plans = RatePlanList(self) return self._rate_plans @property - def sims(self): - """ - :rtype: twilio.rest.preview.wireless.sim.SimList - """ + def sims(self) -> SimList: if self._sims is None: self._sims = SimList(self) return self._sims - def __repr__(self): + def __repr__(self) -> str: """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ diff --git a/twilio/rest/preview/wireless/sim.py b/twilio/rest/preview/wireless/sim.py deleted file mode 100644 index 3caea003b7..0000000000 --- a/twilio/rest/preview/wireless/sim.py +++ /dev/null @@ -1,167 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Preview - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.sim.usage import UsageListInstance - - -class SimContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Sims/${sid}' - - self._usage = None - - def fetch(self): - - """ - Fetch the SimInstance - - :returns: The fetched SimInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SimInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return SimInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class SimInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'account_sid' : payload.get('account_sid'), - 'rate_plan_sid' : payload.get('rate_plan_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'iccid' : payload.get('iccid'), - 'e_id' : payload.get('e_id'), - 'status' : payload.get('status'), - 'commands_callback_url' : payload.get('commands_callback_url'), - 'commands_callback_method' : payload.get('commands_callback_method'), - 'sms_fallback_method' : payload.get('sms_fallback_method'), - 'sms_fallback_url' : payload.get('sms_fallback_url'), - 'sms_method' : payload.get('sms_method'), - 'sms_url' : payload.get('sms_url'), - 'voice_fallback_method' : payload.get('voice_fallback_method'), - 'voice_fallback_url' : payload.get('voice_fallback_url'), - 'voice_method' : payload.get('voice_method'), - 'voice_url' : payload.get('voice_url'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = SimContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def usage(self): - return self._proxy.usage - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class SimListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Sims' - - - """ - def page(self, status, iccid, rate_plan, eid, sim_registration_code, page_size): - - data = values.of({ - 'status': status,'iccid': iccid,'rate_plan': rate_plan,'eid': eid,'sim_registration_code': sim_registration_code,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return SimPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/preview/wireless/sim/__init__.py b/twilio/rest/preview/wireless/sim/__init__.py index f5281444e5..3caea003b7 100644 --- a/twilio/rest/preview/wireless/sim/__init__.py +++ b/twilio/rest/preview/wireless/sim/__init__.py @@ -1,657 +1,167 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Preview + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.preview.wireless.sim.usage import UsageList - - -class SimList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the SimList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.preview.wireless.sim.SimList - :rtype: twilio.rest.preview.wireless.sim.SimList - """ - super(SimList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Sims'.format(**self._solution) - - def stream(self, status=values.unset, iccid=values.unset, - rate_plan=values.unset, e_id=values.unset, - sim_registration_code=values.unset, limit=None, page_size=None): - """ - Streams SimInstance 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 unicode status: The status - :param unicode iccid: The iccid - :param unicode rate_plan: The rate_plan - :param unicode e_id: The e_id - :param unicode sim_registration_code: The sim_registration_code - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.preview.wireless.sim.SimInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - iccid=iccid, - rate_plan=rate_plan, - e_id=e_id, - sim_registration_code=sim_registration_code, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, status=values.unset, iccid=values.unset, rate_plan=values.unset, - e_id=values.unset, sim_registration_code=values.unset, limit=None, - page_size=None): - """ - Lists SimInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode status: The status - :param unicode iccid: The iccid - :param unicode rate_plan: The rate_plan - :param unicode e_id: The e_id - :param unicode sim_registration_code: The sim_registration_code - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.preview.wireless.sim.SimInstance] - """ - return list(self.stream( - status=status, - iccid=iccid, - rate_plan=rate_plan, - e_id=e_id, - sim_registration_code=sim_registration_code, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, iccid=values.unset, rate_plan=values.unset, - e_id=values.unset, sim_registration_code=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SimInstance records from the API. - Request is executed immediately - - :param unicode status: The status - :param unicode iccid: The iccid - :param unicode rate_plan: The rate_plan - :param unicode e_id: The e_id - :param unicode sim_registration_code: The sim_registration_code - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SimInstance - :rtype: twilio.rest.preview.wireless.sim.SimPage - """ - data = values.of({ - 'Status': status, - 'Iccid': iccid, - 'RatePlan': rate_plan, - 'EId': e_id, - 'SimRegistrationCode': sim_registration_code, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SimPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SimInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SimInstance - :rtype: twilio.rest.preview.wireless.sim.SimPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SimPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SimContext - - :param sid: The sid - - :returns: twilio.rest.preview.wireless.sim.SimContext - :rtype: twilio.rest.preview.wireless.sim.SimContext - """ - return SimContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SimContext - - :param sid: The sid - - :returns: twilio.rest.preview.wireless.sim.SimContext - :rtype: twilio.rest.preview.wireless.sim.SimContext - """ - return SimContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.version import Version - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SimPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the SimPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.preview.wireless.sim.SimPage - :rtype: twilio.rest.preview.wireless.sim.SimPage - """ - super(SimPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SimInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.preview.wireless.sim.SimInstance - :rtype: twilio.rest.preview.wireless.sim.SimInstance - """ - return SimInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.sim.usage import UsageListInstance class SimContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, sid): - """ - Initialize the SimContext - - :param Version version: Version that contains the resource - :param sid: The sid - - :returns: twilio.rest.preview.wireless.sim.SimContext - :rtype: twilio.rest.preview.wireless.sim.SimContext - """ - super(SimContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Sims/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Sims/${sid}' + self._usage = None - + def fetch(self): + """ Fetch the SimInstance :returns: The fetched SimInstance - :rtype: twilio.rest.preview.wireless.sim.SimInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return SimInstance(self._version, payload, sid=self._solution['sid'], ) + - def update(self, unique_name=values.unset, callback_method=values.unset, - callback_url=values.unset, friendly_name=values.unset, - rate_plan=values.unset, status=values.unset, - commands_callback_method=values.unset, - commands_callback_url=values.unset, sms_fallback_method=values.unset, - sms_fallback_url=values.unset, sms_method=values.unset, - sms_url=values.unset, voice_fallback_method=values.unset, - voice_fallback_url=values.unset, voice_method=values.unset, - voice_url=values.unset): - """ - Update the SimInstance - - :param unicode unique_name: The unique_name - :param unicode callback_method: The callback_method - :param unicode callback_url: The callback_url - :param unicode friendly_name: The friendly_name - :param unicode rate_plan: The rate_plan - :param unicode status: The status - :param unicode commands_callback_method: The commands_callback_method - :param unicode commands_callback_url: The commands_callback_url - :param unicode sms_fallback_method: The sms_fallback_method - :param unicode sms_fallback_url: The sms_fallback_url - :param unicode sms_method: The sms_method - :param unicode sms_url: The sms_url - :param unicode voice_fallback_method: The voice_fallback_method - :param unicode voice_fallback_url: The voice_fallback_url - :param unicode voice_method: The voice_method - :param unicode voice_url: The voice_url - - :returns: The updated SimInstance - :rtype: twilio.rest.preview.wireless.sim.SimInstance - """ + + + def update(self, body): data = values.of({ - 'UniqueName': unique_name, - 'CallbackMethod': callback_method, - 'CallbackUrl': callback_url, - 'FriendlyName': friendly_name, - 'RatePlan': rate_plan, - 'Status': status, - 'CommandsCallbackMethod': commands_callback_method, - 'CommandsCallbackUrl': commands_callback_url, - 'SmsFallbackMethod': sms_fallback_method, - 'SmsFallbackUrl': sms_fallback_url, - 'SmsMethod': sms_method, - 'SmsUrl': sms_url, - 'VoiceFallbackMethod': voice_fallback_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceMethod': voice_method, - 'VoiceUrl': voice_url, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return SimInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def usage(self): - """ - Access the usage - - :returns: twilio.rest.preview.wireless.sim.usage.UsageList - :rtype: twilio.rest.preview.wireless.sim.usage.UsageList - """ - if self._usage is None: - self._usage = UsageList(self._version, sim_sid=self._solution['sid'], ) - return self._usage + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class SimInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the SimInstance - - :returns: twilio.rest.preview.wireless.sim.SimInstance - :rtype: twilio.rest.preview.wireless.sim.SimInstance - """ - super(SimInstance, self).__init__(version) - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'account_sid': payload.get('account_sid'), - 'rate_plan_sid': payload.get('rate_plan_sid'), - 'friendly_name': payload.get('friendly_name'), - 'iccid': payload.get('iccid'), - 'e_id': payload.get('e_id'), - 'status': payload.get('status'), - 'commands_callback_url': payload.get('commands_callback_url'), - 'commands_callback_method': payload.get('commands_callback_method'), - 'sms_fallback_method': payload.get('sms_fallback_method'), - 'sms_fallback_url': payload.get('sms_fallback_url'), - 'sms_method': payload.get('sms_method'), - 'sms_url': payload.get('sms_url'), - 'voice_fallback_method': payload.get('voice_fallback_method'), - 'voice_fallback_url': payload.get('voice_fallback_url'), - 'voice_method': payload.get('voice_method'), - 'voice_url': payload.get('voice_url'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class SimInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'account_sid' : payload.get('account_sid'), + 'rate_plan_sid' : payload.get('rate_plan_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'iccid' : payload.get('iccid'), + 'e_id' : payload.get('e_id'), + 'status' : payload.get('status'), + 'commands_callback_url' : payload.get('commands_callback_url'), + 'commands_callback_method' : payload.get('commands_callback_method'), + 'sms_fallback_method' : payload.get('sms_fallback_method'), + 'sms_fallback_url' : payload.get('sms_fallback_url'), + 'sms_method' : payload.get('sms_method'), + 'sms_url' : payload.get('sms_url'), + 'voice_fallback_method' : payload.get('voice_fallback_method'), + 'voice_fallback_url' : payload.get('voice_fallback_url'), + 'voice_method' : payload.get('voice_method'), + 'voice_url' : payload.get('voice_url'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SimContext for this SimInstance - :rtype: twilio.rest.preview.wireless.sim.SimContext - """ if self._context is None: - self._context = SimContext(self._version, sid=self._solution['sid'], ) + self._context = SimContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The sid - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: The unique_name - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The account_sid - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def rate_plan_sid(self): - """ - :returns: The rate_plan_sid - :rtype: unicode - """ - return self._properties['rate_plan_sid'] - - @property - def friendly_name(self): - """ - :returns: The friendly_name - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def iccid(self): - """ - :returns: The iccid - :rtype: unicode - """ - return self._properties['iccid'] - - @property - def e_id(self): - """ - :returns: The e_id - :rtype: unicode - """ - return self._properties['e_id'] - - @property - def status(self): - """ - :returns: The status - :rtype: unicode - """ - return self._properties['status'] - - @property - def commands_callback_url(self): - """ - :returns: The commands_callback_url - :rtype: unicode - """ - return self._properties['commands_callback_url'] - - @property - def commands_callback_method(self): - """ - :returns: The commands_callback_method - :rtype: unicode - """ - return self._properties['commands_callback_method'] - - @property - def sms_fallback_method(self): - """ - :returns: The sms_fallback_method - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: The sms_fallback_url - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: The sms_method - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_url(self): - """ - :returns: The sms_url - :rtype: unicode - """ - return self._properties['sms_url'] - - @property - def voice_fallback_method(self): - """ - :returns: The voice_fallback_method - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: The voice_fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_method(self): - """ - :returns: The voice_method - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_url(self): - """ - :returns: The voice_url - :rtype: unicode - """ - return self._properties['voice_url'] - - @property - def date_created(self): - """ - :returns: The date_created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date_updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] + def usage(self): + return self._proxy.usage + - @property - def links(self): + def __repr__(self): """ - :returns: The links - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['links'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the SimInstance - :returns: The fetched SimInstance - :rtype: twilio.rest.preview.wireless.sim.SimInstance - """ - return self._proxy.fetch() - def update(self, unique_name=values.unset, callback_method=values.unset, - callback_url=values.unset, friendly_name=values.unset, - rate_plan=values.unset, status=values.unset, - commands_callback_method=values.unset, - commands_callback_url=values.unset, sms_fallback_method=values.unset, - sms_fallback_url=values.unset, sms_method=values.unset, - sms_url=values.unset, voice_fallback_method=values.unset, - voice_fallback_url=values.unset, voice_method=values.unset, - voice_url=values.unset): - """ - Update the SimInstance +class SimListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :param unicode unique_name: The unique_name - :param unicode callback_method: The callback_method - :param unicode callback_url: The callback_url - :param unicode friendly_name: The friendly_name - :param unicode rate_plan: The rate_plan - :param unicode status: The status - :param unicode commands_callback_method: The commands_callback_method - :param unicode commands_callback_url: The commands_callback_url - :param unicode sms_fallback_method: The sms_fallback_method - :param unicode sms_fallback_url: The sms_fallback_url - :param unicode sms_method: The sms_method - :param unicode sms_url: The sms_url - :param unicode voice_fallback_method: The voice_fallback_method - :param unicode voice_fallback_url: The voice_fallback_url - :param unicode voice_method: The voice_method - :param unicode voice_url: The voice_url + # Path Solution + self._solution = { } + self._uri = '/Sims' + + + """ + def page(self, status, iccid, rate_plan, eid, sim_registration_code, page_size): + + data = values.of({ + 'status': status,'iccid': iccid,'rate_plan': rate_plan,'eid': eid,'sim_registration_code': sim_registration_code,'page_size': page_size, + }) - :returns: The updated SimInstance - :rtype: twilio.rest.preview.wireless.sim.SimInstance - """ - return self._proxy.update( - unique_name=unique_name, - callback_method=callback_method, - callback_url=callback_url, - friendly_name=friendly_name, - rate_plan=rate_plan, - status=status, - commands_callback_method=commands_callback_method, - commands_callback_url=commands_callback_url, - sms_fallback_method=sms_fallback_method, - sms_fallback_url=sms_fallback_url, - sms_method=sms_method, - sms_url=sms_url, - voice_fallback_method=voice_fallback_method, - voice_fallback_url=voice_fallback_url, - voice_method=voice_method, - voice_url=voice_url, - ) + payload = self._version.create(method='get', uri=self._uri, data=data, ) - @property - def usage(self): - """ - Access the usage - - :returns: twilio.rest.preview.wireless.sim.usage.UsageList - :rtype: twilio.rest.preview.wireless.sim.usage.UsageList - """ - return self._proxy.usage + return SimPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/pricing/v1/messaging.py b/twilio/rest/pricing/v1/messaging.py deleted file mode 100644 index 9ea482569c..0000000000 --- a/twilio/rest/pricing/v1/messaging.py +++ /dev/null @@ -1,48 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Pricing - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.rest.messaging.country import CountryListInstance - - - - -class MessagingListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Messaging' - - self._countries = None - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/pricing/v1/messaging/__init__.py b/twilio/rest/pricing/v1/messaging/__init__.py index f42183ae6f..9ea482569c 100644 --- a/twilio/rest/pricing/v1/messaging/__init__.py +++ b/twilio/rest/pricing/v1/messaging/__init__.py @@ -1,147 +1,48 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.pricing.v1.messaging.country import CountryList - - -class MessagingList(ListResource): - - def __init__(self, version): - """ - Initialize the MessagingList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.pricing.v1.messaging.MessagingList - :rtype: twilio.rest.pricing.v1.messaging.MessagingList - """ - super(MessagingList, self).__init__(version) - - # Path Solution - self._solution = {} - - # Components - self._countries = None - - @property - def countries(self): - """ - Access the countries + Twilio - Pricing + This is the public Twilio REST API. - :returns: twilio.rest.pricing.v1.messaging.country.CountryList - :rtype: twilio.rest.pricing.v1.messaging.country.CountryList - """ - if self._countries is None: - self._countries = CountryList(self._version, ) - return self._countries + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +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.rest.messaging.country import CountryListInstance -class MessagingPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the MessagingPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.pricing.v1.messaging.MessagingPage - :rtype: twilio.rest.pricing.v1.messaging.MessagingPage - """ - super(MessagingPage, self).__init__(version, response) +class MessagingListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of MessagingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.pricing.v1.messaging.MessagingInstance - :rtype: twilio.rest.pricing.v1.messaging.MessagingInstance - """ - return MessagingInstance(self._version, payload, ) + self._solution = { } + self._uri = '/Messaging' + + self._countries = None + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - + return '' -class MessagingInstance(InstanceResource): - - def __init__(self, version, payload): - """ - Initialize the MessagingInstance - - :returns: twilio.rest.pricing.v1.messaging.MessagingInstance - :rtype: twilio.rest.pricing.v1.messaging.MessagingInstance - """ - super(MessagingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'name': payload.get('name'), - 'url': payload.get('url'), - 'links': payload.get('links'), - } - - # Context - self._context = None - self._solution = {} - - @property - def name(self): - """ - :returns: The name - :rtype: unicode - """ - return self._properties['name'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/pricing/v1/phone_number.py b/twilio/rest/pricing/v1/phone_number.py deleted file mode 100644 index ce1292c5e6..0000000000 --- a/twilio/rest/pricing/v1/phone_number.py +++ /dev/null @@ -1,48 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Pricing - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.rest.phone_number.country import CountryListInstance - - - - -class PhoneNumberListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/PhoneNumbers' - - self._countries = None - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/pricing/v1/phone_number/__init__.py b/twilio/rest/pricing/v1/phone_number/__init__.py index 4c3f85fa7a..ce1292c5e6 100644 --- a/twilio/rest/pricing/v1/phone_number/__init__.py +++ b/twilio/rest/pricing/v1/phone_number/__init__.py @@ -1,147 +1,48 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.pricing.v1.phone_number.country import CountryList - - -class PhoneNumberList(ListResource): - - def __init__(self, version): - """ - Initialize the PhoneNumberList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.pricing.v1.phone_number.PhoneNumberList - :rtype: twilio.rest.pricing.v1.phone_number.PhoneNumberList - """ - super(PhoneNumberList, self).__init__(version) - - # Path Solution - self._solution = {} - - # Components - self._countries = None - - @property - def countries(self): - """ - Access the countries + Twilio - Pricing + This is the public Twilio REST API. - :returns: twilio.rest.pricing.v1.phone_number.country.CountryList - :rtype: twilio.rest.pricing.v1.phone_number.country.CountryList - """ - if self._countries is None: - self._countries = CountryList(self._version, ) - return self._countries + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +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.rest.phone_number.country import CountryListInstance -class PhoneNumberPage(Page): - def __init__(self, version, response, solution): - """ - Initialize the PhoneNumberPage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.pricing.v1.phone_number.PhoneNumberPage - :rtype: twilio.rest.pricing.v1.phone_number.PhoneNumberPage - """ - super(PhoneNumberPage, self).__init__(version, response) +class PhoneNumberListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of PhoneNumberInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.pricing.v1.phone_number.PhoneNumberInstance - :rtype: twilio.rest.pricing.v1.phone_number.PhoneNumberInstance - """ - return PhoneNumberInstance(self._version, payload, ) + self._solution = { } + self._uri = '/PhoneNumbers' + + self._countries = None + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - + return '' -class PhoneNumberInstance(InstanceResource): - - def __init__(self, version, payload): - """ - Initialize the PhoneNumberInstance - - :returns: twilio.rest.pricing.v1.phone_number.PhoneNumberInstance - :rtype: twilio.rest.pricing.v1.phone_number.PhoneNumberInstance - """ - super(PhoneNumberInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'name': payload.get('name'), - 'url': payload.get('url'), - 'links': payload.get('links'), - } - - # Context - self._context = None - self._solution = {} - - @property - def name(self): - """ - :returns: The name - :rtype: unicode - """ - return self._properties['name'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/pricing/v1/voice.py b/twilio/rest/pricing/v1/voice.py deleted file mode 100644 index 619fecb50c..0000000000 --- a/twilio/rest/pricing/v1/voice.py +++ /dev/null @@ -1,49 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Pricing - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.rest.voice.country import CountryListInstancefrom twilio.rest.voice.number import NumberListInstance - - - - -class VoiceListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Voice' - - self._countries = None - self._numbers = None - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/pricing/v1/voice/__init__.py b/twilio/rest/pricing/v1/voice/__init__.py index 3ef8be02d2..619fecb50c 100644 --- a/twilio/rest/pricing/v1/voice/__init__.py +++ b/twilio/rest/pricing/v1/voice/__init__.py @@ -1,161 +1,49 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.pricing.v1.voice.country import CountryList -from twilio.rest.pricing.v1.voice.number import NumberList - - -class VoiceList(ListResource): - - def __init__(self, version): - """ - Initialize the VoiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.pricing.v1.voice.VoiceList - :rtype: twilio.rest.pricing.v1.voice.VoiceList - """ - super(VoiceList, self).__init__(version) - - # Path Solution - self._solution = {} - - # Components - self._numbers = None - self._countries = None - - @property - def numbers(self): - """ - Access the numbers + Twilio - Pricing + This is the public Twilio REST API. - :returns: twilio.rest.pricing.v1.voice.number.NumberList - :rtype: twilio.rest.pricing.v1.voice.number.NumberList - """ - if self._numbers is None: - self._numbers = NumberList(self._version, ) - return self._numbers - - @property - def countries(self): - """ - Access the countries - - :returns: twilio.rest.pricing.v1.voice.country.CountryList - :rtype: twilio.rest.pricing.v1.voice.country.CountryList - """ - if self._countries is None: - self._countries = CountryList(self._version, ) - return self._countries + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +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.rest.voice.country import CountryListInstancefrom twilio.rest.voice.number import NumberListInstance -class VoicePage(Page): - def __init__(self, version, response, solution): - """ - Initialize the VoicePage - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.pricing.v1.voice.VoicePage - :rtype: twilio.rest.pricing.v1.voice.VoicePage - """ - super(VoicePage, self).__init__(version, response) +class VoiceListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of VoiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.pricing.v1.voice.VoiceInstance - :rtype: twilio.rest.pricing.v1.voice.VoiceInstance - """ - return VoiceInstance(self._version, payload, ) + self._solution = { } + self._uri = '/Voice' + + self._countries = None + self._numbers = None + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class VoiceInstance(InstanceResource): - - def __init__(self, version, payload): - """ - Initialize the VoiceInstance - - :returns: twilio.rest.pricing.v1.voice.VoiceInstance - :rtype: twilio.rest.pricing.v1.voice.VoiceInstance - """ - super(VoiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'name': payload.get('name'), - 'url': payload.get('url'), - 'links': payload.get('links'), - } - - # Context - self._context = None - self._solution = {} - - @property - def name(self): - """ - :returns: The name - :rtype: unicode - """ - return self._properties['name'] - - @property - def url(self): - """ - :returns: The url - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - - def __repr__(self): - """ - Provide a friendly representation + return '' - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/pricing/v2/voice.py b/twilio/rest/pricing/v2/voice.py deleted file mode 100644 index 4d1223f67c..0000000000 --- a/twilio/rest/pricing/v2/voice.py +++ /dev/null @@ -1,49 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Pricing - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.rest.voice.country import CountryListInstancefrom twilio.rest.voice.number import NumberListInstance - - - - -class VoiceListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Voice' - - self._countries = None - self._numbers = None - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/pricing/v2/voice/__init__.py b/twilio/rest/pricing/v2/voice/__init__.py index e2422525a4..4d1223f67c 100644 --- a/twilio/rest/pricing/v2/voice/__init__.py +++ b/twilio/rest/pricing/v2/voice/__init__.py @@ -1,161 +1,49 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Pricing + 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 twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.pricing.v2.voice.country import CountryList -from twilio.rest.pricing.v2.voice.number import NumberList +from twilio.base.version import Version +# from twilio.rest.voice.country import CountryListInstancefrom twilio.rest.voice.number import NumberListInstance -class VoiceList(ListResource): - def __init__(self, version): - """ - Initialize the VoiceList - :param Version version: Version that contains the resource - :returns: twilio.rest.pricing.v2.voice.VoiceList - :rtype: twilio.rest.pricing.v2.voice.VoiceList - """ - super(VoiceList, self).__init__(version) +class VoiceListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {} - - # Components + self._solution = { } + self._uri = '/Voice' + self._countries = None self._numbers = None - - @property - def countries(self): - """ - Access the countries - - :returns: twilio.rest.pricing.v2.voice.country.CountryList - :rtype: twilio.rest.pricing.v2.voice.country.CountryList - """ - if self._countries is None: - self._countries = CountryList(self._version, ) - return self._countries - - @property - def numbers(self): - """ - Access the numbers - - :returns: twilio.rest.pricing.v2.voice.number.NumberList - :rtype: twilio.rest.pricing.v2.voice.number.NumberList - """ - if self._numbers is None: - self._numbers = NumberList(self._version, ) - return self._numbers - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class VoicePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the VoicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.pricing.v2.voice.VoicePage - :rtype: twilio.rest.pricing.v2.voice.VoicePage - """ - super(VoicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of VoiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.pricing.v2.voice.VoiceInstance - :rtype: twilio.rest.pricing.v2.voice.VoiceInstance - """ - return VoiceInstance(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' - - -class VoiceInstance(InstanceResource): - - def __init__(self, version, payload): - """ - Initialize the VoiceInstance - - :returns: twilio.rest.pricing.v2.voice.VoiceInstance - :rtype: twilio.rest.pricing.v2.voice.VoiceInstance - """ - super(VoiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'name': payload.get('name'), - 'url': payload.get('url'), - 'links': payload.get('links'), - } + return '' - # Context - self._context = None - self._solution = {} - - @property - def name(self): - """ - :returns: The resource name - :rtype: unicode - """ - return self._properties['name'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The URLs of the related Countries and Numbers resources - :rtype: unicode - """ - return self._properties['links'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/proxy/v1/service.py b/twilio/rest/proxy/v1/service.py deleted file mode 100644 index f187500468..0000000000 --- a/twilio/rest/proxy/v1/service.py +++ /dev/null @@ -1,191 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Proxy - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.service.phone_number import PhoneNumberListInstancefrom twilio.rest.service.session import SessionListInstancefrom twilio.rest.service.short_code import ShortCodeListInstance - - -class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Services/${sid}' - - self._phone_numbers = None - self._sessions = None - self._short_codes = None - - def delete(self): - - - - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'account_sid' : payload.get('account_sid'), - 'chat_instance_sid' : payload.get('chat_instance_sid'), - 'callback_url' : payload.get('callback_url'), - 'default_ttl' : payload.get('default_ttl'), - 'number_selection_behavior' : payload.get('number_selection_behavior'), - 'geo_match_level' : payload.get('geo_match_level'), - 'intercept_callback_url' : payload.get('intercept_callback_url'), - 'out_of_session_callback_url' : payload.get('out_of_session_callback_url'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ServiceContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def phone_numbers(self): - return self._proxy.phone_numbers - @property - def sessions(self): - return self._proxy.sessions - @property - def short_codes(self): - return self._proxy.short_codes - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ServiceListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Services' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ServicePage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/proxy/v1/service/__init__.py b/twilio/rest/proxy/v1/service/__init__.py index d47d4950a3..f187500468 100644 --- a/twilio/rest/proxy/v1/service/__init__.py +++ b/twilio/rest/proxy/v1/service/__init__.py @@ -1,610 +1,191 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Proxy + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.proxy.v1.service.phone_number import PhoneNumberList -from twilio.rest.proxy.v1.service.session import SessionList -from twilio.rest.proxy.v1.service.short_code import ShortCodeList - - -class ServiceList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.proxy.v1.service.ServiceList - :rtype: twilio.rest.proxy.v1.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.proxy.v1.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.proxy.v1.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServicePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def create(self, unique_name, default_ttl=values.unset, - callback_url=values.unset, geo_match_level=values.unset, - number_selection_behavior=values.unset, - intercept_callback_url=values.unset, - out_of_session_callback_url=values.unset, - chat_instance_sid=values.unset): - """ - Create the ServiceInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode default_ttl: Default TTL for a Session, in seconds - :param unicode callback_url: The URL we should call when the interaction status changes - :param ServiceInstance.GeoMatchLevel geo_match_level: Where a proxy number must be located relative to the participant identifier - :param ServiceInstance.NumberSelectionBehavior number_selection_behavior: The preference for Proxy Number selection for the Service instance - :param unicode intercept_callback_url: The URL we call on each interaction - :param unicode out_of_session_callback_url: The URL we call when an inbound call or SMS action occurs on a closed or non-existent Session - :param unicode chat_instance_sid: The SID of the Chat Service Instance - - :returns: The created ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServiceInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'DefaultTtl': default_ttl, - 'CallbackUrl': callback_url, - 'GeoMatchLevel': geo_match_level, - 'NumberSelectionBehavior': number_selection_behavior, - 'InterceptCallbackUrl': intercept_callback_url, - 'OutOfSessionCallbackUrl': out_of_session_callback_url, - 'ChatInstanceSid': chat_instance_sid, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.ServiceContext - :rtype: twilio.rest.proxy.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.ServiceContext - :rtype: twilio.rest.proxy.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - +from twilio.base.version import Version -class ServicePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.proxy.v1.service.ServicePage - :rtype: twilio.rest.proxy.v1.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.proxy.v1.service.ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.service.phone_number import PhoneNumberListInstancefrom twilio.rest.service.session import SessionListInstancefrom twilio.rest.service.short_code import ShortCodeListInstance class ServiceContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.ServiceContext - :rtype: twilio.rest.proxy.v1.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents - self._sessions = None + self._solution = { 'sid': sid, } + self._uri = '/Services/${sid}' + self._phone_numbers = None + self._sessions = None self._short_codes = None + + def delete(self): + + + """ + Deletes the ServiceInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the ServiceInstance :returns: The fetched ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServiceInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, unique_name=values.unset, default_ttl=values.unset, - callback_url=values.unset, geo_match_level=values.unset, - number_selection_behavior=values.unset, - intercept_callback_url=values.unset, - out_of_session_callback_url=values.unset, - chat_instance_sid=values.unset): - """ - Update the ServiceInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode default_ttl: Default TTL for a Session, in seconds - :param unicode callback_url: The URL we should call when the interaction status changes - :param ServiceInstance.GeoMatchLevel geo_match_level: Where a proxy number must be located relative to the participant identifier - :param ServiceInstance.NumberSelectionBehavior number_selection_behavior: The preference for Proxy Number selection for the Service instance - :param unicode intercept_callback_url: The URL we call on each interaction - :param unicode out_of_session_callback_url: The URL we call when an inbound call or SMS action occurs on a closed or non-existent Session - :param unicode chat_instance_sid: The SID of the Chat Service Instance - - :returns: The updated ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServiceInstance - """ + + + def update(self, body): data = values.of({ - 'UniqueName': unique_name, - 'DefaultTtl': default_ttl, - 'CallbackUrl': callback_url, - 'GeoMatchLevel': geo_match_level, - 'NumberSelectionBehavior': number_selection_behavior, - 'InterceptCallbackUrl': intercept_callback_url, - 'OutOfSessionCallbackUrl': out_of_session_callback_url, - 'ChatInstanceSid': chat_instance_sid, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def sessions(self): - """ - Access the sessions - - :returns: twilio.rest.proxy.v1.service.session.SessionList - :rtype: twilio.rest.proxy.v1.service.session.SessionList - """ - if self._sessions is None: - self._sessions = SessionList(self._version, service_sid=self._solution['sid'], ) - return self._sessions - - @property - def phone_numbers(self): - """ - Access the phone_numbers - - :returns: twilio.rest.proxy.v1.service.phone_number.PhoneNumberList - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberList - """ - if self._phone_numbers is None: - self._phone_numbers = PhoneNumberList(self._version, service_sid=self._solution['sid'], ) - return self._phone_numbers - - @property - def short_codes(self): - """ - Access the short_codes - - :returns: twilio.rest.proxy.v1.service.short_code.ShortCodeList - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeList - """ - if self._short_codes is None: - self._short_codes = ShortCodeList(self._version, service_sid=self._solution['sid'], ) - return self._short_codes + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ServiceInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class GeoMatchLevel(object): - AREA_CODE = "area-code" - OVERLAY = "overlay" - RADIUS = "radius" - COUNTRY = "country" - class NumberSelectionBehavior(object): - AVOID_STICKY = "avoid-sticky" - PREFER_STICKY = "prefer-sticky" - - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - - :returns: twilio.rest.proxy.v1.service.ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'account_sid': payload.get('account_sid'), - 'chat_instance_sid': payload.get('chat_instance_sid'), - 'callback_url': payload.get('callback_url'), - 'default_ttl': deserialize.integer(payload.get('default_ttl')), - 'number_selection_behavior': payload.get('number_selection_behavior'), - 'geo_match_level': payload.get('geo_match_level'), - 'intercept_callback_url': payload.get('intercept_callback_url'), - 'out_of_session_callback_url': payload.get('out_of_session_callback_url'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'account_sid' : payload.get('account_sid'), + 'chat_instance_sid' : payload.get('chat_instance_sid'), + 'callback_url' : payload.get('callback_url'), + 'default_ttl' : payload.get('default_ttl'), + 'number_selection_behavior' : payload.get('number_selection_behavior'), + 'geo_match_level' : payload.get('geo_match_level'), + 'intercept_callback_url' : payload.get('intercept_callback_url'), + 'out_of_session_callback_url' : payload.get('out_of_session_callback_url'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServiceContext - """ if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def chat_instance_sid(self): - """ - :returns: The SID of the Chat Service Instance - :rtype: unicode - """ - return self._properties['chat_instance_sid'] - - @property - def callback_url(self): - """ - :returns: The URL we call when the interaction status changes - :rtype: unicode - """ - return self._properties['callback_url'] - - @property - def default_ttl(self): - """ - :returns: Default TTL for a Session, in seconds - :rtype: unicode - """ - return self._properties['default_ttl'] - - @property - def number_selection_behavior(self): - """ - :returns: The preference for Proxy Number selection for the Service instance - :rtype: ServiceInstance.NumberSelectionBehavior - """ - return self._properties['number_selection_behavior'] - - @property - def geo_match_level(self): - """ - :returns: Where a proxy number must be located relative to the participant identifier - :rtype: ServiceInstance.GeoMatchLevel - """ - return self._properties['geo_match_level'] - - @property - def intercept_callback_url(self): - """ - :returns: The URL we call on each interaction - :rtype: unicode - """ - return self._properties['intercept_callback_url'] - - @property - def out_of_session_callback_url(self): - """ - :returns: The URL we call when an inbound call or SMS action occurs on a closed or non-existent Session - :rtype: unicode - """ - return self._properties['out_of_session_callback_url'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - + def phone_numbers(self): + return self._proxy.phone_numbers @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - + def sessions(self): + return self._proxy.sessions @property - def url(self): - """ - :returns: The absolute URL of the Service resource - :rtype: unicode - """ - return self._properties['url'] + def short_codes(self): + return self._proxy.short_codes + - @property - def links(self): + def __repr__(self): """ - :returns: The URLs of resources related to the Service - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['links'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the ServiceInstance - :returns: The fetched ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServiceInstance - """ - return self._proxy.fetch() - def delete(self): - """ - Deletes the ServiceInstance +class ServiceListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, unique_name=values.unset, default_ttl=values.unset, - callback_url=values.unset, geo_match_level=values.unset, - number_selection_behavior=values.unset, - intercept_callback_url=values.unset, - out_of_session_callback_url=values.unset, - chat_instance_sid=values.unset): - """ - Update the ServiceInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode default_ttl: Default TTL for a Session, in seconds - :param unicode callback_url: The URL we should call when the interaction status changes - :param ServiceInstance.GeoMatchLevel geo_match_level: Where a proxy number must be located relative to the participant identifier - :param ServiceInstance.NumberSelectionBehavior number_selection_behavior: The preference for Proxy Number selection for the Service instance - :param unicode intercept_callback_url: The URL we call on each interaction - :param unicode out_of_session_callback_url: The URL we call when an inbound call or SMS action occurs on a closed or non-existent Session - :param unicode chat_instance_sid: The SID of the Chat Service Instance - - :returns: The updated ServiceInstance - :rtype: twilio.rest.proxy.v1.service.ServiceInstance - """ - return self._proxy.update( - unique_name=unique_name, - default_ttl=default_ttl, - callback_url=callback_url, - geo_match_level=geo_match_level, - number_selection_behavior=number_selection_behavior, - intercept_callback_url=intercept_callback_url, - out_of_session_callback_url=out_of_session_callback_url, - chat_instance_sid=chat_instance_sid, - ) - - @property - def sessions(self): - """ - Access the sessions + # Path Solution + self._solution = { } + self._uri = '/Services' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - :returns: twilio.rest.proxy.v1.service.session.SessionList - :rtype: twilio.rest.proxy.v1.service.session.SessionList - """ - return self._proxy.sessions + payload = self._version.create(method='post', uri=self._uri, data=data, ) - @property - def phone_numbers(self): - """ - Access the phone_numbers - - :returns: twilio.rest.proxy.v1.service.phone_number.PhoneNumberList - :rtype: twilio.rest.proxy.v1.service.phone_number.PhoneNumberList - """ - return self._proxy.phone_numbers + return ServiceInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def short_codes(self): - """ - Access the short_codes + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.proxy.v1.service.short_code.ShortCodeList - :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeList - """ - return self._proxy.short_codes + return ServicePage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/proxy/v1/service/session.py b/twilio/rest/proxy/v1/service/session.py deleted file mode 100644 index c36f410c03..0000000000 --- a/twilio/rest/proxy/v1/service/session.py +++ /dev/null @@ -1,189 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Proxy - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.session.interaction import InteractionListInstancefrom twilio.rest.session.participant import ParticipantListInstance - - -class SessionContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Sessions/${sid}' - - self._interactions = None - self._participants = None - - def delete(self): - - - - """ - Deletes the SessionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the SessionInstance - - :returns: The fetched SessionInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SessionInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return SessionInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class SessionInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'service_sid' : payload.get('service_sid'), - 'account_sid' : payload.get('account_sid'), - 'date_started' : payload.get('date_started'), - 'date_ended' : payload.get('date_ended'), - 'date_last_interaction' : payload.get('date_last_interaction'), - 'date_expiry' : payload.get('date_expiry'), - 'unique_name' : payload.get('unique_name'), - 'status' : payload.get('status'), - 'closed_reason' : payload.get('closed_reason'), - 'ttl' : payload.get('ttl'), - 'mode' : payload.get('mode'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = SessionContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def interactions(self): - return self._proxy.interactions - @property - def participants(self): - return self._proxy.participants - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class SessionListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Sessions' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return SessionInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return SessionPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/proxy/v1/service/session/__init__.py b/twilio/rest/proxy/v1/service/session/__init__.py index 8bb987999a..c36f410c03 100644 --- a/twilio/rest/proxy/v1/service/session/__init__.py +++ b/twilio/rest/proxy/v1/service/session/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Proxy + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,252 +19,29 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.proxy.v1.service.session.interaction import InteractionList -from twilio.rest.proxy.v1.service.session.participant import ParticipantList - - -class SessionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the SessionList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the resource's parent Service - - :returns: twilio.rest.proxy.v1.service.session.SessionList - :rtype: twilio.rest.proxy.v1.service.session.SessionList - """ - super(SessionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Sessions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams SessionInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.proxy.v1.service.session.SessionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SessionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.proxy.v1.service.session.SessionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SessionInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SessionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SessionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SessionPage(self._version, response, self._solution) - - def create(self, unique_name=values.unset, date_expiry=values.unset, - ttl=values.unset, mode=values.unset, status=values.unset, - participants=values.unset): - """ - Create the SessionInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param datetime date_expiry: The ISO 8601 date when the Session should expire - :param unicode ttl: When the session will expire - :param SessionInstance.Mode mode: The Mode of the Session - :param SessionInstance.Status status: Session status - :param list[dict] participants: The Participant objects to include in the new session - - :returns: The created SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'DateExpiry': serialize.iso8601_datetime(date_expiry), - 'Ttl': ttl, - 'Mode': mode, - 'Status': status, - 'Participants': serialize.map(participants, lambda e: serialize.object(e)), - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return SessionInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def get(self, sid): - """ - Constructs a SessionContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.session.SessionContext - :rtype: twilio.rest.proxy.v1.service.session.SessionContext - """ - return SessionContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SessionContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.session.SessionContext - :rtype: twilio.rest.proxy.v1.service.session.SessionContext - """ - return SessionContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.version import Version - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SessionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the SessionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the resource's parent Service - - :returns: twilio.rest.proxy.v1.service.session.SessionPage - :rtype: twilio.rest.proxy.v1.service.session.SessionPage - """ - super(SessionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SessionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.proxy.v1.service.session.SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionInstance - """ - return SessionInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.session.interaction import InteractionListInstancefrom twilio.rest.session.participant import ParticipantListInstance class SessionContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the SessionContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the resource from - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.session.SessionContext - :rtype: twilio.rest.proxy.v1.service.session.SessionContext - """ - super(SessionContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Sessions/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Sessions/${sid}' + self._interactions = None self._participants = None - - def fetch(self): - """ - Fetch the SessionInstance - - :returns: The fetched SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SessionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the SessionInstance @@ -265,329 +49,141 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the SessionInstance - def update(self, date_expiry=values.unset, ttl=values.unset, - status=values.unset): + :returns: The fetched SessionInstance + #TODO: add rtype docs """ - Update the SessionInstance + payload = self._version.fetch(method='GET', uri=self._uri, ) - :param datetime date_expiry: The ISO 8601 date when the Session should expire - :param unicode ttl: When the session will expire - :param SessionInstance.Status status: The new status of the resource + return SessionInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - :returns: The updated SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionInstance - """ + + + def update(self, body): data = values.of({ - 'DateExpiry': serialize.iso8601_datetime(date_expiry), - 'Ttl': ttl, - 'Status': status, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return SessionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - - @property - def interactions(self): - """ - Access the interactions - - :returns: twilio.rest.proxy.v1.service.session.interaction.InteractionList - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionList - """ - if self._interactions is None: - self._interactions = InteractionList( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['sid'], - ) - return self._interactions + payload = self._version.update(method='post', uri=self._uri, data=data, ) - @property - def participants(self): - """ - Access the participants + return SessionInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + - :returns: twilio.rest.proxy.v1.service.session.participant.ParticipantList - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantList - """ - if self._participants is None: - self._participants = ParticipantList( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['sid'], - ) - return self._participants + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class SessionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Status(object): - OPEN = "open" - IN_PROGRESS = "in-progress" - CLOSED = "closed" - FAILED = "failed" - UNKNOWN = "unknown" - - class Mode(object): - MESSAGE_ONLY = "message-only" - VOICE_ONLY = "voice-only" - VOICE_AND_MESSAGE = "voice-and-message" - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the SessionInstance - :returns: twilio.rest.proxy.v1.service.session.SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionInstance - """ - super(SessionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'service_sid': payload.get('service_sid'), - 'account_sid': payload.get('account_sid'), - 'date_started': deserialize.iso8601_datetime(payload.get('date_started')), - 'date_ended': deserialize.iso8601_datetime(payload.get('date_ended')), - 'date_last_interaction': deserialize.iso8601_datetime(payload.get('date_last_interaction')), - 'date_expiry': deserialize.iso8601_datetime(payload.get('date_expiry')), - 'unique_name': payload.get('unique_name'), - 'status': payload.get('status'), - 'closed_reason': payload.get('closed_reason'), - 'ttl': deserialize.integer(payload.get('ttl')), - 'mode': payload.get('mode'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class SessionInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'service_sid' : payload.get('service_sid'), + 'account_sid' : payload.get('account_sid'), + 'date_started' : payload.get('date_started'), + 'date_ended' : payload.get('date_ended'), + 'date_last_interaction' : payload.get('date_last_interaction'), + 'date_expiry' : payload.get('date_expiry'), + 'unique_name' : payload.get('unique_name'), + 'status' : payload.get('status'), + 'closed_reason' : payload.get('closed_reason'), + 'ttl' : payload.get('ttl'), + 'mode' : payload.get('mode'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SessionContext for this SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionContext - """ if self._context is None: self._context = SessionContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the resource's parent Service - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_started(self): - """ - :returns: The ISO 8601 date when the Session started - :rtype: datetime - """ - return self._properties['date_started'] - - @property - def date_ended(self): - """ - :returns: The ISO 8601 date when the Session ended - :rtype: datetime - """ - return self._properties['date_ended'] - - @property - def date_last_interaction(self): - """ - :returns: The ISO 8601 date when the Session last had an interaction - :rtype: datetime - """ - return self._properties['date_last_interaction'] - - @property - def date_expiry(self): - """ - :returns: The ISO 8601 date when the Session should expire - :rtype: datetime - """ - return self._properties['date_expiry'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def status(self): - """ - :returns: The status of the Session - :rtype: SessionInstance.Status - """ - return self._properties['status'] - - @property - def closed_reason(self): - """ - :returns: The reason the Session ended - :rtype: unicode - """ - return self._properties['closed_reason'] - - @property - def ttl(self): - """ - :returns: When the session will expire - :rtype: unicode - """ - return self._properties['ttl'] - - @property - def mode(self): - """ - :returns: The Mode of the Session - :rtype: SessionInstance.Mode - """ - return self._properties['mode'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the Session resource - :rtype: unicode - """ - return self._properties['url'] - + def interactions(self): + return self._proxy.interactions @property - def links(self): - """ - :returns: The URLs of resources related to the Session - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the SessionInstance + def participants(self): + return self._proxy.participants + - :returns: The fetched SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionInstance + def __repr__(self): """ - return self._proxy.fetch() - - def delete(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the SessionInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def update(self, date_expiry=values.unset, ttl=values.unset, - status=values.unset): - """ - Update the SessionInstance - :param datetime date_expiry: The ISO 8601 date when the Session should expire - :param unicode ttl: When the session will expire - :param SessionInstance.Status status: The new status of the resource +class SessionListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The updated SessionInstance - :rtype: twilio.rest.proxy.v1.service.session.SessionInstance - """ - return self._proxy.update(date_expiry=date_expiry, ttl=ttl, status=status, ) + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Sessions' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def interactions(self): - """ - Access the interactions + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.proxy.v1.service.session.interaction.InteractionList - :rtype: twilio.rest.proxy.v1.service.session.interaction.InteractionList - """ - return self._proxy.interactions + return SessionInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def participants(self): - """ - Access the participants + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.proxy.v1.service.session.participant.ParticipantList - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantList - """ - return self._proxy.participants + return SessionPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/proxy/v1/service/session/participant.py b/twilio/rest/proxy/v1/service/session/participant.py deleted file mode 100644 index 644d72113e..0000000000 --- a/twilio/rest/proxy/v1/service/session/participant.py +++ /dev/null @@ -1,169 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Proxy - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.participant.message_interaction import MessageInteractionListInstance - - -class ParticipantContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, session_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'session_sid': session_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Sessions/${session_sid}/Participants/${sid}' - - self._message_interactions = None - - def delete(self): - - - - """ - Deletes the ParticipantInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ParticipantInstance - - :returns: The fetched ParticipantInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ParticipantInstance(self._version, payload, service_sid=self._solution['service_sid'], session_sid=self._solution['session_sid'], sid=self._solution['sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ParticipantInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, session_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'session_sid' : payload.get('session_sid'), - 'service_sid' : payload.get('service_sid'), - 'account_sid' : payload.get('account_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'identifier' : payload.get('identifier'), - 'proxy_identifier' : payload.get('proxy_identifier'), - 'proxy_identifier_sid' : payload.get('proxy_identifier_sid'), - 'date_deleted' : payload.get('date_deleted'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'session_sid': session_sid or self._properties['session_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ParticipantContext( - self._version, - service_sid=self._solution['service_sid'],session_sid=self._solution['session_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def message_interactions(self): - return self._proxy.message_interactions - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ParticipantListInstance(ListResource): - def __init__(self, version: Version, service_sid: str, session_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'session_sid': session_sid, } - self._uri = '/Services/${service_sid}/Sessions/${session_sid}/Participants' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ParticipantInstance(self._version, payload, service_sid=self._solution['service_sid']session_sid=self._solution['session_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ParticipantPage(self._version, payload, service_sid=self._solution['service_sid'], session_sid=self._solution['session_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/proxy/v1/service/session/participant/__init__.py b/twilio/rest/proxy/v1/service/session/participant/__init__.py index 6070eae4b9..644d72113e 100644 --- a/twilio/rest/proxy/v1/service/session/participant/__init__.py +++ b/twilio/rest/proxy/v1/service/session/participant/__init__.py @@ -1,279 +1,46 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Proxy + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.proxy.v1.service.session.participant.message_interaction import MessageInteractionList - - -class ParticipantList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, session_sid): - """ - Initialize the ParticipantList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the resource's parent Service - :param session_sid: The SID of the resource's parent Session - - :returns: twilio.rest.proxy.v1.service.session.participant.ParticipantList - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantList - """ - super(ParticipantList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'session_sid': session_sid, } - self._uri = '/Services/{service_sid}/Sessions/{session_sid}/Participants'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams ParticipantInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.proxy.v1.service.session.participant.ParticipantInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ParticipantInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.proxy.v1.service.session.participant.ParticipantInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ParticipantInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ParticipantInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ParticipantPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ParticipantInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ParticipantInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ParticipantPage(self._version, response, self._solution) - - def create(self, identifier, friendly_name=values.unset, - proxy_identifier=values.unset, proxy_identifier_sid=values.unset): - """ - Create the ParticipantInstance - - :param unicode identifier: The phone number of the Participant - :param unicode friendly_name: The string that you assigned to describe the participant - :param unicode proxy_identifier: The proxy phone number to use for the Participant - :param unicode proxy_identifier_sid: The Proxy Identifier Sid - - :returns: The created ParticipantInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantInstance - """ - data = values.of({ - 'Identifier': identifier, - 'FriendlyName': friendly_name, - 'ProxyIdentifier': proxy_identifier, - 'ProxyIdentifierSid': proxy_identifier_sid, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ParticipantInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - ) - - def get(self, sid): - """ - Constructs a ParticipantContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.session.participant.ParticipantContext - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantContext - """ - return ParticipantContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a ParticipantContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.session.participant.ParticipantContext - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantContext - """ - return ParticipantContext( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - +from twilio.base.version import Version -class ParticipantPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the ParticipantPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the resource's parent Service - :param session_sid: The SID of the resource's parent Session - - :returns: twilio.rest.proxy.v1.service.session.participant.ParticipantPage - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantPage - """ - super(ParticipantPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ParticipantInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.proxy.v1.service.session.participant.ParticipantInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantInstance - """ - return ParticipantInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.participant.message_interaction import MessageInteractionListInstance class ParticipantContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, session_sid, sid): - """ - Initialize the ParticipantContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the parent Service of the resource to fetch - :param session_sid: The SID of the parent Session of the resource to fetch - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.proxy.v1.service.session.participant.ParticipantContext - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantContext - """ - super(ParticipantContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, session_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'session_sid': session_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Sessions/{session_sid}/Participants/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'session_sid': session_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Sessions/${session_sid}/Participants/${sid}' + self._message_interactions = None - - def fetch(self): - """ - Fetch the ParticipantInstance - - :returns: The fetched ParticipantInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ParticipantInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the ParticipantInstance @@ -281,229 +48,122 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def message_interactions(self): + + def fetch(self): + """ - Access the message_interactions + Fetch the ParticipantInstance - :returns: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionList - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionList + :returns: The fetched ParticipantInstance + #TODO: add rtype docs """ - if self._message_interactions is None: - self._message_interactions = MessageInteractionList( - self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - participant_sid=self._solution['sid'], - ) - return self._message_interactions + payload = self._version.fetch(method='GET', uri=self._uri, ) + + return ParticipantInstance(self._version, payload, service_sid=self._solution['service_sid'], session_sid=self._solution['session_sid'], sid=self._solution['sid'], ) + + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class ParticipantInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, payload, service_sid, session_sid, sid=None): - """ - Initialize the ParticipantInstance - :returns: twilio.rest.proxy.v1.service.session.participant.ParticipantInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantInstance - """ - super(ParticipantInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'session_sid': payload.get('session_sid'), - 'service_sid': payload.get('service_sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'identifier': payload.get('identifier'), - 'proxy_identifier': payload.get('proxy_identifier'), - 'proxy_identifier_sid': payload.get('proxy_identifier_sid'), - 'date_deleted': deserialize.iso8601_datetime(payload.get('date_deleted')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ParticipantInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, session_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'session_sid' : payload.get('session_sid'), + 'service_sid' : payload.get('service_sid'), + 'account_sid' : payload.get('account_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'identifier' : payload.get('identifier'), + 'proxy_identifier' : payload.get('proxy_identifier'), + 'proxy_identifier_sid' : payload.get('proxy_identifier_sid'), + 'date_deleted' : payload.get('date_deleted'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'session_sid': session_sid, - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid'],'session_sid': session_sid or self._properties['session_sid'],'sid': sid or self._properties['sid'], } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ParticipantContext for this ParticipantInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantContext - """ if self._context is None: self._context = ParticipantContext( self._version, - service_sid=self._solution['service_sid'], - session_sid=self._solution['session_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],session_sid=self._solution['session_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def session_sid(self): - """ - :returns: The SID of the resource's parent Session - :rtype: unicode - """ - return self._properties['session_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the resource's parent Service - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the participant - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def identifier(self): - """ - :returns: The phone number or channel identifier of the Participant - :rtype: unicode - """ - return self._properties['identifier'] - - @property - def proxy_identifier(self): - """ - :returns: The phone number or short code of the participant's partner - :rtype: unicode - """ - return self._properties['proxy_identifier'] - - @property - def proxy_identifier_sid(self): - """ - :returns: The SID of the Proxy Identifier assigned to the Participant - :rtype: unicode - """ - return self._properties['proxy_identifier_sid'] - - @property - def date_deleted(self): - """ - :returns: The ISO 8601 date the Participant was removed - :rtype: datetime - """ - return self._properties['date_deleted'] + def message_interactions(self): + return self._proxy.message_interactions + - @property - def date_created(self): + def __repr__(self): """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['date_created'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - @property - def url(self): - """ - :returns: The absolute URL of the Participant resource - :rtype: unicode - """ - return self._properties['url'] - @property - def links(self): - """ - :returns: The URLs to resources related the participant - :rtype: unicode - """ - return self._properties['links'] +class ParticipantListInstance(ListResource): + def __init__(self, version: Version, service_sid: str, session_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - def fetch(self): - """ - Fetch the ParticipantInstance - - :returns: The fetched ParticipantInstance - :rtype: twilio.rest.proxy.v1.service.session.participant.ParticipantInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { 'service_sid': service_sid, 'session_sid': session_sid, } + self._uri = '/Services/${service_sid}/Sessions/${session_sid}/Participants' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - def delete(self): - """ - Deletes the ParticipantInstance + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + return ParticipantInstance(self._version, payload, service_sid=self._solution['service_sid']session_sid=self._solution['session_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def message_interactions(self): - """ - Access the message_interactions + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionList - :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionList - """ - return self._proxy.message_interactions + return ParticipantPage(self._version, payload, service_sid=self._solution['service_sid'], session_sid=self._solution['session_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/serverless/v1/service.py b/twilio/rest/serverless/v1/service.py deleted file mode 100644 index b4c99080dc..0000000000 --- a/twilio/rest/serverless/v1/service.py +++ /dev/null @@ -1,192 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Serverless - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.service.asset import AssetListInstancefrom twilio.rest.service.build import BuildListInstancefrom twilio.rest.service.environment import EnvironmentListInstancefrom twilio.rest.service.function import FunctionListInstance - - -class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Services/${sid}' - - self._assets = None - self._builds = None - self._environments = None - self._functions = None - - def delete(self): - - - - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'unique_name' : payload.get('unique_name'), - 'include_credentials' : payload.get('include_credentials'), - 'ui_editable' : payload.get('ui_editable'), - 'domain_base' : payload.get('domain_base'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ServiceContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def assets(self): - return self._proxy.assets - @property - def builds(self): - return self._proxy.builds - @property - def environments(self): - return self._proxy.environments - @property - def functions(self): - return self._proxy.functions - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ServiceListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Services' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ServicePage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/serverless/v1/service/__init__.py b/twilio/rest/serverless/v1/service/__init__.py index 93dac633c6..b4c99080dc 100644 --- a/twilio/rest/serverless/v1/service/__init__.py +++ b/twilio/rest/serverless/v1/service/__init__.py @@ -1,253 +1,49 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Serverless + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.serverless.v1.service.asset import AssetList -from twilio.rest.serverless.v1.service.build import BuildList -from twilio.rest.serverless.v1.service.environment import EnvironmentList -from twilio.rest.serverless.v1.service.function import FunctionList - - -class ServiceList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.serverless.v1.service.ServiceList - :rtype: twilio.rest.serverless.v1.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.serverless.v1.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.serverless.v1.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.serverless.v1.service.ServicePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.serverless.v1.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def create(self, unique_name, friendly_name, include_credentials=values.unset, - ui_editable=values.unset): - """ - Create the ServiceInstance - - :param unicode unique_name: A user-defined string that uniquely identifies the Service resource - :param unicode friendly_name: A string to describe the Service resource - :param bool include_credentials: Whether to inject Account credentials into a function invocation context - :param bool ui_editable: Whether the Service's properties and subresources can be edited via the UI - - :returns: The created ServiceInstance - :rtype: twilio.rest.serverless.v1.service.ServiceInstance - """ - data = values.of({ - 'UniqueName': unique_name, - 'FriendlyName': friendly_name, - 'IncludeCredentials': include_credentials, - 'UiEditable': ui_editable, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The SID of the Service resource to fetch - - :returns: twilio.rest.serverless.v1.service.ServiceContext - :rtype: twilio.rest.serverless.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The SID of the Service resource to fetch - - :returns: twilio.rest.serverless.v1.service.ServiceContext - :rtype: twilio.rest.serverless.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ServicePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.serverless.v1.service.ServicePage - :rtype: twilio.rest.serverless.v1.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.serverless.v1.service.ServiceInstance - :rtype: twilio.rest.serverless.v1.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) +from twilio.base.version import Version - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.service.asset import AssetListInstancefrom twilio.rest.service.build import BuildListInstancefrom twilio.rest.service.environment import EnvironmentListInstancefrom twilio.rest.service.function import FunctionListInstance class ServiceContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The SID of the Service resource to fetch - - :returns: twilio.rest.serverless.v1.service.ServiceContext - :rtype: twilio.rest.serverless.v1.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents - self._environments = None - self._functions = None + self._solution = { 'sid': sid, } + self._uri = '/Services/${sid}' + self._assets = None self._builds = None - - def fetch(self): - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - :rtype: twilio.rest.serverless.v1.service.ServiceInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - + self._environments = None + self._functions = None + def delete(self): + + + """ Deletes the ServiceInstance @@ -255,303 +51,142 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) + + def fetch(self): + + """ + Fetch the ServiceInstance - def update(self, include_credentials=values.unset, friendly_name=values.unset, - ui_editable=values.unset): + :returns: The fetched ServiceInstance + #TODO: add rtype docs """ - Update the ServiceInstance + payload = self._version.fetch(method='GET', uri=self._uri, ) - :param bool include_credentials: Whether to inject Account credentials into a function invocation context - :param unicode friendly_name: A string to describe the Service resource - :param bool ui_editable: Whether the Service resource's properties and subresources can be edited via the UI + return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + - :returns: The updated ServiceInstance - :rtype: twilio.rest.serverless.v1.service.ServiceInstance - """ + + + def update(self, body): data = values.of({ - 'IncludeCredentials': include_credentials, - 'FriendlyName': friendly_name, - 'UiEditable': ui_editable, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def environments(self): - """ - Access the environments - - :returns: twilio.rest.serverless.v1.service.environment.EnvironmentList - :rtype: twilio.rest.serverless.v1.service.environment.EnvironmentList - """ - if self._environments is None: - self._environments = EnvironmentList(self._version, service_sid=self._solution['sid'], ) - return self._environments - - @property - def functions(self): - """ - Access the functions - - :returns: twilio.rest.serverless.v1.service.function.FunctionList - :rtype: twilio.rest.serverless.v1.service.function.FunctionList - """ - if self._functions is None: - self._functions = FunctionList(self._version, service_sid=self._solution['sid'], ) - return self._functions - - @property - def assets(self): - """ - Access the assets - - :returns: twilio.rest.serverless.v1.service.asset.AssetList - :rtype: twilio.rest.serverless.v1.service.asset.AssetList - """ - if self._assets is None: - self._assets = AssetList(self._version, service_sid=self._solution['sid'], ) - return self._assets - - @property - def builds(self): - """ - Access the builds - - :returns: twilio.rest.serverless.v1.service.build.BuildList - :rtype: twilio.rest.serverless.v1.service.build.BuildList - """ - if self._builds is None: - self._builds = BuildList(self._version, service_sid=self._solution['sid'], ) - return self._builds + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ServiceInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - - :returns: twilio.rest.serverless.v1.service.ServiceInstance - :rtype: twilio.rest.serverless.v1.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'unique_name': payload.get('unique_name'), - 'include_credentials': payload.get('include_credentials'), - 'ui_editable': payload.get('ui_editable'), - 'domain_base': payload.get('domain_base'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'unique_name' : payload.get('unique_name'), + 'include_credentials' : payload.get('include_credentials'), + 'ui_editable' : payload.get('ui_editable'), + 'domain_base' : payload.get('domain_base'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.serverless.v1.service.ServiceContext - """ if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the Service resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the Service resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the Service resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def unique_name(self): - """ - :returns: A user-defined string that uniquely identifies the Service resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def include_credentials(self): - """ - :returns: Whether to inject Account credentials into a function invocation context - :rtype: bool - """ - return self._properties['include_credentials'] - - @property - def ui_editable(self): - """ - :returns: Whether the Service resource's properties and subresources can be edited via the UI - :rtype: bool - """ - return self._properties['ui_editable'] - - @property - def domain_base(self): - """ - :returns: The base domain name for this Service, which is a combination of the unique name and a randomly generated string - :rtype: unicode - """ - return self._properties['domain_base'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the Service resource was created - :rtype: datetime - """ - return self._properties['date_created'] - + def assets(self): + return self._proxy.assets @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the Service resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - + def builds(self): + return self._proxy.builds @property - def url(self): - """ - :returns: The absolute URL of the Service resource - :rtype: unicode - """ - return self._properties['url'] - + def environments(self): + return self._proxy.environments @property - def links(self): - """ - :returns: The URLs of the Service's nested resources - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - :rtype: twilio.rest.serverless.v1.service.ServiceInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + def functions(self): + return self._proxy.functions + - def update(self, include_credentials=values.unset, friendly_name=values.unset, - ui_editable=values.unset): + def __repr__(self): """ - Update the ServiceInstance - - :param bool include_credentials: Whether to inject Account credentials into a function invocation context - :param unicode friendly_name: A string to describe the Service resource - :param bool ui_editable: Whether the Service resource's properties and subresources can be edited via the UI - - :returns: The updated ServiceInstance - :rtype: twilio.rest.serverless.v1.service.ServiceInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update( - include_credentials=include_credentials, - friendly_name=friendly_name, - ui_editable=ui_editable, - ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def environments(self): - """ - Access the environments - :returns: twilio.rest.serverless.v1.service.environment.EnvironmentList - :rtype: twilio.rest.serverless.v1.service.environment.EnvironmentList - """ - return self._proxy.environments - @property - def functions(self): - """ - Access the functions +class ServiceListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.serverless.v1.service.function.FunctionList - :rtype: twilio.rest.serverless.v1.service.function.FunctionList - """ - return self._proxy.functions + # Path Solution + self._solution = { } + self._uri = '/Services' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def assets(self): - """ - Access the assets + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.serverless.v1.service.asset.AssetList - :rtype: twilio.rest.serverless.v1.service.asset.AssetList - """ - return self._proxy.assets + return ServiceInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def builds(self): - """ - Access the builds + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.serverless.v1.service.build.BuildList - :rtype: twilio.rest.serverless.v1.service.build.BuildList - """ - return self._proxy.builds + return ServicePage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/serverless/v1/service/asset.py b/twilio/rest/serverless/v1/service/asset.py deleted file mode 100644 index c2349d1c57..0000000000 --- a/twilio/rest/serverless/v1/service/asset.py +++ /dev/null @@ -1,177 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Serverless - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.asset.asset_version import AssetVersionListInstance - - -class AssetContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Assets/${sid}' - - self._asset_versions = None - - def delete(self): - - - - """ - Deletes the AssetInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the AssetInstance - - :returns: The fetched AssetInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AssetInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return AssetInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class AssetInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = AssetContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def asset_versions(self): - return self._proxy.asset_versions - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class AssetListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Assets' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return AssetInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return AssetPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/serverless/v1/service/asset/__init__.py b/twilio/rest/serverless/v1/service/asset/__init__.py index b39ac61f71..c2349d1c57 100644 --- a/twilio/rest/serverless/v1/service/asset/__init__.py +++ b/twilio/rest/serverless/v1/service/asset/__init__.py @@ -1,246 +1,46 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Serverless + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.serverless.v1.service.asset.asset_version import AssetVersionList - - -class AssetList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the AssetList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the Asset resource is associated with - - :returns: twilio.rest.serverless.v1.service.asset.AssetList - :rtype: twilio.rest.serverless.v1.service.asset.AssetList - """ - super(AssetList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Assets'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams AssetInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.serverless.v1.service.asset.AssetInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists AssetInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.serverless.v1.service.asset.AssetInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of AssetInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of AssetInstance - :rtype: twilio.rest.serverless.v1.service.asset.AssetPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return AssetPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of AssetInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of AssetInstance - :rtype: twilio.rest.serverless.v1.service.asset.AssetPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return AssetPage(self._version, response, self._solution) - - def create(self, friendly_name): - """ - Create the AssetInstance - - :param unicode friendly_name: A string to describe the Asset resource - - :returns: The created AssetInstance - :rtype: twilio.rest.serverless.v1.service.asset.AssetInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return AssetInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def get(self, sid): - """ - Constructs a AssetContext - - :param sid: The SID that identifies the Asset resource to fetch - - :returns: twilio.rest.serverless.v1.service.asset.AssetContext - :rtype: twilio.rest.serverless.v1.service.asset.AssetContext - """ - return AssetContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a AssetContext - - :param sid: The SID that identifies the Asset resource to fetch - - :returns: twilio.rest.serverless.v1.service.asset.AssetContext - :rtype: twilio.rest.serverless.v1.service.asset.AssetContext - """ - return AssetContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AssetPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the AssetPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the Asset resource is associated with - - :returns: twilio.rest.serverless.v1.service.asset.AssetPage - :rtype: twilio.rest.serverless.v1.service.asset.AssetPage - """ - super(AssetPage, self).__init__(version, response) - - # Path Solution - self._solution = solution +from twilio.base.version import Version - def get_instance(self, payload): - """ - Build an instance of AssetInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.serverless.v1.service.asset.AssetInstance - :rtype: twilio.rest.serverless.v1.service.asset.AssetInstance - """ - return AssetInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.asset.asset_version import AssetVersionListInstance class AssetContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the AssetContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the Asset resource from - :param sid: The SID that identifies the Asset resource to fetch - - :returns: twilio.rest.serverless.v1.service.asset.AssetContext - :rtype: twilio.rest.serverless.v1.service.asset.AssetContext - """ - super(AssetContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Assets/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Assets/${sid}' + self._asset_versions = None - - def fetch(self): - """ - Fetch the AssetInstance - - :returns: The fetched AssetInstance - :rtype: twilio.rest.serverless.v1.service.asset.AssetInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return AssetInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the AssetInstance @@ -248,209 +48,130 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, friendly_name): + + def fetch(self): + """ - Update the AssetInstance - - :param unicode friendly_name: A string to describe the Asset resource + Fetch the AssetInstance - :returns: The updated AssetInstance - :rtype: twilio.rest.serverless.v1.service.asset.AssetInstance + :returns: The fetched AssetInstance + #TODO: add rtype docs """ - data = values.of({'FriendlyName': friendly_name, }) + payload = self._version.fetch(method='GET', uri=self._uri, ) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + return AssetInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - return AssetInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + + + def update(self, body): + data = values.of({ + 'body': body, + }) - @property - def asset_versions(self): - """ - Access the asset_versions + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionList - :rtype: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionList - """ - if self._asset_versions is None: - self._asset_versions = AssetVersionList( - self._version, - service_sid=self._solution['service_sid'], - asset_sid=self._solution['sid'], - ) - return self._asset_versions + return AssetInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class AssetInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the AssetInstance - :returns: twilio.rest.serverless.v1.service.asset.AssetInstance - :rtype: twilio.rest.serverless.v1.service.asset.AssetInstance - """ - super(AssetInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class AssetInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AssetContext for this AssetInstance - :rtype: twilio.rest.serverless.v1.service.asset.AssetContext - """ if self._context is None: self._context = AssetContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the Asset resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the Asset resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the Asset resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the Asset resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the Asset resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the Asset resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the Asset resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The URLs of the Asset resource's nested resources - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the AssetInstance - - :returns: The fetched AssetInstance - :rtype: twilio.rest.serverless.v1.service.asset.AssetInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the AssetInstance + def asset_versions(self): + return self._proxy.asset_versions + - :returns: True if delete succeeds, False otherwise - :rtype: bool + def __repr__(self): """ - return self._proxy.delete() - - def update(self, friendly_name): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the AssetInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode friendly_name: A string to describe the Asset resource - :returns: The updated AssetInstance - :rtype: twilio.rest.serverless.v1.service.asset.AssetInstance - """ - return self._proxy.update(friendly_name, ) - @property - def asset_versions(self): - """ - Access the asset_versions +class AssetListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionList - :rtype: twilio.rest.serverless.v1.service.asset.asset_version.AssetVersionList - """ - return self._proxy.asset_versions + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Assets' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return AssetInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return AssetPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/serverless/v1/service/build.py b/twilio/rest/serverless/v1/service/build.py deleted file mode 100644 index 678c50ae7f..0000000000 --- a/twilio/rest/serverless/v1/service/build.py +++ /dev/null @@ -1,168 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Serverless - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.build.build_status import BuildStatusListInstance - - -class BuildContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Builds/${sid}' - - self._build_status = None - - def delete(self): - - - - """ - Deletes the BuildInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the BuildInstance - - :returns: The fetched BuildInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return BuildInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class BuildInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'status' : payload.get('status'), - 'asset_versions' : payload.get('asset_versions'), - 'function_versions' : payload.get('function_versions'), - 'dependencies' : payload.get('dependencies'), - 'runtime' : payload.get('runtime'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = BuildContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def build_status(self): - return self._proxy.build_status - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class BuildListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Builds' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return BuildInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return BuildPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/serverless/v1/service/build/__init__.py b/twilio/rest/serverless/v1/service/build/__init__.py index f06a4af3af..678c50ae7f 100644 --- a/twilio/rest/serverless/v1/service/build/__init__.py +++ b/twilio/rest/serverless/v1/service/build/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Serverless + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,245 +19,28 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.serverless.v1.service.build.build_status import BuildStatusList - - -class BuildList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the BuildList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the Build resource is associated with - - :returns: twilio.rest.serverless.v1.service.build.BuildList - :rtype: twilio.rest.serverless.v1.service.build.BuildList - """ - super(BuildList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Builds'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams BuildInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.serverless.v1.service.build.BuildInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists BuildInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.serverless.v1.service.build.BuildInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of BuildInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of BuildInstance - :rtype: twilio.rest.serverless.v1.service.build.BuildPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return BuildPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of BuildInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of BuildInstance - :rtype: twilio.rest.serverless.v1.service.build.BuildPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return BuildPage(self._version, response, self._solution) - - def create(self, asset_versions=values.unset, function_versions=values.unset, - dependencies=values.unset, runtime=values.unset): - """ - Create the BuildInstance - - :param list[unicode] asset_versions: The list of Asset Version resource SIDs to include in the Build - :param list[unicode] function_versions: The list of the Function Version resource SIDs to include in the Build - :param unicode dependencies: A list of objects that describe the Dependencies included in the Build - :param unicode runtime: The Runtime version that will be used to run the Build. - - :returns: The created BuildInstance - :rtype: twilio.rest.serverless.v1.service.build.BuildInstance - """ - data = values.of({ - 'AssetVersions': serialize.map(asset_versions, lambda e: e), - 'FunctionVersions': serialize.map(function_versions, lambda e: e), - 'Dependencies': dependencies, - 'Runtime': runtime, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return BuildInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def get(self, sid): - """ - Constructs a BuildContext - - :param sid: The SID of the Build resource to fetch - - :returns: twilio.rest.serverless.v1.service.build.BuildContext - :rtype: twilio.rest.serverless.v1.service.build.BuildContext - """ - return BuildContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) +from twilio.base.version import Version - def __call__(self, sid): - """ - Constructs a BuildContext - - :param sid: The SID of the Build resource to fetch - - :returns: twilio.rest.serverless.v1.service.build.BuildContext - :rtype: twilio.rest.serverless.v1.service.build.BuildContext - """ - return BuildContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class BuildPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the BuildPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the Build resource is associated with - - :returns: twilio.rest.serverless.v1.service.build.BuildPage - :rtype: twilio.rest.serverless.v1.service.build.BuildPage - """ - super(BuildPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of BuildInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.serverless.v1.service.build.BuildInstance - :rtype: twilio.rest.serverless.v1.service.build.BuildInstance - """ - return BuildInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.build.build_status import BuildStatusListInstance class BuildContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the BuildContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the Build resource from - :param sid: The SID of the Build resource to fetch - - :returns: twilio.rest.serverless.v1.service.build.BuildContext - :rtype: twilio.rest.serverless.v1.service.build.BuildContext - """ - super(BuildContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Builds/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Builds/${sid}' + self._build_status = None - - def fetch(self): - """ - Fetch the BuildInstance - - :returns: The fetched BuildInstance - :rtype: twilio.rest.serverless.v1.service.build.BuildInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return BuildInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the BuildInstance @@ -258,226 +48,121 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def build_status(self): + + def fetch(self): + """ - Access the build_status + Fetch the BuildInstance - :returns: twilio.rest.serverless.v1.service.build.build_status.BuildStatusList - :rtype: twilio.rest.serverless.v1.service.build.build_status.BuildStatusList + :returns: The fetched BuildInstance + #TODO: add rtype docs """ - if self._build_status is None: - self._build_status = BuildStatusList( - self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - return self._build_status + payload = self._version.fetch(method='GET', uri=self._uri, ) + + return BuildInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class BuildInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Status(object): - BUILDING = "building" - COMPLETED = "completed" - FAILED = "failed" - - class Runtime(object): - NODE8 = "node8" - NODE10 = "node10" - NODE12 = "node12" - NODE14 = "node14" - NODE16 = "node16" - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the BuildInstance - :returns: twilio.rest.serverless.v1.service.build.BuildInstance - :rtype: twilio.rest.serverless.v1.service.build.BuildInstance - """ - super(BuildInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'status': payload.get('status'), - 'asset_versions': payload.get('asset_versions'), - 'function_versions': payload.get('function_versions'), - 'dependencies': payload.get('dependencies'), - 'runtime': payload.get('runtime'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class BuildInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'status' : payload.get('status'), + 'asset_versions' : payload.get('asset_versions'), + 'function_versions' : payload.get('function_versions'), + 'dependencies' : payload.get('dependencies'), + 'runtime' : payload.get('runtime'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: BuildContext for this BuildInstance - :rtype: twilio.rest.serverless.v1.service.build.BuildContext - """ if self._context is None: self._context = BuildContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the Build resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the Build resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the Build resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def status(self): - """ - :returns: The status of the Build - :rtype: BuildInstance.Status - """ - return self._properties['status'] - - @property - def asset_versions(self): - """ - :returns: The list of Asset Version resource SIDs that are included in the Build - :rtype: list[dict] - """ - return self._properties['asset_versions'] - - @property - def function_versions(self): - """ - :returns: The list of Function Version resource SIDs that are included in the Build - :rtype: list[dict] - """ - return self._properties['function_versions'] - - @property - def dependencies(self): - """ - :returns: A list of objects that describe the Dependencies included in the Build - :rtype: list[dict] - """ - return self._properties['dependencies'] - - @property - def runtime(self): - """ - :returns: The Runtime version that will be used to run the Build. - :rtype: BuildInstance.Runtime - """ - return self._properties['runtime'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the Build resource was created - :rtype: datetime - """ - return self._properties['date_created'] + def build_status(self): + return self._proxy.build_status + - @property - def date_updated(self): + def __repr__(self): """ - :returns: The ISO 8601 date and time in GMT when the Build resource was last updated - :rtype: datetime + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['date_updated'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of the Build resource - :rtype: unicode - """ - return self._properties['url'] - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] - def fetch(self): - """ - Fetch the BuildInstance +class BuildListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The fetched BuildInstance - :rtype: twilio.rest.serverless.v1.service.build.BuildInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Builds' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - def delete(self): - """ - Deletes the BuildInstance + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + return BuildInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def build_status(self): - """ - Access the build_status + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.serverless.v1.service.build.build_status.BuildStatusList - :rtype: twilio.rest.serverless.v1.service.build.build_status.BuildStatusList - """ - return self._proxy.build_status + return BuildPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/serverless/v1/service/environment.py b/twilio/rest/serverless/v1/service/environment.py deleted file mode 100644 index 463e6edfd6..0000000000 --- a/twilio/rest/serverless/v1/service/environment.py +++ /dev/null @@ -1,175 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Serverless - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.environment.deployment import DeploymentListInstancefrom twilio.rest.environment.log import LogListInstancefrom twilio.rest.environment.variable import VariableListInstance - - -class EnvironmentContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Environments/${sid}' - - self._deployments = None - self._logs = None - self._variables = None - - def delete(self): - - - - """ - Deletes the EnvironmentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the EnvironmentInstance - - :returns: The fetched EnvironmentInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return EnvironmentInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class EnvironmentInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'build_sid' : payload.get('build_sid'), - 'unique_name' : payload.get('unique_name'), - 'domain_suffix' : payload.get('domain_suffix'), - 'domain_name' : payload.get('domain_name'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = EnvironmentContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def deployments(self): - return self._proxy.deployments - @property - def logs(self): - return self._proxy.logs - @property - def variables(self): - return self._proxy.variables - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class EnvironmentListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Environments' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return EnvironmentInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return EnvironmentPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/serverless/v1/service/environment/__init__.py b/twilio/rest/serverless/v1/service/environment/__init__.py index 78d5c2749a..463e6edfd6 100644 --- a/twilio/rest/serverless/v1/service/environment/__init__.py +++ b/twilio/rest/serverless/v1/service/environment/__init__.py @@ -1,251 +1,48 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Serverless + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.serverless.v1.service.environment.deployment import DeploymentList -from twilio.rest.serverless.v1.service.environment.log import LogList -from twilio.rest.serverless.v1.service.environment.variable import VariableList - - -class EnvironmentList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the EnvironmentList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the Environment resource is associated with - - :returns: twilio.rest.serverless.v1.service.environment.EnvironmentList - :rtype: twilio.rest.serverless.v1.service.environment.EnvironmentList - """ - super(EnvironmentList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Environments'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams EnvironmentInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.serverless.v1.service.environment.EnvironmentInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists EnvironmentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.serverless.v1.service.environment.EnvironmentInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of EnvironmentInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of EnvironmentInstance - :rtype: twilio.rest.serverless.v1.service.environment.EnvironmentPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) +from twilio.base.version import Version - return EnvironmentPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of EnvironmentInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of EnvironmentInstance - :rtype: twilio.rest.serverless.v1.service.environment.EnvironmentPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return EnvironmentPage(self._version, response, self._solution) - - def create(self, unique_name, domain_suffix=values.unset): - """ - Create the EnvironmentInstance - - :param unicode unique_name: A user-defined string that uniquely identifies the Environment resource - :param unicode domain_suffix: A URL-friendly name that represents the environment - - :returns: The created EnvironmentInstance - :rtype: twilio.rest.serverless.v1.service.environment.EnvironmentInstance - """ - data = values.of({'UniqueName': unique_name, 'DomainSuffix': domain_suffix, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return EnvironmentInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def get(self, sid): - """ - Constructs a EnvironmentContext - - :param sid: The SID of the Environment resource to fetch - - :returns: twilio.rest.serverless.v1.service.environment.EnvironmentContext - :rtype: twilio.rest.serverless.v1.service.environment.EnvironmentContext - """ - return EnvironmentContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a EnvironmentContext - - :param sid: The SID of the Environment resource to fetch - - :returns: twilio.rest.serverless.v1.service.environment.EnvironmentContext - :rtype: twilio.rest.serverless.v1.service.environment.EnvironmentContext - """ - return EnvironmentContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class EnvironmentPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the EnvironmentPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the Environment resource is associated with - - :returns: twilio.rest.serverless.v1.service.environment.EnvironmentPage - :rtype: twilio.rest.serverless.v1.service.environment.EnvironmentPage - """ - super(EnvironmentPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of EnvironmentInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.serverless.v1.service.environment.EnvironmentInstance - :rtype: twilio.rest.serverless.v1.service.environment.EnvironmentInstance - """ - return EnvironmentInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.environment.deployment import DeploymentListInstancefrom twilio.rest.environment.log import LogListInstancefrom twilio.rest.environment.variable import VariableListInstance class EnvironmentContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the EnvironmentContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the Environment resource from - :param sid: The SID of the Environment resource to fetch - - :returns: twilio.rest.serverless.v1.service.environment.EnvironmentContext - :rtype: twilio.rest.serverless.v1.service.environment.EnvironmentContext - """ - super(EnvironmentContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Environments/{sid}'.format(**self._solution) - - # Dependents - self._variables = None + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Environments/${sid}' + self._deployments = None self._logs = None - - def fetch(self): - """ - Fetch the EnvironmentInstance - - :returns: The fetched EnvironmentInstance - :rtype: twilio.rest.serverless.v1.service.environment.EnvironmentInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return EnvironmentInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - + self._variables = None + def delete(self): + + + """ Deletes the EnvironmentInstance @@ -253,257 +50,126 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def variables(self): - """ - Access the variables - - :returns: twilio.rest.serverless.v1.service.environment.variable.VariableList - :rtype: twilio.rest.serverless.v1.service.environment.variable.VariableList - """ - if self._variables is None: - self._variables = VariableList( - self._version, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['sid'], - ) - return self._variables - - @property - def deployments(self): + + def fetch(self): + """ - Access the deployments + Fetch the EnvironmentInstance - :returns: twilio.rest.serverless.v1.service.environment.deployment.DeploymentList - :rtype: twilio.rest.serverless.v1.service.environment.deployment.DeploymentList + :returns: The fetched EnvironmentInstance + #TODO: add rtype docs """ - if self._deployments is None: - self._deployments = DeploymentList( - self._version, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['sid'], - ) - return self._deployments + payload = self._version.fetch(method='GET', uri=self._uri, ) - @property - def logs(self): - """ - Access the logs + return EnvironmentInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - :returns: twilio.rest.serverless.v1.service.environment.log.LogList - :rtype: twilio.rest.serverless.v1.service.environment.log.LogList - """ - if self._logs is None: - self._logs = LogList( - self._version, - service_sid=self._solution['service_sid'], - environment_sid=self._solution['sid'], - ) - return self._logs + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class EnvironmentInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the EnvironmentInstance - - :returns: twilio.rest.serverless.v1.service.environment.EnvironmentInstance - :rtype: twilio.rest.serverless.v1.service.environment.EnvironmentInstance - """ - super(EnvironmentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'build_sid': payload.get('build_sid'), - 'unique_name': payload.get('unique_name'), - 'domain_suffix': payload.get('domain_suffix'), - 'domain_name': payload.get('domain_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class EnvironmentInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'build_sid' : payload.get('build_sid'), + 'unique_name' : payload.get('unique_name'), + 'domain_suffix' : payload.get('domain_suffix'), + 'domain_name' : payload.get('domain_name'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: EnvironmentContext for this EnvironmentInstance - :rtype: twilio.rest.serverless.v1.service.environment.EnvironmentContext - """ if self._context is None: self._context = EnvironmentContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the Environment resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the Environment resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the Environment resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def build_sid(self): - """ - :returns: The SID of the build deployed in the environment - :rtype: unicode - """ - return self._properties['build_sid'] - - @property - def unique_name(self): - """ - :returns: A user-defined string that uniquely identifies the Environment resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def domain_suffix(self): - """ - :returns: A URL-friendly name that represents the environment - :rtype: unicode - """ - return self._properties['domain_suffix'] - - @property - def domain_name(self): - """ - :returns: The domain name for all Functions and Assets deployed in the Environment - :rtype: unicode - """ - return self._properties['domain_name'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the Environment resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the Environment resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the Environment resource - :rtype: unicode - """ - return self._properties['url'] - + def deployments(self): + return self._proxy.deployments @property - def links(self): - """ - :returns: The URLs of the Environment resource's nested resources - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the EnvironmentInstance - - :returns: The fetched EnvironmentInstance - :rtype: twilio.rest.serverless.v1.service.environment.EnvironmentInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the EnvironmentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - + def logs(self): + return self._proxy.logs @property def variables(self): - """ - Access the variables - - :returns: twilio.rest.serverless.v1.service.environment.variable.VariableList - :rtype: twilio.rest.serverless.v1.service.environment.variable.VariableList - """ return self._proxy.variables + - @property - def deployments(self): + def __repr__(self): """ - Access the deployments - - :returns: twilio.rest.serverless.v1.service.environment.deployment.DeploymentList - :rtype: twilio.rest.serverless.v1.service.environment.deployment.DeploymentList + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.deployments + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def logs(self): - """ - Access the logs - :returns: twilio.rest.serverless.v1.service.environment.log.LogList - :rtype: twilio.rest.serverless.v1.service.environment.log.LogList - """ - return self._proxy.logs + +class EnvironmentListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) + + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Environments' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return EnvironmentInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return EnvironmentPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/serverless/v1/service/function.py b/twilio/rest/serverless/v1/service/function.py deleted file mode 100644 index 0b6faff03f..0000000000 --- a/twilio/rest/serverless/v1/service/function.py +++ /dev/null @@ -1,177 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Serverless - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.function.function_version import FunctionVersionListInstance - - -class FunctionContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Functions/${sid}' - - self._function_versions = None - - def delete(self): - - - - """ - Deletes the FunctionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the FunctionInstance - - :returns: The fetched FunctionInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FunctionInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return FunctionInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class FunctionInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = FunctionContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def function_versions(self): - return self._proxy.function_versions - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class FunctionListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Functions' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return FunctionInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return FunctionPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/serverless/v1/service/function/__init__.py b/twilio/rest/serverless/v1/service/function/__init__.py index dbef14820a..0b6faff03f 100644 --- a/twilio/rest/serverless/v1/service/function/__init__.py +++ b/twilio/rest/serverless/v1/service/function/__init__.py @@ -1,246 +1,46 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Serverless + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.serverless.v1.service.function.function_version import FunctionVersionList - - -class FunctionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid): - """ - Initialize the FunctionList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the Function resource is associated with - - :returns: twilio.rest.serverless.v1.service.function.FunctionList - :rtype: twilio.rest.serverless.v1.service.function.FunctionList - """ - super(FunctionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Functions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams FunctionInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.serverless.v1.service.function.FunctionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists FunctionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.serverless.v1.service.function.FunctionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of FunctionInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of FunctionInstance - :rtype: twilio.rest.serverless.v1.service.function.FunctionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return FunctionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FunctionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FunctionInstance - :rtype: twilio.rest.serverless.v1.service.function.FunctionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FunctionPage(self._version, response, self._solution) - - def create(self, friendly_name): - """ - Create the FunctionInstance - - :param unicode friendly_name: A string to describe the Function resource - - :returns: The created FunctionInstance - :rtype: twilio.rest.serverless.v1.service.function.FunctionInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return FunctionInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def get(self, sid): - """ - Constructs a FunctionContext - - :param sid: The SID of the Function resource to fetch - - :returns: twilio.rest.serverless.v1.service.function.FunctionContext - :rtype: twilio.rest.serverless.v1.service.function.FunctionContext - """ - return FunctionContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a FunctionContext - - :param sid: The SID of the Function resource to fetch - - :returns: twilio.rest.serverless.v1.service.function.FunctionContext - :rtype: twilio.rest.serverless.v1.service.function.FunctionContext - """ - return FunctionContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FunctionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the FunctionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the Function resource is associated with - - :returns: twilio.rest.serverless.v1.service.function.FunctionPage - :rtype: twilio.rest.serverless.v1.service.function.FunctionPage - """ - super(FunctionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution +from twilio.base.version import Version - def get_instance(self, payload): - """ - Build an instance of FunctionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.serverless.v1.service.function.FunctionInstance - :rtype: twilio.rest.serverless.v1.service.function.FunctionInstance - """ - return FunctionInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.function.function_version import FunctionVersionListInstance class FunctionContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, sid): - """ - Initialize the FunctionContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the Function resource from - :param sid: The SID of the Function resource to fetch - - :returns: twilio.rest.serverless.v1.service.function.FunctionContext - :rtype: twilio.rest.serverless.v1.service.function.FunctionContext - """ - super(FunctionContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Functions/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Functions/${sid}' + self._function_versions = None - - def fetch(self): - """ - Fetch the FunctionInstance - - :returns: The fetched FunctionInstance - :rtype: twilio.rest.serverless.v1.service.function.FunctionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FunctionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the FunctionInstance @@ -248,209 +48,130 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, friendly_name): + + def fetch(self): + """ - Update the FunctionInstance - - :param unicode friendly_name: A string to describe the Function resource + Fetch the FunctionInstance - :returns: The updated FunctionInstance - :rtype: twilio.rest.serverless.v1.service.function.FunctionInstance + :returns: The fetched FunctionInstance + #TODO: add rtype docs """ - data = values.of({'FriendlyName': friendly_name, }) + payload = self._version.fetch(method='GET', uri=self._uri, ) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + return FunctionInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - return FunctionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + + + def update(self, body): + data = values.of({ + 'body': body, + }) - @property - def function_versions(self): - """ - Access the function_versions + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionList - :rtype: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionList - """ - if self._function_versions is None: - self._function_versions = FunctionVersionList( - self._version, - service_sid=self._solution['service_sid'], - function_sid=self._solution['sid'], - ) - return self._function_versions + return FunctionInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class FunctionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the FunctionInstance - :returns: twilio.rest.serverless.v1.service.function.FunctionInstance - :rtype: twilio.rest.serverless.v1.service.function.FunctionInstance - """ - super(FunctionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class FunctionInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FunctionContext for this FunctionInstance - :rtype: twilio.rest.serverless.v1.service.function.FunctionContext - """ if self._context is None: self._context = FunctionContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the Function resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the Function resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the Function resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the Function resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the Function resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the Function resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the Function resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The URLs of nested resources of the Function resource - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the FunctionInstance - - :returns: The fetched FunctionInstance - :rtype: twilio.rest.serverless.v1.service.function.FunctionInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the FunctionInstance + def function_versions(self): + return self._proxy.function_versions + - :returns: True if delete succeeds, False otherwise - :rtype: bool + def __repr__(self): """ - return self._proxy.delete() - - def update(self, friendly_name): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the FunctionInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode friendly_name: A string to describe the Function resource - :returns: The updated FunctionInstance - :rtype: twilio.rest.serverless.v1.service.function.FunctionInstance - """ - return self._proxy.update(friendly_name, ) - @property - def function_versions(self): - """ - Access the function_versions +class FunctionListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionList - :rtype: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionList - """ - return self._proxy.function_versions + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Functions' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return FunctionInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return FunctionPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/serverless/v1/service/function/function_version.py b/twilio/rest/serverless/v1/service/function/function_version.py deleted file mode 100644 index 70b5b89b66..0000000000 --- a/twilio/rest/serverless/v1/service/function/function_version.py +++ /dev/null @@ -1,141 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Serverless - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.function_version.function_version_content import FunctionVersionContentListInstance - - -class FunctionVersionContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, function_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'function_sid': function_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Functions/${function_sid}/Versions/${sid}' - - self._function_version_content = None - - def fetch(self): - - """ - Fetch the FunctionVersionInstance - - :returns: The fetched FunctionVersionInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FunctionVersionInstance(self._version, payload, service_sid=self._solution['service_sid'], function_sid=self._solution['function_sid'], sid=self._solution['sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class FunctionVersionInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, function_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'function_sid' : payload.get('function_sid'), - 'path' : payload.get('path'), - 'visibility' : payload.get('visibility'), - 'date_created' : payload.get('date_created'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'function_sid': function_sid or self._properties['function_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = FunctionVersionContext( - self._version, - service_sid=self._solution['service_sid'],function_sid=self._solution['function_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def function_version_content(self): - return self._proxy.function_version_content - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class FunctionVersionListInstance(ListResource): - def __init__(self, version: Version, service_sid: str, function_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'function_sid': function_sid, } - self._uri = '/Services/${service_sid}/Functions/${function_sid}/Versions' - - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return FunctionVersionPage(self._version, payload, service_sid=self._solution['service_sid'], function_sid=self._solution['function_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/serverless/v1/service/function/function_version/__init__.py b/twilio/rest/serverless/v1/service/function/function_version/__init__.py index be833ad41d..70b5b89b66 100644 --- a/twilio/rest/serverless/v1/service/function/function_version/__init__.py +++ b/twilio/rest/serverless/v1/service/function/function_version/__init__.py @@ -1,431 +1,141 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Serverless + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.serverless.v1.service.function.function_version.function_version_content import FunctionVersionContentList - - -class FunctionVersionList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, function_sid): - """ - Initialize the FunctionVersionList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the Function Version resource is associated with - :param function_sid: The SID of the Function resource that is the parent of the Function Version resource - - :returns: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionList - :rtype: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionList - """ - super(FunctionVersionList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'function_sid': function_sid, } - self._uri = '/Services/{service_sid}/Functions/{function_sid}/Versions'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams FunctionVersionInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.serverless.v1.service.function.function_version.FunctionVersionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists FunctionVersionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.serverless.v1.service.function.function_version.FunctionVersionInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of FunctionVersionInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of FunctionVersionInstance - :rtype: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return FunctionVersionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FunctionVersionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FunctionVersionInstance - :rtype: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FunctionVersionPage(self._version, response, self._solution) +from twilio.base.version import Version - def get(self, sid): - """ - Constructs a FunctionVersionContext - - :param sid: The SID that identifies the Function Version resource to fetch - - :returns: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionContext - :rtype: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionContext - """ - return FunctionVersionContext( - self._version, - service_sid=self._solution['service_sid'], - function_sid=self._solution['function_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a FunctionVersionContext - - :param sid: The SID that identifies the Function Version resource to fetch - - :returns: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionContext - :rtype: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionContext - """ - return FunctionVersionContext( - self._version, - service_sid=self._solution['service_sid'], - function_sid=self._solution['function_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FunctionVersionPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the FunctionVersionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the Function Version resource is associated with - :param function_sid: The SID of the Function resource that is the parent of the Function Version resource - - :returns: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionPage - :rtype: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionPage - """ - super(FunctionVersionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FunctionVersionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionInstance - :rtype: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionInstance - """ - return FunctionVersionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - function_sid=self._solution['function_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.function_version.function_version_content import FunctionVersionContentListInstance class FunctionVersionContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, service_sid, function_sid, sid): - """ - Initialize the FunctionVersionContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service to fetch the Function Version resource from - :param function_sid: The SID of the function that is the parent of the Function Version resource to fetch - :param sid: The SID that identifies the Function Version resource to fetch - - :returns: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionContext - :rtype: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionContext - """ - super(FunctionVersionContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, function_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'function_sid': function_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Functions/{function_sid}/Versions/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'function_sid': function_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Functions/${function_sid}/Versions/${sid}' + self._function_version_content = None - + def fetch(self): + """ Fetch the FunctionVersionInstance :returns: The fetched FunctionVersionInstance - :rtype: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return FunctionVersionInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - function_sid=self._solution['function_sid'], - sid=self._solution['sid'], - ) - - @property - def function_version_content(self): - """ - Access the function_version_content + return FunctionVersionInstance(self._version, payload, service_sid=self._solution['service_sid'], function_sid=self._solution['function_sid'], sid=self._solution['sid'], ) + - :returns: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentList - :rtype: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentList - """ - if self._function_version_content is None: - self._function_version_content = FunctionVersionContentList( - self._version, - service_sid=self._solution['service_sid'], - function_sid=self._solution['function_sid'], - sid=self._solution['sid'], - ) - return self._function_version_content + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class FunctionVersionInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - class Visibility(object): - PUBLIC = "public" - PRIVATE = "private" - PROTECTED = "protected" - - def __init__(self, version, payload, service_sid, function_sid, sid=None): - """ - Initialize the FunctionVersionInstance - :returns: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionInstance - :rtype: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionInstance - """ - super(FunctionVersionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'function_sid': payload.get('function_sid'), - 'path': payload.get('path'), - 'visibility': payload.get('visibility'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class FunctionVersionInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, function_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'function_sid' : payload.get('function_sid'), + 'path' : payload.get('path'), + 'visibility' : payload.get('visibility'), + 'date_created' : payload.get('date_created'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'function_sid': function_sid, - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid'],'function_sid': function_sid or self._properties['function_sid'],'sid': sid or self._properties['sid'], } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FunctionVersionContext for this FunctionVersionInstance - :rtype: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionContext - """ if self._context is None: self._context = FunctionVersionContext( self._version, - service_sid=self._solution['service_sid'], - function_sid=self._solution['function_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],function_sid=self._solution['function_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the Function Version resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the Function Version resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the Function Version resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def function_sid(self): - """ - :returns: The SID of the Function resource that is the parent of the Function Version resource - :rtype: unicode - """ - return self._properties['function_sid'] - - @property - def path(self): - """ - :returns: The URL-friendly string by which the Function Version resource can be referenced - :rtype: unicode - """ - return self._properties['path'] - - @property - def visibility(self): - """ - :returns: The access control that determines how the Function Version resource can be accessed - :rtype: FunctionVersionInstance.Visibility - """ - return self._properties['visibility'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the Function Version resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def url(self): - """ - :returns: The absolute URL of the Function Version resource - :rtype: unicode - """ - return self._properties['url'] + def function_version_content(self): + return self._proxy.function_version_content + - @property - def links(self): + def __repr__(self): """ - :returns: The links - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['links'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the FunctionVersionInstance - :returns: The fetched FunctionVersionInstance - :rtype: twilio.rest.serverless.v1.service.function.function_version.FunctionVersionInstance - """ - return self._proxy.fetch() - @property - def function_version_content(self): - """ - Access the function_version_content +class FunctionVersionListInstance(ListResource): + def __init__(self, version: Version, service_sid: str, function_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentList - :rtype: twilio.rest.serverless.v1.service.function.function_version.function_version_content.FunctionVersionContentList - """ - return self._proxy.function_version_content + # Path Solution + self._solution = { 'service_sid': service_sid, 'function_sid': function_sid, } + self._uri = '/Services/${service_sid}/Functions/${function_sid}/Versions' + + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return FunctionVersionPage(self._version, payload, service_sid=self._solution['service_sid'], function_sid=self._solution['function_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/studio/v1/flow.py b/twilio/rest/studio/v1/flow.py deleted file mode 100644 index 0598294aee..0000000000 --- a/twilio/rest/studio/v1/flow.py +++ /dev/null @@ -1,157 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Studio - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.flow.engagement import EngagementListInstancefrom twilio.rest.flow.execution import ExecutionListInstance - - -class FlowContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Flows/${sid}' - - self._engagements = None - self._executions = None - - def delete(self): - - - - """ - Deletes the FlowInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the FlowInstance - - :returns: The fetched FlowInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FlowInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class FlowInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'status' : payload.get('status'), - 'version' : payload.get('version'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = FlowContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def engagements(self): - return self._proxy.engagements - @property - def executions(self): - return self._proxy.executions - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class FlowListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Flows' - - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return FlowPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/studio/v1/flow/__init__.py b/twilio/rest/studio/v1/flow/__init__.py index 57f3e8a75c..0598294aee 100644 --- a/twilio/rest/studio/v1/flow/__init__.py +++ b/twilio/rest/studio/v1/flow/__init__.py @@ -1,219 +1,47 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Studio + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.studio.v1.flow.engagement import EngagementList -from twilio.rest.studio.v1.flow.execution import ExecutionList - - -class FlowList(ListResource): - - def __init__(self, version): - """ - Initialize the FlowList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.studio.v1.flow.FlowList - :rtype: twilio.rest.studio.v1.flow.FlowList - """ - super(FlowList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Flows'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams FlowInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.studio.v1.flow.FlowInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists FlowInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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) +from twilio.base.version import Version - :returns: Generator that will yield up to limit results - :rtype: list[twilio.rest.studio.v1.flow.FlowInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of FlowInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of FlowInstance - :rtype: twilio.rest.studio.v1.flow.FlowPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return FlowPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FlowInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FlowInstance - :rtype: twilio.rest.studio.v1.flow.FlowPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FlowPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a FlowContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.studio.v1.flow.FlowContext - :rtype: twilio.rest.studio.v1.flow.FlowContext - """ - return FlowContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a FlowContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.studio.v1.flow.FlowContext - :rtype: twilio.rest.studio.v1.flow.FlowContext - """ - return FlowContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FlowPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the FlowPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.studio.v1.flow.FlowPage - :rtype: twilio.rest.studio.v1.flow.FlowPage - """ - super(FlowPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FlowInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.studio.v1.flow.FlowInstance - :rtype: twilio.rest.studio.v1.flow.FlowInstance - """ - return FlowInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.flow.engagement import EngagementListInstancefrom twilio.rest.flow.execution import ExecutionListInstance class FlowContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the FlowContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.studio.v1.flow.FlowContext - :rtype: twilio.rest.studio.v1.flow.FlowContext - """ - super(FlowContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Flows/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Flows/${sid}' + self._engagements = None self._executions = None - - def fetch(self): - """ - Fetch the FlowInstance - - :returns: The fetched FlowInstance - :rtype: twilio.rest.studio.v1.flow.FlowInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FlowInstance(self._version, payload, sid=self._solution['sid'], ) - + def delete(self): + + + """ Deletes the FlowInstance @@ -221,203 +49,109 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def engagements(self): + + def fetch(self): + """ - Access the engagements + Fetch the FlowInstance - :returns: twilio.rest.studio.v1.flow.engagement.EngagementList - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementList + :returns: The fetched FlowInstance + #TODO: add rtype docs """ - if self._engagements is None: - self._engagements = EngagementList(self._version, flow_sid=self._solution['sid'], ) - return self._engagements + payload = self._version.fetch(method='GET', uri=self._uri, ) - @property - def executions(self): - """ - Access the executions + return FlowInstance(self._version, payload, sid=self._solution['sid'], ) + - :returns: twilio.rest.studio.v1.flow.execution.ExecutionList - :rtype: twilio.rest.studio.v1.flow.execution.ExecutionList - """ - if self._executions is None: - self._executions = ExecutionList(self._version, flow_sid=self._solution['sid'], ) - return self._executions + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class FlowInstance(InstanceResource): + return '' - class Status(object): - DRAFT = "draft" - PUBLISHED = "published" - def __init__(self, version, payload, sid=None): - """ - Initialize the FlowInstance - - :returns: twilio.rest.studio.v1.flow.FlowInstance - :rtype: twilio.rest.studio.v1.flow.FlowInstance - """ - super(FlowInstance, self).__init__(version) - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'status': payload.get('status'), - 'version': deserialize.integer(payload.get('version')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class FlowInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'status' : payload.get('status'), + 'version' : payload.get('version'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FlowContext for this FlowInstance - :rtype: twilio.rest.studio.v1.flow.FlowContext - """ if self._context is None: - self._context = FlowContext(self._version, sid=self._solution['sid'], ) + self._context = FlowContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the Flow - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def status(self): - """ - :returns: The status of the Flow - :rtype: FlowInstance.Status - """ - return self._properties['status'] - - @property - def version(self): - """ - :returns: The latest version number of the Flow's definition - :rtype: unicode - """ - return self._properties['version'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - + def engagements(self): + return self._proxy.engagements @property - def links(self): - """ - :returns: Nested resource URLs - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the FlowInstance - - :returns: The fetched FlowInstance - :rtype: twilio.rest.studio.v1.flow.FlowInstance - """ - return self._proxy.fetch() + def executions(self): + return self._proxy.executions + - def delete(self): + def __repr__(self): """ - Deletes the FlowInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.delete() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def engagements(self): - """ - Access the engagements - :returns: twilio.rest.studio.v1.flow.engagement.EngagementList - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementList - """ - return self._proxy.engagements - @property - def executions(self): - """ - Access the executions +class FlowListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.studio.v1.flow.execution.ExecutionList - :rtype: twilio.rest.studio.v1.flow.execution.ExecutionList - """ - return self._proxy.executions + # Path Solution + self._solution = { } + self._uri = '/Flows' + + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return FlowPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/studio/v1/flow/engagement.py b/twilio/rest/studio/v1/flow/engagement.py deleted file mode 100644 index 764714d6e5..0000000000 --- a/twilio/rest/studio/v1/flow/engagement.py +++ /dev/null @@ -1,171 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Studio - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.engagement.engagement_context import EngagementContextListInstancefrom twilio.rest.engagement.step import StepListInstance - - -class EngagementContext(InstanceContext): - def __init__(self, version: Version, flow_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'flow_sid': flow_sid, 'sid': sid, } - self._uri = '/Flows/${flow_sid}/Engagements/${sid}' - - self._engagement_context = None - self._steps = None - - def delete(self): - - - - """ - Deletes the EngagementInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the EngagementInstance - - :returns: The fetched EngagementInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return EngagementInstance(self._version, payload, flow_sid=self._solution['flow_sid'], sid=self._solution['sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class EngagementInstance(InstanceResource): - def __init__(self, version, payload, flow_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'flow_sid' : payload.get('flow_sid'), - 'contact_sid' : payload.get('contact_sid'), - 'contact_channel_address' : payload.get('contact_channel_address'), - 'context' : payload.get('context'), - 'status' : payload.get('status'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'flow_sid': flow_sid or self._properties['flow_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = EngagementContext( - self._version, - flow_sid=self._solution['flow_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def engagement_context(self): - return self._proxy.engagement_context - @property - def steps(self): - return self._proxy.steps - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class EngagementListInstance(ListResource): - def __init__(self, version: Version, flow_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'flow_sid': flow_sid, } - self._uri = '/Flows/${flow_sid}/Engagements' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return EngagementInstance(self._version, payload, flow_sid=self._solution['flow_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return EngagementPage(self._version, payload, flow_sid=self._solution['flow_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/studio/v1/flow/engagement/__init__.py b/twilio/rest/studio/v1/flow/engagement/__init__.py index 2049ec28d5..764714d6e5 100644 --- a/twilio/rest/studio/v1/flow/engagement/__init__.py +++ b/twilio/rest/studio/v1/flow/engagement/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Studio + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,234 +19,29 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.studio.v1.flow.engagement.engagement_context import EngagementContextList -from twilio.rest.studio.v1.flow.engagement.step import StepList - - -class EngagementList(ListResource): - - def __init__(self, version, flow_sid): - """ - Initialize the EngagementList - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - - :returns: twilio.rest.studio.v1.flow.engagement.EngagementList - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementList - """ - super(EngagementList, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, } - self._uri = '/Flows/{flow_sid}/Engagements'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams EngagementInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.studio.v1.flow.engagement.EngagementInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists EngagementInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.studio.v1.flow.engagement.EngagementInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of EngagementInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of EngagementInstance - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return EngagementPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of EngagementInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of EngagementInstance - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return EngagementPage(self._version, response, self._solution) - - def create(self, to, from_, parameters=values.unset): - """ - Create the EngagementInstance - - :param unicode to: The Contact phone number to start a Studio Flow Engagement - :param unicode from_: The Twilio phone number to send messages or initiate calls from during the Flow Engagement - :param dict parameters: A JSON string we will add to your flow's context and that you can access as variables inside your flow - - :returns: The created EngagementInstance - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementInstance - """ - data = values.of({'To': to, 'From': from_, 'Parameters': serialize.object(parameters), }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return EngagementInstance(self._version, payload, flow_sid=self._solution['flow_sid'], ) - - def get(self, sid): - """ - Constructs a EngagementContext - - :param sid: The SID of the Engagement resource to fetch - - :returns: twilio.rest.studio.v1.flow.engagement.EngagementContext - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementContext - """ - return EngagementContext(self._version, flow_sid=self._solution['flow_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a EngagementContext - - :param sid: The SID of the Engagement resource to fetch - - :returns: twilio.rest.studio.v1.flow.engagement.EngagementContext - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementContext - """ - return EngagementContext(self._version, flow_sid=self._solution['flow_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class EngagementPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the EngagementPage +from twilio.base.version import Version - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param flow_sid: The SID of the Flow - - :returns: twilio.rest.studio.v1.flow.engagement.EngagementPage - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementPage - """ - super(EngagementPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of EngagementInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.studio.v1.flow.engagement.EngagementInstance - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementInstance - """ - return EngagementInstance(self._version, payload, flow_sid=self._solution['flow_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.engagement.engagement_context import EngagementContextListInstancefrom twilio.rest.engagement.step import StepListInstance class EngagementContext(InstanceContext): - - def __init__(self, version, flow_sid, sid): - """ - Initialize the EngagementContext - - :param Version version: Version that contains the resource - :param flow_sid: Flow SID - :param sid: The SID of the Engagement resource to fetch - - :returns: twilio.rest.studio.v1.flow.engagement.EngagementContext - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementContext - """ - super(EngagementContext, self).__init__(version) + def __init__(self, version: Version, flow_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'flow_sid': flow_sid, 'sid': sid, } - self._uri = '/Flows/{flow_sid}/Engagements/{sid}'.format(**self._solution) - - # Dependents - self._steps = None + self._solution = { 'flow_sid': flow_sid, 'sid': sid, } + self._uri = '/Flows/${flow_sid}/Engagements/${sid}' + self._engagement_context = None - - def fetch(self): - """ - Fetch the EngagementInstance - - :returns: The fetched EngagementInstance - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return EngagementInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - sid=self._solution['sid'], - ) - + self._steps = None + def delete(self): + + + """ Deletes the EngagementInstance @@ -247,233 +49,123 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def steps(self): + + def fetch(self): + """ - Access the steps + Fetch the EngagementInstance - :returns: twilio.rest.studio.v1.flow.engagement.step.StepList - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepList + :returns: The fetched EngagementInstance + #TODO: add rtype docs """ - if self._steps is None: - self._steps = StepList( - self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['sid'], - ) - return self._steps + payload = self._version.fetch(method='GET', uri=self._uri, ) - @property - def engagement_context(self): - """ - Access the engagement_context + return EngagementInstance(self._version, payload, flow_sid=self._solution['flow_sid'], sid=self._solution['sid'], ) + - :returns: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextList - :rtype: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextList - """ - if self._engagement_context is None: - self._engagement_context = EngagementContextList( - self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['sid'], - ) - return self._engagement_context + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class EngagementInstance(InstanceResource): - - class Status(object): - ACTIVE = "active" - ENDED = "ended" - def __init__(self, version, payload, flow_sid, sid=None): - """ - Initialize the EngagementInstance - - :returns: twilio.rest.studio.v1.flow.engagement.EngagementInstance - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementInstance - """ - super(EngagementInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'flow_sid': payload.get('flow_sid'), - 'contact_sid': payload.get('contact_sid'), - 'contact_channel_address': payload.get('contact_channel_address'), - 'context': payload.get('context'), - 'status': payload.get('status'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class EngagementInstance(InstanceResource): + def __init__(self, version, payload, flow_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'flow_sid' : payload.get('flow_sid'), + 'contact_sid' : payload.get('contact_sid'), + 'contact_channel_address' : payload.get('contact_channel_address'), + 'context' : payload.get('context'), + 'status' : payload.get('status'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'flow_sid': flow_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'flow_sid': flow_sid or self._properties['flow_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: EngagementContext for this EngagementInstance - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementContext - """ if self._context is None: self._context = EngagementContext( self._version, - flow_sid=self._solution['flow_sid'], - sid=self._solution['sid'], + flow_sid=self._solution['flow_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def flow_sid(self): - """ - :returns: The SID of the Flow - :rtype: unicode - """ - return self._properties['flow_sid'] - - @property - def contact_sid(self): - """ - :returns: The SID of the Contact - :rtype: unicode - """ - return self._properties['contact_sid'] - - @property - def contact_channel_address(self): - """ - :returns: The phone number, SIP address or Client identifier that triggered this Engagement - :rtype: unicode - """ - return self._properties['contact_channel_address'] - - @property - def context(self): - """ - :returns: The current state of the execution flow - :rtype: dict - """ - return self._properties['context'] - - @property - def status(self): - """ - :returns: The status of the Engagement - :rtype: EngagementInstance.Status - """ - return self._properties['status'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the Engagement was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the Engagement was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - + def engagement_context(self): + return self._proxy.engagement_context @property - def links(self): - """ - :returns: The URLs of the Engagement's nested resources - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the EngagementInstance - - :returns: The fetched EngagementInstance - :rtype: twilio.rest.studio.v1.flow.engagement.EngagementInstance - """ - return self._proxy.fetch() + def steps(self): + return self._proxy.steps + - def delete(self): + def __repr__(self): """ - Deletes the EngagementInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.delete() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def steps(self): - """ - Access the steps - :returns: twilio.rest.studio.v1.flow.engagement.step.StepList - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepList - """ - return self._proxy.steps - @property - def engagement_context(self): - """ - Access the engagement_context +class EngagementListInstance(ListResource): + def __init__(self, version: Version, flow_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextList - :rtype: twilio.rest.studio.v1.flow.engagement.engagement_context.EngagementContextList - """ - return self._proxy.engagement_context + # Path Solution + self._solution = { 'flow_sid': flow_sid, } + self._uri = '/Flows/${flow_sid}/Engagements' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return EngagementInstance(self._version, payload, flow_sid=self._solution['flow_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return EngagementPage(self._version, payload, flow_sid=self._solution['flow_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/studio/v1/flow/engagement/step.py b/twilio/rest/studio/v1/flow/engagement/step.py deleted file mode 100644 index 9a63fe01c4..0000000000 --- a/twilio/rest/studio/v1/flow/engagement/step.py +++ /dev/null @@ -1,144 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Studio - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.step.step_context import StepContextListInstance - - -class StepContext(InstanceContext): - def __init__(self, version: Version, flow_sid: str, engagement_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'flow_sid': flow_sid, 'engagement_sid': engagement_sid, 'sid': sid, } - self._uri = '/Flows/${flow_sid}/Engagements/${engagement_sid}/Steps/${sid}' - - self._step_context = None - - def fetch(self): - - """ - Fetch the StepInstance - - :returns: The fetched StepInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return StepInstance(self._version, payload, flow_sid=self._solution['flow_sid'], engagement_sid=self._solution['engagement_sid'], sid=self._solution['sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class StepInstance(InstanceResource): - def __init__(self, version, payload, flow_sid: str, engagement_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'flow_sid' : payload.get('flow_sid'), - 'engagement_sid' : payload.get('engagement_sid'), - 'name' : payload.get('name'), - 'context' : payload.get('context'), - 'transitioned_from' : payload.get('transitioned_from'), - 'transitioned_to' : payload.get('transitioned_to'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'flow_sid': flow_sid or self._properties['flow_sid'],'engagement_sid': engagement_sid or self._properties['engagement_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = StepContext( - self._version, - flow_sid=self._solution['flow_sid'],engagement_sid=self._solution['engagement_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def step_context(self): - return self._proxy.step_context - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class StepListInstance(ListResource): - def __init__(self, version: Version, flow_sid: str, engagement_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'flow_sid': flow_sid, 'engagement_sid': engagement_sid, } - self._uri = '/Flows/${flow_sid}/Engagements/${engagement_sid}/Steps' - - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return StepPage(self._version, payload, flow_sid=self._solution['flow_sid'], engagement_sid=self._solution['engagement_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/studio/v1/flow/engagement/step/__init__.py b/twilio/rest/studio/v1/flow/engagement/step/__init__.py index 4f2ae1015a..9a63fe01c4 100644 --- a/twilio/rest/studio/v1/flow/engagement/step/__init__.py +++ b/twilio/rest/studio/v1/flow/engagement/step/__init__.py @@ -1,445 +1,144 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Studio + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.studio.v1.flow.engagement.step.step_context import StepContextList - - -class StepList(ListResource): - - def __init__(self, version, flow_sid, engagement_sid): - """ - Initialize the StepList - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - :param engagement_sid: The SID of the Engagement - - :returns: twilio.rest.studio.v1.flow.engagement.step.StepList - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepList - """ - super(StepList, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, 'engagement_sid': engagement_sid, } - self._uri = '/Flows/{flow_sid}/Engagements/{engagement_sid}/Steps'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams StepInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.studio.v1.flow.engagement.step.StepInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists StepInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.studio.v1.flow.engagement.step.StepInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of StepInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of StepInstance - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return StepPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of StepInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of StepInstance - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return StepPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a StepContext - - :param sid: The SID that identifies the resource to fetch +from twilio.base.version import Version - :returns: twilio.rest.studio.v1.flow.engagement.step.StepContext - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepContext - """ - return StepContext( - self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a StepContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.studio.v1.flow.engagement.step.StepContext - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepContext - """ - return StepContext( - self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class StepPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the StepPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param flow_sid: The SID of the Flow - :param engagement_sid: The SID of the Engagement - - :returns: twilio.rest.studio.v1.flow.engagement.step.StepPage - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepPage - """ - super(StepPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of StepInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.studio.v1.flow.engagement.step.StepInstance - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepInstance - """ - return StepInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.step.step_context import StepContextListInstance class StepContext(InstanceContext): - - def __init__(self, version, flow_sid, engagement_sid, sid): - """ - Initialize the StepContext - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - :param engagement_sid: The SID of the Engagement - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.studio.v1.flow.engagement.step.StepContext - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepContext - """ - super(StepContext, self).__init__(version) + def __init__(self, version: Version, flow_sid: str, engagement_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'flow_sid': flow_sid, 'engagement_sid': engagement_sid, 'sid': sid, } - self._uri = '/Flows/{flow_sid}/Engagements/{engagement_sid}/Steps/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'flow_sid': flow_sid, 'engagement_sid': engagement_sid, 'sid': sid, } + self._uri = '/Flows/${flow_sid}/Engagements/${engagement_sid}/Steps/${sid}' + self._step_context = None - + def fetch(self): + """ Fetch the StepInstance :returns: The fetched StepInstance - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return StepInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - sid=self._solution['sid'], - ) + return StepInstance(self._version, payload, flow_sid=self._solution['flow_sid'], engagement_sid=self._solution['engagement_sid'], sid=self._solution['sid'], ) + - @property - def step_context(self): - """ - Access the step_context - - :returns: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextList - :rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextList - """ - if self._step_context is None: - self._step_context = StepContextList( - self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - step_sid=self._solution['sid'], - ) - return self._step_context + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class StepInstance(InstanceResource): - def __init__(self, version, payload, flow_sid, engagement_sid, sid=None): - """ - Initialize the StepInstance - - :returns: twilio.rest.studio.v1.flow.engagement.step.StepInstance - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepInstance - """ - super(StepInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'flow_sid': payload.get('flow_sid'), - 'engagement_sid': payload.get('engagement_sid'), - 'name': payload.get('name'), - 'context': payload.get('context'), - 'transitioned_from': payload.get('transitioned_from'), - 'transitioned_to': payload.get('transitioned_to'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class StepInstance(InstanceResource): + def __init__(self, version, payload, flow_sid: str, engagement_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'flow_sid' : payload.get('flow_sid'), + 'engagement_sid' : payload.get('engagement_sid'), + 'name' : payload.get('name'), + 'context' : payload.get('context'), + 'transitioned_from' : payload.get('transitioned_from'), + 'transitioned_to' : payload.get('transitioned_to'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None self._solution = { - 'flow_sid': flow_sid, - 'engagement_sid': engagement_sid, - 'sid': sid or self._properties['sid'], + 'flow_sid': flow_sid or self._properties['flow_sid'],'engagement_sid': engagement_sid or self._properties['engagement_sid'],'sid': sid or self._properties['sid'], } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: StepContext for this StepInstance - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepContext - """ if self._context is None: self._context = StepContext( self._version, - flow_sid=self._solution['flow_sid'], - engagement_sid=self._solution['engagement_sid'], - sid=self._solution['sid'], + flow_sid=self._solution['flow_sid'],engagement_sid=self._solution['engagement_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def flow_sid(self): - """ - :returns: The SID of the Flow - :rtype: unicode - """ - return self._properties['flow_sid'] - - @property - def engagement_sid(self): - """ - :returns: The SID of the Engagement - :rtype: unicode - """ - return self._properties['engagement_sid'] - - @property - def name(self): - """ - :returns: The event that caused the Flow to transition to the Step - :rtype: unicode - """ - return self._properties['name'] - - @property - def context(self): - """ - :returns: The current state of the flow - :rtype: dict - """ - return self._properties['context'] - - @property - def transitioned_from(self): - """ - :returns: The Widget that preceded the Widget for the Step - :rtype: unicode - """ - return self._properties['transitioned_from'] - - @property - def transitioned_to(self): - """ - :returns: The Widget that will follow the Widget for the Step - :rtype: unicode - """ - return self._properties['transitioned_to'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] + def step_context(self): + return self._proxy.step_context + - @property - def links(self): + def __repr__(self): """ - :returns: The URLs of related resources - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['links'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the StepInstance - :returns: The fetched StepInstance - :rtype: twilio.rest.studio.v1.flow.engagement.step.StepInstance - """ - return self._proxy.fetch() - @property - def step_context(self): - """ - Access the step_context +class StepListInstance(ListResource): + def __init__(self, version: Version, flow_sid: str, engagement_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextList - :rtype: twilio.rest.studio.v1.flow.engagement.step.step_context.StepContextList - """ - return self._proxy.step_context + # Path Solution + self._solution = { 'flow_sid': flow_sid, 'engagement_sid': engagement_sid, } + self._uri = '/Flows/${flow_sid}/Engagements/${engagement_sid}/Steps' + + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return StepPage(self._version, payload, flow_sid=self._solution['flow_sid'], engagement_sid=self._solution['engagement_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/studio/v1/flow/execution.py b/twilio/rest/studio/v1/flow/execution.py deleted file mode 100644 index 73d6f2556d..0000000000 --- a/twilio/rest/studio/v1/flow/execution.py +++ /dev/null @@ -1,184 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Studio - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.execution.execution_context import ExecutionContextListInstancefrom twilio.rest.execution.execution_step import ExecutionStepListInstance - - -class ExecutionContext(InstanceContext): - def __init__(self, version: Version, flow_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'flow_sid': flow_sid, 'sid': sid, } - self._uri = '/Flows/${flow_sid}/Executions/${sid}' - - self._execution_context = None - self._steps = None - - def delete(self): - - - - """ - Deletes the ExecutionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ExecutionInstance - - :returns: The fetched ExecutionInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ExecutionInstance(InstanceResource): - def __init__(self, version, payload, flow_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'flow_sid' : payload.get('flow_sid'), - 'contact_sid' : payload.get('contact_sid'), - 'contact_channel_address' : payload.get('contact_channel_address'), - 'context' : payload.get('context'), - 'status' : payload.get('status'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'flow_sid': flow_sid or self._properties['flow_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ExecutionContext( - self._version, - flow_sid=self._solution['flow_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def execution_context(self): - return self._proxy.execution_context - @property - def steps(self): - return self._proxy.steps - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ExecutionListInstance(ListResource): - def __init__(self, version: Version, flow_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'flow_sid': flow_sid, } - self._uri = '/Flows/${flow_sid}/Executions' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid']) - - """ - - """ - def page(self, date_created_from, date_created_to, page_size): - - data = values.of({ - 'date_created_from': date_created_from,'date_created_to': date_created_to,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ExecutionPage(self._version, payload, flow_sid=self._solution['flow_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/studio/v1/flow/execution/__init__.py b/twilio/rest/studio/v1/flow/execution/__init__.py index 60bc258d76..73d6f2556d 100644 --- a/twilio/rest/studio/v1/flow/execution/__init__.py +++ b/twilio/rest/studio/v1/flow/execution/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Studio + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,258 +19,29 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.studio.v1.flow.execution.execution_context import ExecutionContextList -from twilio.rest.studio.v1.flow.execution.execution_step import ExecutionStepList - - -class ExecutionList(ListResource): - - def __init__(self, version, flow_sid): - """ - Initialize the ExecutionList - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - - :returns: twilio.rest.studio.v1.flow.execution.ExecutionList - :rtype: twilio.rest.studio.v1.flow.execution.ExecutionList - """ - super(ExecutionList, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, } - self._uri = '/Flows/{flow_sid}/Executions'.format(**self._solution) - - def stream(self, date_created_from=values.unset, date_created_to=values.unset, - limit=None, page_size=None): - """ - Streams ExecutionInstance 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 datetime date_created_from: Only show Executions that started on or after this ISO 8601 date-time - :param datetime date_created_to: Only show Executions that started before this ISO 8601 date-time - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.studio.v1.flow.execution.ExecutionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - date_created_from=date_created_from, - date_created_to=date_created_to, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, date_created_from=values.unset, date_created_to=values.unset, - limit=None, page_size=None): - """ - Lists ExecutionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param datetime date_created_from: Only show Executions that started on or after this ISO 8601 date-time - :param datetime date_created_to: Only show Executions that started before this ISO 8601 date-time - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.studio.v1.flow.execution.ExecutionInstance] - """ - return list(self.stream( - date_created_from=date_created_from, - date_created_to=date_created_to, - limit=limit, - page_size=page_size, - )) - - def page(self, date_created_from=values.unset, date_created_to=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ExecutionInstance records from the API. - Request is executed immediately - - :param datetime date_created_from: Only show Executions that started on or after this ISO 8601 date-time - :param datetime date_created_to: Only show Executions that started before this ISO 8601 date-time - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ExecutionInstance - :rtype: twilio.rest.studio.v1.flow.execution.ExecutionPage - """ - data = values.of({ - 'DateCreatedFrom': serialize.iso8601_datetime(date_created_from), - 'DateCreatedTo': serialize.iso8601_datetime(date_created_to), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ExecutionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ExecutionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ExecutionInstance - :rtype: twilio.rest.studio.v1.flow.execution.ExecutionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ExecutionPage(self._version, response, self._solution) - - def create(self, to, from_, parameters=values.unset): - """ - Create the ExecutionInstance - - :param unicode to: The Contact phone number to start a Studio Flow Execution - :param unicode from_: The Twilio phone number or Messaging Service SID to send messages or initiate calls from during the Flow Execution - :param dict parameters: JSON data that will be added to the Flow's context - - :returns: The created ExecutionInstance - :rtype: twilio.rest.studio.v1.flow.execution.ExecutionInstance - """ - data = values.of({'To': to, 'From': from_, 'Parameters': serialize.object(parameters), }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid'], ) - - def get(self, sid): - """ - Constructs a ExecutionContext - - :param sid: The SID of the Execution resource to fetch - - :returns: twilio.rest.studio.v1.flow.execution.ExecutionContext - :rtype: twilio.rest.studio.v1.flow.execution.ExecutionContext - """ - return ExecutionContext(self._version, flow_sid=self._solution['flow_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ExecutionContext - - :param sid: The SID of the Execution resource to fetch - - :returns: twilio.rest.studio.v1.flow.execution.ExecutionContext - :rtype: twilio.rest.studio.v1.flow.execution.ExecutionContext - """ - return ExecutionContext(self._version, flow_sid=self._solution['flow_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ExecutionPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ExecutionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param flow_sid: The SID of the Flow - - :returns: twilio.rest.studio.v1.flow.execution.ExecutionPage - :rtype: twilio.rest.studio.v1.flow.execution.ExecutionPage - """ - super(ExecutionPage, self).__init__(version, response) +from twilio.base.version import Version - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ExecutionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.studio.v1.flow.execution.ExecutionInstance - :rtype: twilio.rest.studio.v1.flow.execution.ExecutionInstance - """ - return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.execution.execution_context import ExecutionContextListInstancefrom twilio.rest.execution.execution_step import ExecutionStepListInstance class ExecutionContext(InstanceContext): - - def __init__(self, version, flow_sid, sid): - """ - Initialize the ExecutionContext - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - :param sid: The SID of the Execution resource to fetch - - :returns: twilio.rest.studio.v1.flow.execution.ExecutionContext - :rtype: twilio.rest.studio.v1.flow.execution.ExecutionContext - """ - super(ExecutionContext, self).__init__(version) + def __init__(self, version: Version, flow_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'flow_sid': flow_sid, 'sid': sid, } - self._uri = '/Flows/{flow_sid}/Executions/{sid}'.format(**self._solution) - - # Dependents - self._steps = None + self._solution = { 'flow_sid': flow_sid, 'sid': sid, } + self._uri = '/Flows/${flow_sid}/Executions/${sid}' + self._execution_context = None - - def fetch(self): - """ - Fetch the ExecutionInstance - - :returns: The fetched ExecutionInstance - :rtype: twilio.rest.studio.v1.flow.execution.ExecutionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ExecutionInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - sid=self._solution['sid'], - ) - + self._steps = None + def delete(self): + + + """ Deletes the ExecutionInstance @@ -271,264 +49,136 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, status): + + def fetch(self): + """ - Update the ExecutionInstance - - :param ExecutionInstance.Status status: The status of the Execution + Fetch the ExecutionInstance - :returns: The updated ExecutionInstance - :rtype: twilio.rest.studio.v1.flow.execution.ExecutionInstance + :returns: The fetched ExecutionInstance + #TODO: add rtype docs """ - data = values.of({'Status': status, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.fetch(method='GET', uri=self._uri, ) - return ExecutionInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - sid=self._solution['sid'], - ) + return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid'], sid=self._solution['sid'], ) + - @property - def steps(self): - """ - Access the steps + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepList - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepList - """ - if self._steps is None: - self._steps = ExecutionStepList( - self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['sid'], - ) - return self._steps + payload = self._version.update(method='post', uri=self._uri, data=data, ) - @property - def execution_context(self): - """ - Access the execution_context + return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid'], sid=self._solution['sid'], ) + + - :returns: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextList - :rtype: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextList - """ - if self._execution_context is None: - self._execution_context = ExecutionContextList( - self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['sid'], - ) - return self._execution_context + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ExecutionInstance(InstanceResource): - - class Status(object): - ACTIVE = "active" - ENDED = "ended" - def __init__(self, version, payload, flow_sid, sid=None): - """ - Initialize the ExecutionInstance - - :returns: twilio.rest.studio.v1.flow.execution.ExecutionInstance - :rtype: twilio.rest.studio.v1.flow.execution.ExecutionInstance - """ - super(ExecutionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'flow_sid': payload.get('flow_sid'), - 'contact_sid': payload.get('contact_sid'), - 'contact_channel_address': payload.get('contact_channel_address'), - 'context': payload.get('context'), - 'status': payload.get('status'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ExecutionInstance(InstanceResource): + def __init__(self, version, payload, flow_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'flow_sid' : payload.get('flow_sid'), + 'contact_sid' : payload.get('contact_sid'), + 'contact_channel_address' : payload.get('contact_channel_address'), + 'context' : payload.get('context'), + 'status' : payload.get('status'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'flow_sid': flow_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'flow_sid': flow_sid or self._properties['flow_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ExecutionContext for this ExecutionInstance - :rtype: twilio.rest.studio.v1.flow.execution.ExecutionContext - """ if self._context is None: self._context = ExecutionContext( self._version, - flow_sid=self._solution['flow_sid'], - sid=self._solution['sid'], + flow_sid=self._solution['flow_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def flow_sid(self): - """ - :returns: The SID of the Flow - :rtype: unicode - """ - return self._properties['flow_sid'] - - @property - def contact_sid(self): - """ - :returns: The SID of the Contact - :rtype: unicode - """ - return self._properties['contact_sid'] - - @property - def contact_channel_address(self): - """ - :returns: The phone number, SIP address or Client identifier that triggered the Execution - :rtype: unicode - """ - return self._properties['contact_channel_address'] - - @property - def context(self): - """ - :returns: The current state of the flow - :rtype: dict - """ - return self._properties['context'] - - @property - def status(self): - """ - :returns: The status of the Execution - :rtype: ExecutionInstance.Status - """ - return self._properties['status'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - + def execution_context(self): + return self._proxy.execution_context @property - def links(self): - """ - :returns: Nested resource URLs - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the ExecutionInstance + def steps(self): + return self._proxy.steps + - :returns: The fetched ExecutionInstance - :rtype: twilio.rest.studio.v1.flow.execution.ExecutionInstance + def __repr__(self): """ - return self._proxy.fetch() - - def delete(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the ExecutionInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def update(self, status): - """ - Update the ExecutionInstance - :param ExecutionInstance.Status status: The status of the Execution +class ExecutionListInstance(ListResource): + def __init__(self, version: Version, flow_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The updated ExecutionInstance - :rtype: twilio.rest.studio.v1.flow.execution.ExecutionInstance - """ - return self._proxy.update(status, ) + # Path Solution + self._solution = { 'flow_sid': flow_sid, } + self._uri = '/Flows/${flow_sid}/Executions' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def steps(self): - """ - Access the steps + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepList - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepList - """ - return self._proxy.steps + return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid']) + + """ + + """ + def page(self, date_created_from, date_created_to, page_size): + + data = values.of({ + 'date_created_from': date_created_from,'date_created_to': date_created_to,'page_size': page_size, + }) - @property - def execution_context(self): - """ - Access the execution_context + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextList - :rtype: twilio.rest.studio.v1.flow.execution.execution_context.ExecutionContextList - """ - return self._proxy.execution_context + return ExecutionPage(self._version, payload, flow_sid=self._solution['flow_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/studio/v1/flow/execution/execution_step.py b/twilio/rest/studio/v1/flow/execution/execution_step.py deleted file mode 100644 index 3ac50d6eb9..0000000000 --- a/twilio/rest/studio/v1/flow/execution/execution_step.py +++ /dev/null @@ -1,144 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Studio - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.execution_step.execution_step_context import ExecutionStepContextListInstance - - -class ExecutionStepContext(InstanceContext): - def __init__(self, version: Version, flow_sid: str, execution_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'flow_sid': flow_sid, 'execution_sid': execution_sid, 'sid': sid, } - self._uri = '/Flows/${flow_sid}/Executions/${execution_sid}/Steps/${sid}' - - self._step_context = None - - def fetch(self): - - """ - Fetch the ExecutionStepInstance - - :returns: The fetched ExecutionStepInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ExecutionStepInstance(self._version, payload, flow_sid=self._solution['flow_sid'], execution_sid=self._solution['execution_sid'], sid=self._solution['sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ExecutionStepInstance(InstanceResource): - def __init__(self, version, payload, flow_sid: str, execution_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'flow_sid' : payload.get('flow_sid'), - 'execution_sid' : payload.get('execution_sid'), - 'name' : payload.get('name'), - 'context' : payload.get('context'), - 'transitioned_from' : payload.get('transitioned_from'), - 'transitioned_to' : payload.get('transitioned_to'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'flow_sid': flow_sid or self._properties['flow_sid'],'execution_sid': execution_sid or self._properties['execution_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ExecutionStepContext( - self._version, - flow_sid=self._solution['flow_sid'],execution_sid=self._solution['execution_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def step_context(self): - return self._proxy.step_context - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ExecutionStepListInstance(ListResource): - def __init__(self, version: Version, flow_sid: str, execution_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'flow_sid': flow_sid, 'execution_sid': execution_sid, } - self._uri = '/Flows/${flow_sid}/Executions/${execution_sid}/Steps' - - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ExecutionStepPage(self._version, payload, flow_sid=self._solution['flow_sid'], execution_sid=self._solution['execution_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py b/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py index e39b958071..3ac50d6eb9 100644 --- a/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py +++ b/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py @@ -1,445 +1,144 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Studio + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context import ExecutionStepContextList - - -class ExecutionStepList(ListResource): - - def __init__(self, version, flow_sid, execution_sid): - """ - Initialize the ExecutionStepList - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - :param execution_sid: The SID of the Execution - - :returns: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepList - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepList - """ - super(ExecutionStepList, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, 'execution_sid': execution_sid, } - self._uri = '/Flows/{flow_sid}/Executions/{execution_sid}/Steps'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams ExecutionStepInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ExecutionStepInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ExecutionStepInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ExecutionStepInstance - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ExecutionStepPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ExecutionStepInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ExecutionStepInstance - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ExecutionStepPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ExecutionStepContext - - :param sid: The unique string that identifies the resource +from twilio.base.version import Version - :returns: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepContext - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepContext - """ - return ExecutionStepContext( - self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a ExecutionStepContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepContext - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepContext - """ - return ExecutionStepContext( - self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ExecutionStepPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ExecutionStepPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param flow_sid: The SID of the Flow - :param execution_sid: The SID of the Execution - - :returns: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepPage - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepPage - """ - super(ExecutionStepPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ExecutionStepInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepInstance - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepInstance - """ - return ExecutionStepInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.execution_step.execution_step_context import ExecutionStepContextListInstance class ExecutionStepContext(InstanceContext): - - def __init__(self, version, flow_sid, execution_sid, sid): - """ - Initialize the ExecutionStepContext - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - :param execution_sid: The SID of the Execution - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepContext - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepContext - """ - super(ExecutionStepContext, self).__init__(version) + def __init__(self, version: Version, flow_sid: str, execution_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'flow_sid': flow_sid, 'execution_sid': execution_sid, 'sid': sid, } - self._uri = '/Flows/{flow_sid}/Executions/{execution_sid}/Steps/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'flow_sid': flow_sid, 'execution_sid': execution_sid, 'sid': sid, } + self._uri = '/Flows/${flow_sid}/Executions/${execution_sid}/Steps/${sid}' + self._step_context = None - + def fetch(self): + """ Fetch the ExecutionStepInstance :returns: The fetched ExecutionStepInstance - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return ExecutionStepInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - sid=self._solution['sid'], - ) + return ExecutionStepInstance(self._version, payload, flow_sid=self._solution['flow_sid'], execution_sid=self._solution['execution_sid'], sid=self._solution['sid'], ) + - @property - def step_context(self): - """ - Access the step_context - - :returns: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextList - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextList - """ - if self._step_context is None: - self._step_context = ExecutionStepContextList( - self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - step_sid=self._solution['sid'], - ) - return self._step_context + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ExecutionStepInstance(InstanceResource): - def __init__(self, version, payload, flow_sid, execution_sid, sid=None): - """ - Initialize the ExecutionStepInstance - - :returns: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepInstance - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepInstance - """ - super(ExecutionStepInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'flow_sid': payload.get('flow_sid'), - 'execution_sid': payload.get('execution_sid'), - 'name': payload.get('name'), - 'context': payload.get('context'), - 'transitioned_from': payload.get('transitioned_from'), - 'transitioned_to': payload.get('transitioned_to'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ExecutionStepInstance(InstanceResource): + def __init__(self, version, payload, flow_sid: str, execution_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'flow_sid' : payload.get('flow_sid'), + 'execution_sid' : payload.get('execution_sid'), + 'name' : payload.get('name'), + 'context' : payload.get('context'), + 'transitioned_from' : payload.get('transitioned_from'), + 'transitioned_to' : payload.get('transitioned_to'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None self._solution = { - 'flow_sid': flow_sid, - 'execution_sid': execution_sid, - 'sid': sid or self._properties['sid'], + 'flow_sid': flow_sid or self._properties['flow_sid'],'execution_sid': execution_sid or self._properties['execution_sid'],'sid': sid or self._properties['sid'], } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ExecutionStepContext for this ExecutionStepInstance - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepContext - """ if self._context is None: self._context = ExecutionStepContext( self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - sid=self._solution['sid'], + flow_sid=self._solution['flow_sid'],execution_sid=self._solution['execution_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def flow_sid(self): - """ - :returns: The SID of the Flow - :rtype: unicode - """ - return self._properties['flow_sid'] - - @property - def execution_sid(self): - """ - :returns: The SID of the Execution - :rtype: unicode - """ - return self._properties['execution_sid'] - - @property - def name(self): - """ - :returns: The event that caused the Flow to transition to the Step - :rtype: unicode - """ - return self._properties['name'] - - @property - def context(self): - """ - :returns: The current state of the flow - :rtype: dict - """ - return self._properties['context'] - - @property - def transitioned_from(self): - """ - :returns: The Widget that preceded the Widget for the Step - :rtype: unicode - """ - return self._properties['transitioned_from'] - - @property - def transitioned_to(self): - """ - :returns: The Widget that will follow the Widget for the Step - :rtype: unicode - """ - return self._properties['transitioned_to'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] + def step_context(self): + return self._proxy.step_context + - @property - def links(self): + def __repr__(self): """ - :returns: The URLs of related resources - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['links'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the ExecutionStepInstance - :returns: The fetched ExecutionStepInstance - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.ExecutionStepInstance - """ - return self._proxy.fetch() - @property - def step_context(self): - """ - Access the step_context +class ExecutionStepListInstance(ListResource): + def __init__(self, version: Version, flow_sid: str, execution_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextList - :rtype: twilio.rest.studio.v1.flow.execution.execution_step.execution_step_context.ExecutionStepContextList - """ - return self._proxy.step_context + # Path Solution + self._solution = { 'flow_sid': flow_sid, 'execution_sid': execution_sid, } + self._uri = '/Flows/${flow_sid}/Executions/${execution_sid}/Steps' + + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ExecutionStepPage(self._version, payload, flow_sid=self._solution['flow_sid'], execution_sid=self._solution['execution_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/studio/v2/flow.py b/twilio/rest/studio/v2/flow.py deleted file mode 100644 index 7fa2f3ee1c..0000000000 --- a/twilio/rest/studio/v2/flow.py +++ /dev/null @@ -1,192 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Studio - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.flow.execution import ExecutionListInstancefrom twilio.rest.flow.flow_revision import FlowRevisionListInstancefrom twilio.rest.flow.flow_test_user import FlowTestUserListInstance - - -class FlowContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Flows/${sid}' - - self._executions = None - self._revisions = None - self._test_users = None - - def delete(self): - - - - """ - Deletes the FlowInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the FlowInstance - - :returns: The fetched FlowInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FlowInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return FlowInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class FlowInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'definition' : payload.get('definition'), - 'status' : payload.get('status'), - 'revision' : payload.get('revision'), - 'commit_message' : payload.get('commit_message'), - 'valid' : payload.get('valid'), - 'errors' : payload.get('errors'), - 'warnings' : payload.get('warnings'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'webhook_url' : payload.get('webhook_url'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = FlowContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def executions(self): - return self._proxy.executions - @property - def revisions(self): - return self._proxy.revisions - @property - def test_users(self): - return self._proxy.test_users - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class FlowListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Flows' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return FlowInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return FlowPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/studio/v2/flow/__init__.py b/twilio/rest/studio/v2/flow/__init__.py index 1a9d97422e..7fa2f3ee1c 100644 --- a/twilio/rest/studio/v2/flow/__init__.py +++ b/twilio/rest/studio/v2/flow/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Studio + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,559 +19,174 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.studio.v2.flow.execution import ExecutionList -from twilio.rest.studio.v2.flow.flow_revision import FlowRevisionList -from twilio.rest.studio.v2.flow.test_user import FlowTestUserList - - -class FlowList(ListResource): - - def __init__(self, version): - """ - Initialize the FlowList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.studio.v2.flow.FlowList - :rtype: twilio.rest.studio.v2.flow.FlowList - """ - super(FlowList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Flows'.format(**self._solution) - - def create(self, friendly_name, status, definition, - commit_message=values.unset): - """ - Create the FlowInstance - - :param unicode friendly_name: The string that you assigned to describe the Flow - :param FlowInstance.Status status: The status of the Flow - :param dict definition: JSON representation of flow definition - :param unicode commit_message: Description of change made in the revision - - :returns: The created FlowInstance - :rtype: twilio.rest.studio.v2.flow.FlowInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Status': status, - 'Definition': serialize.object(definition), - 'CommitMessage': commit_message, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return FlowInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams FlowInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.studio.v2.flow.FlowInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists FlowInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.studio.v2.flow.FlowInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of FlowInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of FlowInstance - :rtype: twilio.rest.studio.v2.flow.FlowPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return FlowPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of FlowInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of FlowInstance - :rtype: twilio.rest.studio.v2.flow.FlowPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return FlowPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a FlowContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.studio.v2.flow.FlowContext - :rtype: twilio.rest.studio.v2.flow.FlowContext - """ - return FlowContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a FlowContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.studio.v2.flow.FlowContext - :rtype: twilio.rest.studio.v2.flow.FlowContext - """ - return FlowContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base.version import Version +from twilio.base.page import Page -class FlowPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the FlowPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.studio.v2.flow.FlowPage - :rtype: twilio.rest.studio.v2.flow.FlowPage - """ - super(FlowPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FlowInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.studio.v2.flow.FlowInstance - :rtype: twilio.rest.studio.v2.flow.FlowInstance - """ - return FlowInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.flow.execution import ExecutionListInstancefrom twilio.rest.flow.flow_revision import FlowRevisionListInstancefrom twilio.rest.flow.flow_test_user import FlowTestUserListInstance class FlowContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the FlowContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.studio.v2.flow.FlowContext - :rtype: twilio.rest.studio.v2.flow.FlowContext - """ - super(FlowContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Flows/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Flows/${sid}' + + self._executions = None self._revisions = None self._test_users = None - self._executions = None + + def delete(self): + + - def update(self, status, friendly_name=values.unset, definition=values.unset, - commit_message=values.unset): """ - Update the FlowInstance - - :param FlowInstance.Status status: The status of the Flow - :param unicode friendly_name: The string that you assigned to describe the Flow - :param dict definition: JSON representation of flow definition - :param unicode commit_message: Description of change made in the revision + Deletes the FlowInstance - :returns: The updated FlowInstance - :rtype: twilio.rest.studio.v2.flow.FlowInstance + :returns: True if delete succeeds, False otherwise + :rtype: bool """ - data = values.of({ - 'Status': status, - 'FriendlyName': friendly_name, - 'Definition': serialize.object(definition), - 'CommitMessage': commit_message, - }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return FlowInstance(self._version, payload, sid=self._solution['sid'], ) - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the FlowInstance :returns: The fetched FlowInstance - :rtype: twilio.rest.studio.v2.flow.FlowInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return FlowInstance(self._version, payload, sid=self._solution['sid'], ) + - def delete(self): - """ - Deletes the FlowInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def revisions(self): - """ - Access the revisions - - :returns: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionList - :rtype: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionList - """ - if self._revisions is None: - self._revisions = FlowRevisionList(self._version, sid=self._solution['sid'], ) - return self._revisions - - @property - def test_users(self): - """ - Access the test_users + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: twilio.rest.studio.v2.flow.test_user.FlowTestUserList - :rtype: twilio.rest.studio.v2.flow.test_user.FlowTestUserList - """ - if self._test_users is None: - self._test_users = FlowTestUserList(self._version, sid=self._solution['sid'], ) - return self._test_users + payload = self._version.update(method='post', uri=self._uri, data=data, ) - @property - def executions(self): - """ - Access the executions + return FlowInstance(self._version, payload, sid=self._solution['sid'], ) + + - :returns: twilio.rest.studio.v2.flow.execution.ExecutionList - :rtype: twilio.rest.studio.v2.flow.execution.ExecutionList - """ - if self._executions is None: - self._executions = ExecutionList(self._version, flow_sid=self._solution['sid'], ) - return self._executions + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class FlowInstance(InstanceResource): - - class Status(object): - DRAFT = "draft" - PUBLISHED = "published" - - def __init__(self, version, payload, sid=None): - """ - Initialize the FlowInstance - :returns: twilio.rest.studio.v2.flow.FlowInstance - :rtype: twilio.rest.studio.v2.flow.FlowInstance - """ - super(FlowInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'definition': payload.get('definition'), - 'status': payload.get('status'), - 'revision': deserialize.integer(payload.get('revision')), - 'commit_message': payload.get('commit_message'), - 'valid': payload.get('valid'), - 'errors': payload.get('errors'), - 'warnings': payload.get('warnings'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'webhook_url': payload.get('webhook_url'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class FlowInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'definition' : payload.get('definition'), + 'status' : payload.get('status'), + 'revision' : payload.get('revision'), + 'commit_message' : payload.get('commit_message'), + 'valid' : payload.get('valid'), + 'errors' : payload.get('errors'), + 'warnings' : payload.get('warnings'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'webhook_url' : payload.get('webhook_url'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FlowContext for this FlowInstance - :rtype: twilio.rest.studio.v2.flow.FlowContext - """ if self._context is None: - self._context = FlowContext(self._version, sid=self._solution['sid'], ) + self._context = FlowContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the Flow - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def definition(self): - """ - :returns: JSON representation of flow definition - :rtype: dict - """ - return self._properties['definition'] - - @property - def status(self): - """ - :returns: The status of the Flow - :rtype: FlowInstance.Status - """ - return self._properties['status'] - - @property - def revision(self): - """ - :returns: The latest revision number of the Flow's definition - :rtype: unicode - """ - return self._properties['revision'] - - @property - def commit_message(self): - """ - :returns: Description of change made in the revision - :rtype: unicode - """ - return self._properties['commit_message'] - - @property - def valid(self): - """ - :returns: Boolean if the flow definition is valid - :rtype: bool - """ - return self._properties['valid'] - - @property - def errors(self): - """ - :returns: List of error in the flow definition - :rtype: list[dict] - """ - return self._properties['errors'] - - @property - def warnings(self): - """ - :returns: List of warnings in the flow definition - :rtype: list[dict] - """ - return self._properties['warnings'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def webhook_url(self): - """ - :returns: The webhook_url - :rtype: unicode - """ - return self._properties['webhook_url'] - + def executions(self): + return self._proxy.executions @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - + def revisions(self): + return self._proxy.revisions @property - def links(self): - """ - :returns: Nested resource URLs - :rtype: unicode - """ - return self._properties['links'] - - def update(self, status, friendly_name=values.unset, definition=values.unset, - commit_message=values.unset): - """ - Update the FlowInstance - - :param FlowInstance.Status status: The status of the Flow - :param unicode friendly_name: The string that you assigned to describe the Flow - :param dict definition: JSON representation of flow definition - :param unicode commit_message: Description of change made in the revision - - :returns: The updated FlowInstance - :rtype: twilio.rest.studio.v2.flow.FlowInstance - """ - return self._proxy.update( - status, - friendly_name=friendly_name, - definition=definition, - commit_message=commit_message, - ) + def test_users(self): + return self._proxy.test_users + - def fetch(self): + def __repr__(self): """ - Fetch the FlowInstance - - :returns: The fetched FlowInstance - :rtype: twilio.rest.studio.v2.flow.FlowInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the FlowInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - @property - def revisions(self): - """ - Access the revisions +class FlowListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionList - :rtype: twilio.rest.studio.v2.flow.flow_revision.FlowRevisionList - """ - return self._proxy.revisions + # Path Solution + self._solution = { } + self._uri = '/Flows' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def test_users(self): - """ - Access the test_users + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.studio.v2.flow.test_user.FlowTestUserList - :rtype: twilio.rest.studio.v2.flow.test_user.FlowTestUserList - """ - return self._proxy.test_users + return FlowInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def executions(self): - """ - Access the executions + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.studio.v2.flow.execution.ExecutionList - :rtype: twilio.rest.studio.v2.flow.execution.ExecutionList - """ - return self._proxy.executions + return FlowPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/studio/v2/flow/execution.py b/twilio/rest/studio/v2/flow/execution.py deleted file mode 100644 index 93912744de..0000000000 --- a/twilio/rest/studio/v2/flow/execution.py +++ /dev/null @@ -1,183 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Studio - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.execution.execution_context import ExecutionContextListInstancefrom twilio.rest.execution.execution_step import ExecutionStepListInstance - - -class ExecutionContext(InstanceContext): - def __init__(self, version: Version, flow_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'flow_sid': flow_sid, 'sid': sid, } - self._uri = '/Flows/${flow_sid}/Executions/${sid}' - - self._execution_context = None - self._steps = None - - def delete(self): - - - - """ - Deletes the ExecutionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ExecutionInstance - - :returns: The fetched ExecutionInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ExecutionInstance(InstanceResource): - def __init__(self, version, payload, flow_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'flow_sid' : payload.get('flow_sid'), - 'contact_channel_address' : payload.get('contact_channel_address'), - 'context' : payload.get('context'), - 'status' : payload.get('status'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'flow_sid': flow_sid or self._properties['flow_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ExecutionContext( - self._version, - flow_sid=self._solution['flow_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def execution_context(self): - return self._proxy.execution_context - @property - def steps(self): - return self._proxy.steps - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ExecutionListInstance(ListResource): - def __init__(self, version: Version, flow_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'flow_sid': flow_sid, } - self._uri = '/Flows/${flow_sid}/Executions' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid']) - - """ - - """ - def page(self, date_created_from, date_created_to, page_size): - - data = values.of({ - 'date_created_from': date_created_from,'date_created_to': date_created_to,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ExecutionPage(self._version, payload, flow_sid=self._solution['flow_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/studio/v2/flow/execution/__init__.py b/twilio/rest/studio/v2/flow/execution/__init__.py index 194bb18fcb..93912744de 100644 --- a/twilio/rest/studio/v2/flow/execution/__init__.py +++ b/twilio/rest/studio/v2/flow/execution/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Studio + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,258 +19,29 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.studio.v2.flow.execution.execution_context import ExecutionContextList -from twilio.rest.studio.v2.flow.execution.execution_step import ExecutionStepList - - -class ExecutionList(ListResource): - - def __init__(self, version, flow_sid): - """ - Initialize the ExecutionList - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - - :returns: twilio.rest.studio.v2.flow.execution.ExecutionList - :rtype: twilio.rest.studio.v2.flow.execution.ExecutionList - """ - super(ExecutionList, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, } - self._uri = '/Flows/{flow_sid}/Executions'.format(**self._solution) - - def stream(self, date_created_from=values.unset, date_created_to=values.unset, - limit=None, page_size=None): - """ - Streams ExecutionInstance 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 datetime date_created_from: Only show Executions that started on or after this ISO 8601 date-time - :param datetime date_created_to: Only show Executions that started before this ISO 8601 date-time - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.studio.v2.flow.execution.ExecutionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - date_created_from=date_created_from, - date_created_to=date_created_to, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, date_created_from=values.unset, date_created_to=values.unset, - limit=None, page_size=None): - """ - Lists ExecutionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param datetime date_created_from: Only show Executions that started on or after this ISO 8601 date-time - :param datetime date_created_to: Only show Executions that started before this ISO 8601 date-time - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.studio.v2.flow.execution.ExecutionInstance] - """ - return list(self.stream( - date_created_from=date_created_from, - date_created_to=date_created_to, - limit=limit, - page_size=page_size, - )) - - def page(self, date_created_from=values.unset, date_created_to=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ExecutionInstance records from the API. - Request is executed immediately - - :param datetime date_created_from: Only show Executions that started on or after this ISO 8601 date-time - :param datetime date_created_to: Only show Executions that started before this ISO 8601 date-time - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ExecutionInstance - :rtype: twilio.rest.studio.v2.flow.execution.ExecutionPage - """ - data = values.of({ - 'DateCreatedFrom': serialize.iso8601_datetime(date_created_from), - 'DateCreatedTo': serialize.iso8601_datetime(date_created_to), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ExecutionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ExecutionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ExecutionInstance - :rtype: twilio.rest.studio.v2.flow.execution.ExecutionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ExecutionPage(self._version, response, self._solution) - - def create(self, to, from_, parameters=values.unset): - """ - Create the ExecutionInstance - - :param unicode to: The Contact phone number to start a Studio Flow Execution - :param unicode from_: The Twilio phone number or Messaging Service SID to send messages or initiate calls from during the Flow Execution - :param dict parameters: JSON data that will be added to the Flow's context - - :returns: The created ExecutionInstance - :rtype: twilio.rest.studio.v2.flow.execution.ExecutionInstance - """ - data = values.of({'To': to, 'From': from_, 'Parameters': serialize.object(parameters), }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid'], ) - - def get(self, sid): - """ - Constructs a ExecutionContext - - :param sid: The SID of the Execution resource to fetch - - :returns: twilio.rest.studio.v2.flow.execution.ExecutionContext - :rtype: twilio.rest.studio.v2.flow.execution.ExecutionContext - """ - return ExecutionContext(self._version, flow_sid=self._solution['flow_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ExecutionContext - - :param sid: The SID of the Execution resource to fetch - - :returns: twilio.rest.studio.v2.flow.execution.ExecutionContext - :rtype: twilio.rest.studio.v2.flow.execution.ExecutionContext - """ - return ExecutionContext(self._version, flow_sid=self._solution['flow_sid'], sid=sid, ) +from twilio.base.version import Version - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ExecutionPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ExecutionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param flow_sid: The SID of the Flow - - :returns: twilio.rest.studio.v2.flow.execution.ExecutionPage - :rtype: twilio.rest.studio.v2.flow.execution.ExecutionPage - """ - super(ExecutionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ExecutionInstance +from twilio.base.page import Page - :param dict payload: Payload response from the API - - :returns: twilio.rest.studio.v2.flow.execution.ExecutionInstance - :rtype: twilio.rest.studio.v2.flow.execution.ExecutionInstance - """ - return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.execution.execution_context import ExecutionContextListInstancefrom twilio.rest.execution.execution_step import ExecutionStepListInstance class ExecutionContext(InstanceContext): - - def __init__(self, version, flow_sid, sid): - """ - Initialize the ExecutionContext - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - :param sid: The SID of the Execution resource to fetch - - :returns: twilio.rest.studio.v2.flow.execution.ExecutionContext - :rtype: twilio.rest.studio.v2.flow.execution.ExecutionContext - """ - super(ExecutionContext, self).__init__(version) + def __init__(self, version: Version, flow_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'flow_sid': flow_sid, 'sid': sid, } - self._uri = '/Flows/{flow_sid}/Executions/{sid}'.format(**self._solution) - - # Dependents - self._steps = None + self._solution = { 'flow_sid': flow_sid, 'sid': sid, } + self._uri = '/Flows/${flow_sid}/Executions/${sid}' + self._execution_context = None - - def fetch(self): - """ - Fetch the ExecutionInstance - - :returns: The fetched ExecutionInstance - :rtype: twilio.rest.studio.v2.flow.execution.ExecutionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ExecutionInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - sid=self._solution['sid'], - ) - + self._steps = None + def delete(self): + + + """ Deletes the ExecutionInstance @@ -271,255 +49,135 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, status): + + def fetch(self): + """ - Update the ExecutionInstance - - :param ExecutionInstance.Status status: The status of the Execution + Fetch the ExecutionInstance - :returns: The updated ExecutionInstance - :rtype: twilio.rest.studio.v2.flow.execution.ExecutionInstance + :returns: The fetched ExecutionInstance + #TODO: add rtype docs """ - data = values.of({'Status': status, }) + payload = self._version.fetch(method='GET', uri=self._uri, ) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid'], sid=self._solution['sid'], ) + - return ExecutionInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - sid=self._solution['sid'], - ) + + + def update(self, body): + data = values.of({ + 'body': body, + }) - @property - def steps(self): - """ - Access the steps + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepList - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepList - """ - if self._steps is None: - self._steps = ExecutionStepList( - self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['sid'], - ) - return self._steps + return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid'], sid=self._solution['sid'], ) + + - @property - def execution_context(self): - """ - Access the execution_context - - :returns: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextList - :rtype: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextList - """ - if self._execution_context is None: - self._execution_context = ExecutionContextList( - self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['sid'], - ) - return self._execution_context + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ExecutionInstance(InstanceResource): - - class Status(object): - ACTIVE = "active" - ENDED = "ended" - def __init__(self, version, payload, flow_sid, sid=None): - """ - Initialize the ExecutionInstance - - :returns: twilio.rest.studio.v2.flow.execution.ExecutionInstance - :rtype: twilio.rest.studio.v2.flow.execution.ExecutionInstance - """ - super(ExecutionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'flow_sid': payload.get('flow_sid'), - 'contact_channel_address': payload.get('contact_channel_address'), - 'context': payload.get('context'), - 'status': payload.get('status'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ExecutionInstance(InstanceResource): + def __init__(self, version, payload, flow_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'flow_sid' : payload.get('flow_sid'), + 'contact_channel_address' : payload.get('contact_channel_address'), + 'context' : payload.get('context'), + 'status' : payload.get('status'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'flow_sid': flow_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'flow_sid': flow_sid or self._properties['flow_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ExecutionContext for this ExecutionInstance - :rtype: twilio.rest.studio.v2.flow.execution.ExecutionContext - """ if self._context is None: self._context = ExecutionContext( self._version, - flow_sid=self._solution['flow_sid'], - sid=self._solution['sid'], + flow_sid=self._solution['flow_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def flow_sid(self): - """ - :returns: The SID of the Flow - :rtype: unicode - """ - return self._properties['flow_sid'] - - @property - def contact_channel_address(self): - """ - :returns: The phone number, SIP address or Client identifier that triggered the Execution - :rtype: unicode - """ - return self._properties['contact_channel_address'] - - @property - def context(self): - """ - :returns: The current state of the flow - :rtype: dict - """ - return self._properties['context'] - - @property - def status(self): - """ - :returns: The status of the Execution - :rtype: ExecutionInstance.Status - """ - return self._properties['status'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - + def execution_context(self): + return self._proxy.execution_context @property - def links(self): - """ - :returns: Nested resource URLs - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the ExecutionInstance + def steps(self): + return self._proxy.steps + - :returns: The fetched ExecutionInstance - :rtype: twilio.rest.studio.v2.flow.execution.ExecutionInstance + def __repr__(self): """ - return self._proxy.fetch() - - def delete(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Deletes the ExecutionInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - def update(self, status): - """ - Update the ExecutionInstance - :param ExecutionInstance.Status status: The status of the Execution +class ExecutionListInstance(ListResource): + def __init__(self, version: Version, flow_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The updated ExecutionInstance - :rtype: twilio.rest.studio.v2.flow.execution.ExecutionInstance - """ - return self._proxy.update(status, ) + # Path Solution + self._solution = { 'flow_sid': flow_sid, } + self._uri = '/Flows/${flow_sid}/Executions' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def steps(self): - """ - Access the steps + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepList - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepList - """ - return self._proxy.steps + return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid']) + + """ + + """ + def page(self, date_created_from, date_created_to, page_size): + + data = values.of({ + 'date_created_from': date_created_from,'date_created_to': date_created_to,'page_size': page_size, + }) - @property - def execution_context(self): - """ - Access the execution_context + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextList - :rtype: twilio.rest.studio.v2.flow.execution.execution_context.ExecutionContextList - """ - return self._proxy.execution_context + return ExecutionPage(self._version, payload, flow_sid=self._solution['flow_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/studio/v2/flow/execution/execution_step.py b/twilio/rest/studio/v2/flow/execution/execution_step.py deleted file mode 100644 index 689f500395..0000000000 --- a/twilio/rest/studio/v2/flow/execution/execution_step.py +++ /dev/null @@ -1,144 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Studio - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.execution_step.execution_step_context import ExecutionStepContextListInstance - - -class ExecutionStepContext(InstanceContext): - def __init__(self, version: Version, flow_sid: str, execution_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'flow_sid': flow_sid, 'execution_sid': execution_sid, 'sid': sid, } - self._uri = '/Flows/${flow_sid}/Executions/${execution_sid}/Steps/${sid}' - - self._step_context = None - - def fetch(self): - - """ - Fetch the ExecutionStepInstance - - :returns: The fetched ExecutionStepInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ExecutionStepInstance(self._version, payload, flow_sid=self._solution['flow_sid'], execution_sid=self._solution['execution_sid'], sid=self._solution['sid'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ExecutionStepInstance(InstanceResource): - def __init__(self, version, payload, flow_sid: str, execution_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'flow_sid' : payload.get('flow_sid'), - 'execution_sid' : payload.get('execution_sid'), - 'name' : payload.get('name'), - 'context' : payload.get('context'), - 'transitioned_from' : payload.get('transitioned_from'), - 'transitioned_to' : payload.get('transitioned_to'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'flow_sid': flow_sid or self._properties['flow_sid'],'execution_sid': execution_sid or self._properties['execution_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ExecutionStepContext( - self._version, - flow_sid=self._solution['flow_sid'],execution_sid=self._solution['execution_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def step_context(self): - return self._proxy.step_context - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ExecutionStepListInstance(ListResource): - def __init__(self, version: Version, flow_sid: str, execution_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'flow_sid': flow_sid, 'execution_sid': execution_sid, } - self._uri = '/Flows/${flow_sid}/Executions/${execution_sid}/Steps' - - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ExecutionStepPage(self._version, payload, flow_sid=self._solution['flow_sid'], execution_sid=self._solution['execution_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py b/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py index 123675cf32..689f500395 100644 --- a/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py +++ b/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py @@ -1,445 +1,144 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Studio + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context import ExecutionStepContextList - - -class ExecutionStepList(ListResource): - - def __init__(self, version, flow_sid, execution_sid): - """ - Initialize the ExecutionStepList - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - :param execution_sid: The SID of the Execution - - :returns: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepList - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepList - """ - super(ExecutionStepList, self).__init__(version) - - # Path Solution - self._solution = {'flow_sid': flow_sid, 'execution_sid': execution_sid, } - self._uri = '/Flows/{flow_sid}/Executions/{execution_sid}/Steps'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams ExecutionStepInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ExecutionStepInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ExecutionStepInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ExecutionStepInstance - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ExecutionStepPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ExecutionStepInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ExecutionStepInstance - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ExecutionStepPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ExecutionStepContext - - :param sid: The unique string that identifies the resource +from twilio.base.version import Version - :returns: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepContext - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepContext - """ - return ExecutionStepContext( - self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a ExecutionStepContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepContext - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepContext - """ - return ExecutionStepContext( - self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ExecutionStepPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ExecutionStepPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param flow_sid: The SID of the Flow - :param execution_sid: The SID of the Execution - - :returns: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepPage - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepPage - """ - super(ExecutionStepPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ExecutionStepInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepInstance - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepInstance - """ - return ExecutionStepInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.execution_step.execution_step_context import ExecutionStepContextListInstance class ExecutionStepContext(InstanceContext): - - def __init__(self, version, flow_sid, execution_sid, sid): - """ - Initialize the ExecutionStepContext - - :param Version version: Version that contains the resource - :param flow_sid: The SID of the Flow - :param execution_sid: The SID of the Execution - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepContext - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepContext - """ - super(ExecutionStepContext, self).__init__(version) + def __init__(self, version: Version, flow_sid: str, execution_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'flow_sid': flow_sid, 'execution_sid': execution_sid, 'sid': sid, } - self._uri = '/Flows/{flow_sid}/Executions/{execution_sid}/Steps/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'flow_sid': flow_sid, 'execution_sid': execution_sid, 'sid': sid, } + self._uri = '/Flows/${flow_sid}/Executions/${execution_sid}/Steps/${sid}' + self._step_context = None - + def fetch(self): + """ Fetch the ExecutionStepInstance :returns: The fetched ExecutionStepInstance - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return ExecutionStepInstance( - self._version, - payload, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - sid=self._solution['sid'], - ) + return ExecutionStepInstance(self._version, payload, flow_sid=self._solution['flow_sid'], execution_sid=self._solution['execution_sid'], sid=self._solution['sid'], ) + - @property - def step_context(self): - """ - Access the step_context - - :returns: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextList - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextList - """ - if self._step_context is None: - self._step_context = ExecutionStepContextList( - self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - step_sid=self._solution['sid'], - ) - return self._step_context + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ExecutionStepInstance(InstanceResource): - def __init__(self, version, payload, flow_sid, execution_sid, sid=None): - """ - Initialize the ExecutionStepInstance - - :returns: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepInstance - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepInstance - """ - super(ExecutionStepInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'flow_sid': payload.get('flow_sid'), - 'execution_sid': payload.get('execution_sid'), - 'name': payload.get('name'), - 'context': payload.get('context'), - 'transitioned_from': payload.get('transitioned_from'), - 'transitioned_to': payload.get('transitioned_to'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ExecutionStepInstance(InstanceResource): + def __init__(self, version, payload, flow_sid: str, execution_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'flow_sid' : payload.get('flow_sid'), + 'execution_sid' : payload.get('execution_sid'), + 'name' : payload.get('name'), + 'context' : payload.get('context'), + 'transitioned_from' : payload.get('transitioned_from'), + 'transitioned_to' : payload.get('transitioned_to'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None self._solution = { - 'flow_sid': flow_sid, - 'execution_sid': execution_sid, - 'sid': sid or self._properties['sid'], + 'flow_sid': flow_sid or self._properties['flow_sid'],'execution_sid': execution_sid or self._properties['execution_sid'],'sid': sid or self._properties['sid'], } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ExecutionStepContext for this ExecutionStepInstance - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepContext - """ if self._context is None: self._context = ExecutionStepContext( self._version, - flow_sid=self._solution['flow_sid'], - execution_sid=self._solution['execution_sid'], - sid=self._solution['sid'], + flow_sid=self._solution['flow_sid'],execution_sid=self._solution['execution_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def flow_sid(self): - """ - :returns: The SID of the Flow - :rtype: unicode - """ - return self._properties['flow_sid'] - - @property - def execution_sid(self): - """ - :returns: The SID of the Execution - :rtype: unicode - """ - return self._properties['execution_sid'] - - @property - def name(self): - """ - :returns: The event that caused the Flow to transition to the Step - :rtype: unicode - """ - return self._properties['name'] - - @property - def context(self): - """ - :returns: The current state of the flow - :rtype: dict - """ - return self._properties['context'] - - @property - def transitioned_from(self): - """ - :returns: The Widget that preceded the Widget for the Step - :rtype: unicode - """ - return self._properties['transitioned_from'] - - @property - def transitioned_to(self): - """ - :returns: The Widget that will follow the Widget for the Step - :rtype: unicode - """ - return self._properties['transitioned_to'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] + def step_context(self): + return self._proxy.step_context + - @property - def links(self): + def __repr__(self): """ - :returns: The URLs of related resources - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['links'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def fetch(self): - """ - Fetch the ExecutionStepInstance - :returns: The fetched ExecutionStepInstance - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.ExecutionStepInstance - """ - return self._proxy.fetch() - @property - def step_context(self): - """ - Access the step_context +class ExecutionStepListInstance(ListResource): + def __init__(self, version: Version, flow_sid: str, execution_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextList - :rtype: twilio.rest.studio.v2.flow.execution.execution_step.execution_step_context.ExecutionStepContextList - """ - return self._proxy.step_context + # Path Solution + self._solution = { 'flow_sid': flow_sid, 'execution_sid': execution_sid, } + self._uri = '/Flows/${flow_sid}/Executions/${execution_sid}/Steps' + + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ExecutionStepPage(self._version, payload, flow_sid=self._solution['flow_sid'], execution_sid=self._solution['execution_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/studio/v2/flow/test_user.py b/twilio/rest/studio/v2/flow/test_user.py deleted file mode 100644 index 473d335e36..0000000000 --- a/twilio/rest/studio/v2/flow/test_user.py +++ /dev/null @@ -1,243 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class FlowTestUserList(ListResource): - - def __init__(self, version, sid): - """ - Initialize the FlowTestUserList - - :param Version version: Version that contains the resource - :param sid: Unique identifier of the flow. - - :returns: twilio.rest.studio.v2.flow.test_user.FlowTestUserList - :rtype: twilio.rest.studio.v2.flow.test_user.FlowTestUserList - """ - super(FlowTestUserList, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - - def get(self): - """ - Constructs a FlowTestUserContext - - :returns: twilio.rest.studio.v2.flow.test_user.FlowTestUserContext - :rtype: twilio.rest.studio.v2.flow.test_user.FlowTestUserContext - """ - return FlowTestUserContext(self._version, sid=self._solution['sid'], ) - - def __call__(self): - """ - Constructs a FlowTestUserContext - - :returns: twilio.rest.studio.v2.flow.test_user.FlowTestUserContext - :rtype: twilio.rest.studio.v2.flow.test_user.FlowTestUserContext - """ - return FlowTestUserContext(self._version, sid=self._solution['sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FlowTestUserPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the FlowTestUserPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param sid: Unique identifier of the flow. - - :returns: twilio.rest.studio.v2.flow.test_user.FlowTestUserPage - :rtype: twilio.rest.studio.v2.flow.test_user.FlowTestUserPage - """ - super(FlowTestUserPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of FlowTestUserInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.studio.v2.flow.test_user.FlowTestUserInstance - :rtype: twilio.rest.studio.v2.flow.test_user.FlowTestUserInstance - """ - return FlowTestUserInstance(self._version, payload, sid=self._solution['sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class FlowTestUserContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the FlowTestUserContext - - :param Version version: Version that contains the resource - :param sid: Unique identifier of the flow. - - :returns: twilio.rest.studio.v2.flow.test_user.FlowTestUserContext - :rtype: twilio.rest.studio.v2.flow.test_user.FlowTestUserContext - """ - super(FlowTestUserContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Flows/{sid}/TestUsers'.format(**self._solution) - - def fetch(self): - """ - Fetch the FlowTestUserInstance - - :returns: The fetched FlowTestUserInstance - :rtype: twilio.rest.studio.v2.flow.test_user.FlowTestUserInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return FlowTestUserInstance(self._version, payload, sid=self._solution['sid'], ) - - def update(self, test_users): - """ - Update the FlowTestUserInstance - - :param list[unicode] test_users: List of test user identities that can test draft versions of the flow. - - :returns: The updated FlowTestUserInstance - :rtype: twilio.rest.studio.v2.flow.test_user.FlowTestUserInstance - """ - data = values.of({'TestUsers': serialize.map(test_users, lambda e: e), }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return FlowTestUserInstance(self._version, payload, sid=self._solution['sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class FlowTestUserInstance(InstanceResource): - - def __init__(self, version, payload, sid): - """ - Initialize the FlowTestUserInstance - - :returns: twilio.rest.studio.v2.flow.test_user.FlowTestUserInstance - :rtype: twilio.rest.studio.v2.flow.test_user.FlowTestUserInstance - """ - super(FlowTestUserInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'test_users': payload.get('test_users'), - 'url': payload.get('url'), - } - - # Context - self._context = None - self._solution = {'sid': sid, } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: FlowTestUserContext for this FlowTestUserInstance - :rtype: twilio.rest.studio.v2.flow.test_user.FlowTestUserContext - """ - if self._context is None: - self._context = FlowTestUserContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def sid(self): - """ - :returns: Unique identifier of the flow. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def test_users(self): - """ - :returns: List of test user identities that can test draft versions of the flow. - :rtype: list[unicode] - """ - return self._properties['test_users'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the FlowTestUserInstance - - :returns: The fetched FlowTestUserInstance - :rtype: twilio.rest.studio.v2.flow.test_user.FlowTestUserInstance - """ - return self._proxy.fetch() - - def update(self, test_users): - """ - Update the FlowTestUserInstance - - :param list[unicode] test_users: List of test user identities that can test draft versions of the flow. - - :returns: The updated FlowTestUserInstance - :rtype: twilio.rest.studio.v2.flow.test_user.FlowTestUserInstance - """ - return self._proxy.update(test_users, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) diff --git a/twilio/rest/supersim/v1/network_access_profile.py b/twilio/rest/supersim/v1/network_access_profile.py deleted file mode 100644 index af2b98d47f..0000000000 --- a/twilio/rest/supersim/v1/network_access_profile.py +++ /dev/null @@ -1,164 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Supersim - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.network_access_profile.network_access_profile_network import NetworkAccessProfileNetworkListInstance - - -class NetworkAccessProfileContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/NetworkAccessProfiles/${sid}' - - self._networks = None - - def fetch(self): - - """ - Fetch the NetworkAccessProfileInstance - - :returns: The fetched NetworkAccessProfileInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return NetworkAccessProfileInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return NetworkAccessProfileInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class NetworkAccessProfileInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'account_sid' : payload.get('account_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = NetworkAccessProfileContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def networks(self): - return self._proxy.networks - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class NetworkAccessProfileListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/NetworkAccessProfiles' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return NetworkAccessProfileInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return NetworkAccessProfilePage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/supersim/v1/network_access_profile/__init__.py b/twilio/rest/supersim/v1/network_access_profile/__init__.py index 24ccddd4d0..af2b98d47f 100644 --- a/twilio/rest/supersim/v1/network_access_profile/__init__.py +++ b/twilio/rest/supersim/v1/network_access_profile/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Supersim + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,402 +19,146 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.supersim.v1.network_access_profile.network_access_profile_network import NetworkAccessProfileNetworkList - - -class NetworkAccessProfileList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the NetworkAccessProfileList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileList - :rtype: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileList - """ - super(NetworkAccessProfileList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/NetworkAccessProfiles'.format(**self._solution) - - def create(self, unique_name=values.unset, networks=values.unset): - """ - Create the NetworkAccessProfileInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param list[unicode] networks: List of Network SIDs that this Network Access Profile will allow connections to - - :returns: The created NetworkAccessProfileInstance - :rtype: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileInstance - """ - data = values.of({'UniqueName': unique_name, 'Networks': serialize.map(networks, lambda e: e), }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return NetworkAccessProfileInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams NetworkAccessProfileInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists NetworkAccessProfileInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of NetworkAccessProfileInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of NetworkAccessProfileInstance - :rtype: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfilePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return NetworkAccessProfilePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of NetworkAccessProfileInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of NetworkAccessProfileInstance - :rtype: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfilePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return NetworkAccessProfilePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a NetworkAccessProfileContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileContext - :rtype: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileContext - """ - return NetworkAccessProfileContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a NetworkAccessProfileContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileContext - :rtype: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileContext - """ - return NetworkAccessProfileContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - +from twilio.base.version import Version -class NetworkAccessProfilePage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the NetworkAccessProfilePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfilePage - :rtype: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfilePage - """ - super(NetworkAccessProfilePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of NetworkAccessProfileInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileInstance - :rtype: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileInstance - """ - return NetworkAccessProfileInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.network_access_profile.network_access_profile_network import NetworkAccessProfileNetworkListInstance class NetworkAccessProfileContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the NetworkAccessProfileContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileContext - :rtype: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileContext - """ - super(NetworkAccessProfileContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/NetworkAccessProfiles/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/NetworkAccessProfiles/${sid}' + self._networks = None - + def fetch(self): + """ Fetch the NetworkAccessProfileInstance :returns: The fetched NetworkAccessProfileInstance - :rtype: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return NetworkAccessProfileInstance(self._version, payload, sid=self._solution['sid'], ) + - def update(self, unique_name=values.unset): - """ - Update the NetworkAccessProfileInstance + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :param unicode unique_name: The new unique name of the resource - - :returns: The updated NetworkAccessProfileInstance - :rtype: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileInstance - """ - data = values.of({'UniqueName': unique_name, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return NetworkAccessProfileInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def networks(self): - """ - Access the networks - - :returns: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkList - :rtype: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkList - """ - if self._networks is None: - self._networks = NetworkAccessProfileNetworkList( - self._version, - network_access_profile_sid=self._solution['sid'], - ) - return self._networks + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class NetworkAccessProfileInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, payload, sid=None): - """ - Initialize the NetworkAccessProfileInstance - :returns: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileInstance - :rtype: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileInstance - """ - super(NetworkAccessProfileInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class NetworkAccessProfileInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'account_sid' : payload.get('account_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: NetworkAccessProfileContext for this NetworkAccessProfileInstance - :rtype: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileContext - """ if self._context is None: - self._context = NetworkAccessProfileContext(self._version, sid=self._solution['sid'], ) + self._context = NetworkAccessProfileContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that the Network Access Profile belongs to - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The links - :rtype: unicode - """ - return self._properties['links'] + def networks(self): + return self._proxy.networks + - def fetch(self): + def __repr__(self): """ - Fetch the NetworkAccessProfileInstance - - :returns: The fetched NetworkAccessProfileInstance - :rtype: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def update(self, unique_name=values.unset): - """ - Update the NetworkAccessProfileInstance - :param unicode unique_name: The new unique name of the resource - :returns: The updated NetworkAccessProfileInstance - :rtype: twilio.rest.supersim.v1.network_access_profile.NetworkAccessProfileInstance - """ - return self._proxy.update(unique_name=unique_name, ) +class NetworkAccessProfileListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - @property - def networks(self): - """ - Access the networks + # Path Solution + self._solution = { } + self._uri = '/NetworkAccessProfiles' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkList - :rtype: twilio.rest.supersim.v1.network_access_profile.network_access_profile_network.NetworkAccessProfileNetworkList - """ - return self._proxy.networks + return NetworkAccessProfileInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return NetworkAccessProfilePage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/supersim/v1/sim.py b/twilio/rest/supersim/v1/sim.py deleted file mode 100644 index 36999fb25c..0000000000 --- a/twilio/rest/supersim/v1/sim.py +++ /dev/null @@ -1,171 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Supersim - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.sim.billing_period import BillingPeriodListInstancefrom twilio.rest.sim.sim_ip_address import SimIpAddressListInstance - - -class SimContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Sims/${sid}' - - self._billing_periods = None - self._sim_ip_addresses = None - - def fetch(self): - - """ - Fetch the SimInstance - - :returns: The fetched SimInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SimInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return SimInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class SimInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'account_sid' : payload.get('account_sid'), - 'iccid' : payload.get('iccid'), - 'status' : payload.get('status'), - 'fleet_sid' : payload.get('fleet_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = SimContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def billing_periods(self): - return self._proxy.billing_periods - @property - def sim_ip_addresses(self): - return self._proxy.sim_ip_addresses - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class SimListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Sims' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return SimInstance(self._version, payload, ) - - """ - - """ - def page(self, status, fleet, iccid, page_size): - - data = values.of({ - 'status': status,'fleet': fleet,'iccid': iccid,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return SimPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/supersim/v1/sim/__init__.py b/twilio/rest/supersim/v1/sim/__init__.py index c2f108276e..36999fb25c 100644 --- a/twilio/rest/supersim/v1/sim/__init__.py +++ b/twilio/rest/supersim/v1/sim/__init__.py @@ -1,519 +1,171 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Supersim + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.supersim.v1.sim.billing_period import BillingPeriodList -from twilio.rest.supersim.v1.sim.sim_ip_address import SimIpAddressList - - -class SimList(ListResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version): - """ - Initialize the SimList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.supersim.v1.sim.SimList - :rtype: twilio.rest.supersim.v1.sim.SimList - """ - super(SimList, self).__init__(version) +from twilio.base.version import Version - # Path Solution - self._solution = {} - self._uri = '/Sims'.format(**self._solution) - - def create(self, iccid, registration_code): - """ - Create the SimInstance - - :param unicode iccid: The `ICCID `_ of the Super SIM to be added to your Account - :param unicode registration_code: The 10-digit code required to claim the Super SIM for your Account - - :returns: The created SimInstance - :rtype: twilio.rest.supersim.v1.sim.SimInstance - """ - data = values.of({'Iccid': iccid, 'RegistrationCode': registration_code, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return SimInstance(self._version, payload, ) - - def stream(self, status=values.unset, fleet=values.unset, iccid=values.unset, - limit=None, page_size=None): - """ - Streams SimInstance 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 SimInstance.Status status: The status of the Sim resources to read - :param unicode fleet: The SID or unique name of the Fleet to which a list of Sims are assigned - :param unicode iccid: The ICCID associated with a Super SIM to filter the list by - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.supersim.v1.sim.SimInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(status=status, fleet=fleet, iccid=iccid, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, status=values.unset, fleet=values.unset, iccid=values.unset, - limit=None, page_size=None): - """ - Lists SimInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param SimInstance.Status status: The status of the Sim resources to read - :param unicode fleet: The SID or unique name of the Fleet to which a list of Sims are assigned - :param unicode iccid: The ICCID associated with a Super SIM to filter the list by - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.supersim.v1.sim.SimInstance] - """ - return list(self.stream(status=status, fleet=fleet, iccid=iccid, limit=limit, page_size=page_size, )) - - def page(self, status=values.unset, fleet=values.unset, iccid=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SimInstance records from the API. - Request is executed immediately - - :param SimInstance.Status status: The status of the Sim resources to read - :param unicode fleet: The SID or unique name of the Fleet to which a list of Sims are assigned - :param unicode iccid: The ICCID associated with a Super SIM to filter the list by - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SimInstance - :rtype: twilio.rest.supersim.v1.sim.SimPage - """ - data = values.of({ - 'Status': status, - 'Fleet': fleet, - 'Iccid': iccid, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SimPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SimInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SimInstance - :rtype: twilio.rest.supersim.v1.sim.SimPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SimPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SimContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.supersim.v1.sim.SimContext - :rtype: twilio.rest.supersim.v1.sim.SimContext - """ - return SimContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SimContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.supersim.v1.sim.SimContext - :rtype: twilio.rest.supersim.v1.sim.SimContext - """ - return SimContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SimPage(Page): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, response, solution): - """ - Initialize the SimPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.supersim.v1.sim.SimPage - :rtype: twilio.rest.supersim.v1.sim.SimPage - """ - super(SimPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SimInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.supersim.v1.sim.SimInstance - :rtype: twilio.rest.supersim.v1.sim.SimInstance - """ - return SimInstance(self._version, payload, ) +from twilio.base.page import Page - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.sim.billing_period import BillingPeriodListInstancefrom twilio.rest.sim.sim_ip_address import SimIpAddressListInstance class SimContext(InstanceContext): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - def __init__(self, version, sid): - """ - Initialize the SimContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.supersim.v1.sim.SimContext - :rtype: twilio.rest.supersim.v1.sim.SimContext - """ - super(SimContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Sims/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Sims/${sid}' + self._billing_periods = None self._sim_ip_addresses = None - + def fetch(self): + """ Fetch the SimInstance :returns: The fetched SimInstance - :rtype: twilio.rest.supersim.v1.sim.SimInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return SimInstance(self._version, payload, sid=self._solution['sid'], ) + - def update(self, unique_name=values.unset, status=values.unset, - fleet=values.unset, callback_url=values.unset, - callback_method=values.unset, account_sid=values.unset): - """ - Update the SimInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param SimInstance.StatusUpdate status: The new status of the Super SIM - :param unicode fleet: The SID or unique name of the Fleet to which the SIM resource should be assigned - :param unicode callback_url: The URL we should call after the update has finished - :param unicode callback_method: The HTTP method we should use to call callback_url - :param unicode account_sid: The SID of the Account to which the Sim resource should belong - - :returns: The updated SimInstance - :rtype: twilio.rest.supersim.v1.sim.SimInstance - """ + + + def update(self, body): data = values.of({ - 'UniqueName': unique_name, - 'Status': status, - 'Fleet': fleet, - 'CallbackUrl': callback_url, - 'CallbackMethod': callback_method, - 'AccountSid': account_sid, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return SimInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def billing_periods(self): - """ - Access the billing_periods - - :returns: twilio.rest.supersim.v1.sim.billing_period.BillingPeriodList - :rtype: twilio.rest.supersim.v1.sim.billing_period.BillingPeriodList - """ - if self._billing_periods is None: - self._billing_periods = BillingPeriodList(self._version, sim_sid=self._solution['sid'], ) - return self._billing_periods - - @property - def sim_ip_addresses(self): - """ - Access the sim_ip_addresses - - :returns: twilio.rest.supersim.v1.sim.sim_ip_address.SimIpAddressList - :rtype: twilio.rest.supersim.v1.sim.sim_ip_address.SimIpAddressList - """ - if self._sim_ip_addresses is None: - self._sim_ip_addresses = SimIpAddressList(self._version, sim_sid=self._solution['sid'], ) - return self._sim_ip_addresses + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class SimInstance(InstanceResource): - """ PLEASE NOTE that this class contains beta products that are subject to - change. Use them with caution. """ - - class Status(object): - NEW = "new" - READY = "ready" - ACTIVE = "active" - INACTIVE = "inactive" - SCHEDULED = "scheduled" - - class StatusUpdate(object): - READY = "ready" - ACTIVE = "active" - INACTIVE = "inactive" - - def __init__(self, version, payload, sid=None): - """ - Initialize the SimInstance - :returns: twilio.rest.supersim.v1.sim.SimInstance - :rtype: twilio.rest.supersim.v1.sim.SimInstance - """ - super(SimInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'account_sid': payload.get('account_sid'), - 'iccid': payload.get('iccid'), - 'status': payload.get('status'), - 'fleet_sid': payload.get('fleet_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class SimInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'account_sid' : payload.get('account_sid'), + 'iccid' : payload.get('iccid'), + 'status' : payload.get('status'), + 'fleet_sid' : payload.get('fleet_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SimContext for this SimInstance - :rtype: twilio.rest.supersim.v1.sim.SimContext - """ if self._context is None: - self._context = SimContext(self._version, sid=self._solution['sid'], ) + self._context = SimContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that the Super SIM belongs to - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def iccid(self): - """ - :returns: The ICCID associated with the SIM - :rtype: unicode - """ - return self._properties['iccid'] - - @property - def status(self): - """ - :returns: The status of the Super SIM - :rtype: SimInstance.Status - """ - return self._properties['status'] - - @property - def fleet_sid(self): - """ - :returns: The unique ID of the Fleet configured for this SIM - :rtype: unicode - """ - return self._properties['fleet_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - + def billing_periods(self): + return self._proxy.billing_periods @property - def url(self): - """ - :returns: The absolute URL of the Sim Resource - :rtype: unicode - """ - return self._properties['url'] + def sim_ip_addresses(self): + return self._proxy.sim_ip_addresses + - @property - def links(self): - """ - :returns: The links - :rtype: unicode + def __repr__(self): """ - return self._properties['links'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the SimInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched SimInstance - :rtype: twilio.rest.supersim.v1.sim.SimInstance - """ - return self._proxy.fetch() - def update(self, unique_name=values.unset, status=values.unset, - fleet=values.unset, callback_url=values.unset, - callback_method=values.unset, account_sid=values.unset): - """ - Update the SimInstance - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param SimInstance.StatusUpdate status: The new status of the Super SIM - :param unicode fleet: The SID or unique name of the Fleet to which the SIM resource should be assigned - :param unicode callback_url: The URL we should call after the update has finished - :param unicode callback_method: The HTTP method we should use to call callback_url - :param unicode account_sid: The SID of the Account to which the Sim resource should belong +class SimListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The updated SimInstance - :rtype: twilio.rest.supersim.v1.sim.SimInstance - """ - return self._proxy.update( - unique_name=unique_name, - status=status, - fleet=fleet, - callback_url=callback_url, - callback_method=callback_method, - account_sid=account_sid, - ) + # Path Solution + self._solution = { } + self._uri = '/Sims' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def billing_periods(self): - """ - Access the billing_periods + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.supersim.v1.sim.billing_period.BillingPeriodList - :rtype: twilio.rest.supersim.v1.sim.billing_period.BillingPeriodList - """ - return self._proxy.billing_periods + return SimInstance(self._version, payload, ) + + """ + + """ + def page(self, status, fleet, iccid, page_size): + + data = values.of({ + 'status': status,'fleet': fleet,'iccid': iccid,'page_size': page_size, + }) - @property - def sim_ip_addresses(self): - """ - Access the sim_ip_addresses + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.supersim.v1.sim.sim_ip_address.SimIpAddressList - :rtype: twilio.rest.supersim.v1.sim.sim_ip_address.SimIpAddressList - """ - return self._proxy.sim_ip_addresses + return SimPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/sync/v1/service.py b/twilio/rest/sync/v1/service.py deleted file mode 100644 index c637be60c1..0000000000 --- a/twilio/rest/sync/v1/service.py +++ /dev/null @@ -1,195 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Sync - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.service.document import DocumentListInstancefrom twilio.rest.service.sync_list import SyncListListInstancefrom twilio.rest.service.sync_map import SyncMapListInstancefrom twilio.rest.service.sync_stream import SyncStreamListInstance - - -class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Services/${sid}' - - self._documents = None - self._sync_lists = None - self._sync_maps = None - self._sync_streams = None - - def delete(self): - - - - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'account_sid' : payload.get('account_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'webhook_url' : payload.get('webhook_url'), - 'webhooks_from_rest_enabled' : payload.get('webhooks_from_rest_enabled'), - 'reachability_webhooks_enabled' : payload.get('reachability_webhooks_enabled'), - 'acl_enabled' : payload.get('acl_enabled'), - 'reachability_debouncing_enabled' : payload.get('reachability_debouncing_enabled'), - 'reachability_debouncing_window' : payload.get('reachability_debouncing_window'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ServiceContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def documents(self): - return self._proxy.documents - @property - def sync_lists(self): - return self._proxy.sync_lists - @property - def sync_maps(self): - return self._proxy.sync_maps - @property - def sync_streams(self): - return self._proxy.sync_streams - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ServiceListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Services' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ServicePage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/sync/v1/service/__init__.py b/twilio/rest/sync/v1/service/__init__.py index c5e7cf5a6c..c637be60c1 100644 --- a/twilio/rest/sync/v1/service/__init__.py +++ b/twilio/rest/sync/v1/service/__init__.py @@ -1,607 +1,195 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Sync + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.sync.v1.service.document import DocumentList -from twilio.rest.sync.v1.service.sync_list import SyncListList -from twilio.rest.sync.v1.service.sync_map import SyncMapList -from twilio.rest.sync.v1.service.sync_stream import SyncStreamList - - -class ServiceList(ListResource): - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.sync.v1.service.ServiceList - :rtype: twilio.rest.sync.v1.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def create(self, friendly_name=values.unset, webhook_url=values.unset, - reachability_webhooks_enabled=values.unset, acl_enabled=values.unset, - reachability_debouncing_enabled=values.unset, - reachability_debouncing_window=values.unset, - webhooks_from_rest_enabled=values.unset): - """ - Create the ServiceInstance - - :param unicode friendly_name: A string that you assign to describe the resource - :param unicode webhook_url: The URL we should call when Sync objects are manipulated - :param bool reachability_webhooks_enabled: Whether the service instance should call webhook_url when client endpoints connect to Sync - :param bool acl_enabled: Whether token identities in the Service must be granted access to Sync objects by using the Permissions resource - :param bool reachability_debouncing_enabled: Whether every endpoint_disconnected event occurs after a configurable delay - :param unicode reachability_debouncing_window: The reachability event delay in milliseconds - :param bool webhooks_from_rest_enabled: Whether the Service instance should call webhook_url when the REST API is used to update Sync objects - - :returns: The created ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'WebhookUrl': webhook_url, - 'ReachabilityWebhooksEnabled': reachability_webhooks_enabled, - 'AclEnabled': acl_enabled, - 'ReachabilityDebouncingEnabled': reachability_debouncing_enabled, - 'ReachabilityDebouncingWindow': reachability_debouncing_window, - 'WebhooksFromRestEnabled': webhooks_from_rest_enabled, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.sync.v1.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServicePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The SID of the Service resource to fetch - - :returns: twilio.rest.sync.v1.service.ServiceContext - :rtype: twilio.rest.sync.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The SID of the Service resource to fetch - - :returns: twilio.rest.sync.v1.service.ServiceContext - :rtype: twilio.rest.sync.v1.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ServicePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage +from twilio.base.version import Version - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.sync.v1.service.ServicePage - :rtype: twilio.rest.sync.v1.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.sync.v1.service.ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.service.document import DocumentListInstancefrom twilio.rest.service.sync_list import SyncListListInstancefrom twilio.rest.service.sync_map import SyncMapListInstancefrom twilio.rest.service.sync_stream import SyncStreamListInstance class ServiceContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The SID of the Service resource to fetch - - :returns: twilio.rest.sync.v1.service.ServiceContext - :rtype: twilio.rest.sync.v1.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Services/${sid}' + self._documents = None self._sync_lists = None self._sync_maps = None self._sync_streams = None + + def delete(self): + + + + """ + Deletes the ServiceInstance + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the ServiceInstance :returns: The fetched ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServiceInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, webhook_url=values.unset, friendly_name=values.unset, - reachability_webhooks_enabled=values.unset, acl_enabled=values.unset, - reachability_debouncing_enabled=values.unset, - reachability_debouncing_window=values.unset, - webhooks_from_rest_enabled=values.unset): - """ - Update the ServiceInstance - - :param unicode webhook_url: The URL we should call when Sync objects are manipulated - :param unicode friendly_name: A string that you assign to describe the resource - :param bool reachability_webhooks_enabled: Whether the service instance should call webhook_url when client endpoints connect to Sync - :param bool acl_enabled: Whether token identities in the Service must be granted access to Sync objects by using the Permissions resource - :param bool reachability_debouncing_enabled: Whether every endpoint_disconnected event occurs after a configurable delay - :param unicode reachability_debouncing_window: The reachability event delay in milliseconds - :param bool webhooks_from_rest_enabled: Whether the Service instance should call webhook_url when the REST API is used to update Sync objects - - :returns: The updated ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServiceInstance - """ + + + def update(self, body): data = values.of({ - 'WebhookUrl': webhook_url, - 'FriendlyName': friendly_name, - 'ReachabilityWebhooksEnabled': reachability_webhooks_enabled, - 'AclEnabled': acl_enabled, - 'ReachabilityDebouncingEnabled': reachability_debouncing_enabled, - 'ReachabilityDebouncingWindow': reachability_debouncing_window, - 'WebhooksFromRestEnabled': webhooks_from_rest_enabled, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def documents(self): - """ - Access the documents - - :returns: twilio.rest.sync.v1.service.document.DocumentList - :rtype: twilio.rest.sync.v1.service.document.DocumentList - """ - if self._documents is None: - self._documents = DocumentList(self._version, service_sid=self._solution['sid'], ) - return self._documents - - @property - def sync_lists(self): - """ - Access the sync_lists - - :returns: twilio.rest.sync.v1.service.sync_list.SyncListList - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListList - """ - if self._sync_lists is None: - self._sync_lists = SyncListList(self._version, service_sid=self._solution['sid'], ) - return self._sync_lists - - @property - def sync_maps(self): - """ - Access the sync_maps - - :returns: twilio.rest.sync.v1.service.sync_map.SyncMapList - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapList - """ - if self._sync_maps is None: - self._sync_maps = SyncMapList(self._version, service_sid=self._solution['sid'], ) - return self._sync_maps - - @property - def sync_streams(self): - """ - Access the sync_streams - - :returns: twilio.rest.sync.v1.service.sync_stream.SyncStreamList - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamList - """ - if self._sync_streams is None: - self._sync_streams = SyncStreamList(self._version, service_sid=self._solution['sid'], ) - return self._sync_streams + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - :returns: twilio.rest.sync.v1.service.ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'webhook_url': payload.get('webhook_url'), - 'webhooks_from_rest_enabled': payload.get('webhooks_from_rest_enabled'), - 'reachability_webhooks_enabled': payload.get('reachability_webhooks_enabled'), - 'acl_enabled': payload.get('acl_enabled'), - 'reachability_debouncing_enabled': payload.get('reachability_debouncing_enabled'), - 'reachability_debouncing_window': deserialize.integer(payload.get('reachability_debouncing_window')), - 'links': payload.get('links'), +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'account_sid' : payload.get('account_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'webhook_url' : payload.get('webhook_url'), + 'webhooks_from_rest_enabled' : payload.get('webhooks_from_rest_enabled'), + 'reachability_webhooks_enabled' : payload.get('reachability_webhooks_enabled'), + 'acl_enabled' : payload.get('acl_enabled'), + 'reachability_debouncing_enabled' : payload.get('reachability_debouncing_enabled'), + 'reachability_debouncing_window' : payload.get('reachability_debouncing_window'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServiceContext - """ if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the Service resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def webhook_url(self): - """ - :returns: The URL we call when Sync objects are manipulated - :rtype: unicode - """ - return self._properties['webhook_url'] - - @property - def webhooks_from_rest_enabled(self): - """ - :returns: Whether the Service instance should call webhook_url when the REST API is used to update Sync objects - :rtype: bool - """ - return self._properties['webhooks_from_rest_enabled'] - - @property - def reachability_webhooks_enabled(self): - """ - :returns: Whether the service instance calls webhook_url when client endpoints connect to Sync - :rtype: bool - """ - return self._properties['reachability_webhooks_enabled'] - - @property - def acl_enabled(self): - """ - :returns: Whether token identities in the Service must be granted access to Sync objects by using the Permissions resource - :rtype: bool - """ - return self._properties['acl_enabled'] - + def documents(self): + return self._proxy.documents @property - def reachability_debouncing_enabled(self): - """ - :returns: Whether every endpoint_disconnected event occurs after a configurable delay - :rtype: bool - """ - return self._properties['reachability_debouncing_enabled'] - + def sync_lists(self): + return self._proxy.sync_lists @property - def reachability_debouncing_window(self): - """ - :returns: The reachability event delay in milliseconds - :rtype: unicode - """ - return self._properties['reachability_debouncing_window'] - + def sync_maps(self): + return self._proxy.sync_maps @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServiceInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + def sync_streams(self): + return self._proxy.sync_streams + - def update(self, webhook_url=values.unset, friendly_name=values.unset, - reachability_webhooks_enabled=values.unset, acl_enabled=values.unset, - reachability_debouncing_enabled=values.unset, - reachability_debouncing_window=values.unset, - webhooks_from_rest_enabled=values.unset): + def __repr__(self): """ - Update the ServiceInstance - - :param unicode webhook_url: The URL we should call when Sync objects are manipulated - :param unicode friendly_name: A string that you assign to describe the resource - :param bool reachability_webhooks_enabled: Whether the service instance should call webhook_url when client endpoints connect to Sync - :param bool acl_enabled: Whether token identities in the Service must be granted access to Sync objects by using the Permissions resource - :param bool reachability_debouncing_enabled: Whether every endpoint_disconnected event occurs after a configurable delay - :param unicode reachability_debouncing_window: The reachability event delay in milliseconds - :param bool webhooks_from_rest_enabled: Whether the Service instance should call webhook_url when the REST API is used to update Sync objects - - :returns: The updated ServiceInstance - :rtype: twilio.rest.sync.v1.service.ServiceInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update( - webhook_url=webhook_url, - friendly_name=friendly_name, - reachability_webhooks_enabled=reachability_webhooks_enabled, - acl_enabled=acl_enabled, - reachability_debouncing_enabled=reachability_debouncing_enabled, - reachability_debouncing_window=reachability_debouncing_window, - webhooks_from_rest_enabled=webhooks_from_rest_enabled, - ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def documents(self): - """ - Access the documents - :returns: twilio.rest.sync.v1.service.document.DocumentList - :rtype: twilio.rest.sync.v1.service.document.DocumentList - """ - return self._proxy.documents - @property - def sync_lists(self): - """ - Access the sync_lists +class ServiceListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.sync.v1.service.sync_list.SyncListList - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListList - """ - return self._proxy.sync_lists + # Path Solution + self._solution = { } + self._uri = '/Services' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def sync_maps(self): - """ - Access the sync_maps + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.sync.v1.service.sync_map.SyncMapList - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapList - """ - return self._proxy.sync_maps + return ServiceInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def sync_streams(self): - """ - Access the sync_streams + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.sync.v1.service.sync_stream.SyncStreamList - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamList - """ - return self._proxy.sync_streams + return ServicePage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/sync/v1/service/document.py b/twilio/rest/sync/v1/service/document.py deleted file mode 100644 index e900b4ff62..0000000000 --- a/twilio/rest/sync/v1/service/document.py +++ /dev/null @@ -1,181 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Sync - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.document.document_permission import DocumentPermissionListInstance - - -class DocumentContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Documents/${sid}' - - self._document_permissions = None - - def delete(self): - - - - """ - Deletes the DocumentInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the DocumentInstance - - :returns: The fetched DocumentInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - def update(self, if_match, body): - data = values.of({ - 'if_match': if_match,'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class DocumentInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - 'revision' : payload.get('revision'), - 'data' : payload.get('data'), - 'date_expires' : payload.get('date_expires'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'created_by' : payload.get('created_by'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = DocumentContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def document_permissions(self): - return self._proxy.document_permissions - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class DocumentListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Documents' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return DocumentPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/sync/v1/service/document/__init__.py b/twilio/rest/sync/v1/service/document/__init__.py index 9e8e3a4652..e900b4ff62 100644 --- a/twilio/rest/sync/v1/service/document/__init__.py +++ b/twilio/rest/sync/v1/service/document/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Sync + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,232 +19,28 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.sync.v1.service.document.document_permission import DocumentPermissionList - - -class DocumentList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the DocumentList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Sync Service that the resource is associated with - - :returns: twilio.rest.sync.v1.service.document.DocumentList - :rtype: twilio.rest.sync.v1.service.document.DocumentList - """ - super(DocumentList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Documents'.format(**self._solution) - - def create(self, unique_name=values.unset, data=values.unset, ttl=values.unset): - """ - Create the DocumentInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the Sync Document - :param dict data: A JSON string that represents an arbitrary, schema-less object that the Sync Document stores - :param unicode ttl: How long, in seconds, before the Sync Document expires and is deleted - - :returns: The created DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentInstance - """ - data = values.of({'UniqueName': unique_name, 'Data': serialize.object(data), 'Ttl': ttl, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams DocumentInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.sync.v1.service.document.DocumentInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists DocumentInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.document.DocumentInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of DocumentInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return DocumentPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of DocumentInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return DocumentPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a DocumentContext - - :param sid: The SID of the Document resource to fetch - - :returns: twilio.rest.sync.v1.service.document.DocumentContext - :rtype: twilio.rest.sync.v1.service.document.DocumentContext - """ - return DocumentContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a DocumentContext - - :param sid: The SID of the Document resource to fetch +from twilio.base.version import Version - :returns: twilio.rest.sync.v1.service.document.DocumentContext - :rtype: twilio.rest.sync.v1.service.document.DocumentContext - """ - return DocumentContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class DocumentPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the DocumentPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Sync Service that the resource is associated with - - :returns: twilio.rest.sync.v1.service.document.DocumentPage - :rtype: twilio.rest.sync.v1.service.document.DocumentPage - """ - super(DocumentPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DocumentInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.sync.v1.service.document.DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentInstance - """ - return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.document.document_permission import DocumentPermissionListInstance class DocumentContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the DocumentContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Sync Service with the Document resource to fetch - :param sid: The SID of the Document resource to fetch - - :returns: twilio.rest.sync.v1.service.document.DocumentContext - :rtype: twilio.rest.sync.v1.service.document.DocumentContext - """ - super(DocumentContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Documents/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Documents/${sid}' + self._document_permissions = None - - def fetch(self): - """ - Fetch the DocumentInstance - - :returns: The fetched DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return DocumentInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the DocumentInstance @@ -245,248 +48,134 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, data=values.unset, ttl=values.unset, if_match=values.unset): + + def fetch(self): + """ - Update the DocumentInstance - - :param dict data: A JSON string that represents an arbitrary, schema-less object that the Sync Document stores - :param unicode ttl: How long, in seconds, before the Document resource expires and is deleted - :param unicode if_match: The If-Match HTTP request header + Fetch the DocumentInstance - :returns: The updated DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentInstance + :returns: The fetched DocumentInstance + #TODO: add rtype docs """ - data = values.of({'Data': serialize.object(data), 'Ttl': ttl, }) - headers = values.of({'If-Match': if_match, }) + payload = self._version.fetch(method='GET', uri=self._uri, ) - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) + return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - return DocumentInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + + + def update(self, if_match, body): + data = values.of({ + 'if_match': if_match,'body': body, + }) - @property - def document_permissions(self): - """ - Access the document_permissions + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionList - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionList - """ - if self._document_permissions is None: - self._document_permissions = DocumentPermissionList( - self._version, - service_sid=self._solution['service_sid'], - document_sid=self._solution['sid'], - ) - return self._document_permissions + return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class DocumentInstance(InstanceResource): - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the DocumentInstance - :returns: twilio.rest.sync.v1.service.document.DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentInstance - """ - super(DocumentInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'url': payload.get('url'), - 'links': payload.get('links'), - 'revision': payload.get('revision'), - 'data': payload.get('data'), - 'date_expires': deserialize.iso8601_datetime(payload.get('date_expires')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'created_by': payload.get('created_by'), +class DocumentInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), + 'revision' : payload.get('revision'), + 'data' : payload.get('data'), + 'date_expires' : payload.get('date_expires'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'created_by' : payload.get('created_by'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: DocumentContext for this DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentContext - """ if self._context is None: self._context = DocumentContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Sync Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def url(self): - """ - :returns: The absolute URL of the Document resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The URLs of resources related to the Sync Document - :rtype: unicode - """ - return self._properties['links'] - - @property - def revision(self): - """ - :returns: The current revision of the Sync Document, represented by a string identifier - :rtype: unicode - """ - return self._properties['revision'] - - @property - def data(self): - """ - :returns: An arbitrary, schema-less object that the Sync Document stores - :rtype: dict - """ - return self._properties['data'] - - @property - def date_expires(self): - """ - :returns: The ISO 8601 date and time in GMT when the Sync Document expires - :rtype: datetime - """ - return self._properties['date_expires'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The identity of the Sync Document's creator - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch the DocumentInstance - - :returns: The fetched DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the DocumentInstance + def document_permissions(self): + return self._proxy.document_permissions + - :returns: True if delete succeeds, False otherwise - :rtype: bool + def __repr__(self): """ - return self._proxy.delete() - - def update(self, data=values.unset, ttl=values.unset, if_match=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the DocumentInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param dict data: A JSON string that represents an arbitrary, schema-less object that the Sync Document stores - :param unicode ttl: How long, in seconds, before the Document resource expires and is deleted - :param unicode if_match: The If-Match HTTP request header - :returns: The updated DocumentInstance - :rtype: twilio.rest.sync.v1.service.document.DocumentInstance - """ - return self._proxy.update(data=data, ttl=ttl, if_match=if_match, ) - @property - def document_permissions(self): - """ - Access the document_permissions +class DocumentListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionList - :rtype: twilio.rest.sync.v1.service.document.document_permission.DocumentPermissionList - """ - return self._proxy.document_permissions + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Documents' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return DocumentPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/sync/v1/service/sync_list.py b/twilio/rest/sync/v1/service/sync_list.py deleted file mode 100644 index 2e9e0eef4e..0000000000 --- a/twilio/rest/sync/v1/service/sync_list.py +++ /dev/null @@ -1,184 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Sync - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.sync_list.sync_list_item import SyncListItemListInstancefrom twilio.rest.sync_list.sync_list_permission import SyncListPermissionListInstance - - -class SyncListContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Lists/${sid}' - - self._sync_list_items = None - self._sync_list_permissions = None - - def delete(self): - - - - """ - Deletes the SyncListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the SyncListInstance - - :returns: The fetched SyncListInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class SyncListInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - 'revision' : payload.get('revision'), - 'date_expires' : payload.get('date_expires'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'created_by' : payload.get('created_by'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = SyncListContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def sync_list_items(self): - return self._proxy.sync_list_items - @property - def sync_list_permissions(self): - return self._proxy.sync_list_permissions - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class SyncListListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Lists' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return SyncListPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/sync/v1/service/sync_list/__init__.py b/twilio/rest/sync/v1/service/sync_list/__init__.py index 5f14f6e8f0..2e9e0eef4e 100644 --- a/twilio/rest/sync/v1/service/sync_list/__init__.py +++ b/twilio/rest/sync/v1/service/sync_list/__init__.py @@ -1,245 +1,47 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Sync + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.sync.v1.service.sync_list.sync_list_item import SyncListItemList -from twilio.rest.sync.v1.service.sync_list.sync_list_permission import SyncListPermissionList - - -class SyncListList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the SyncListList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Sync Service that the resource is associated with - - :returns: twilio.rest.sync.v1.service.sync_list.SyncListList - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListList - """ - super(SyncListList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Lists'.format(**self._solution) +from twilio.base.version import Version - def create(self, unique_name=values.unset, ttl=values.unset, - collection_ttl=values.unset): - """ - Create the SyncListInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode ttl: Alias for collection_ttl - :param unicode collection_ttl: How long, in seconds, before the Sync List expires and is deleted - - :returns: The created SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListInstance - """ - data = values.of({'UniqueName': unique_name, 'Ttl': ttl, 'CollectionTtl': collection_ttl, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams SyncListInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.sync.v1.service.sync_list.SyncListInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SyncListInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.sync_list.SyncListInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncListInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SyncListPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncListInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncListPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SyncListContext - - :param sid: The SID of the Sync List resource to fetch - - :returns: twilio.rest.sync.v1.service.sync_list.SyncListContext - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListContext - """ - return SyncListContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SyncListContext - - :param sid: The SID of the Sync List resource to fetch - - :returns: twilio.rest.sync.v1.service.sync_list.SyncListContext - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListContext - """ - return SyncListContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SyncListPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SyncListPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Sync Service that the resource is associated with - - :returns: twilio.rest.sync.v1.service.sync_list.SyncListPage - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListPage - """ - super(SyncListPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncListInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.sync.v1.service.sync_list.SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListInstance - """ - return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.sync_list.sync_list_item import SyncListItemListInstancefrom twilio.rest.sync_list.sync_list_permission import SyncListPermissionListInstance class SyncListContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the SyncListContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Sync Service with the Sync List resource to fetch - :param sid: The SID of the Sync List resource to fetch - - :returns: twilio.rest.sync.v1.service.sync_list.SyncListContext - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListContext - """ - super(SyncListContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Lists/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Lists/${sid}' + self._sync_list_items = None self._sync_list_permissions = None - - def fetch(self): - """ - Fetch the SyncListInstance - - :returns: The fetched SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SyncListInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the SyncListInstance @@ -247,262 +49,136 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, ttl=values.unset, collection_ttl=values.unset): + + def fetch(self): + """ - Update the SyncListInstance - - :param unicode ttl: An alias for collection_ttl - :param unicode collection_ttl: How long, in seconds, before the Sync List expires and is deleted + Fetch the SyncListInstance - :returns: The updated SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListInstance + :returns: The fetched SyncListInstance + #TODO: add rtype docs """ - data = values.of({'Ttl': ttl, 'CollectionTtl': collection_ttl, }) + payload = self._version.fetch(method='GET', uri=self._uri, ) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - return SyncListInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + + + def update(self, body): + data = values.of({ + 'body': body, + }) - @property - def sync_list_items(self): - """ - Access the sync_list_items + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemList - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemList - """ - if self._sync_list_items is None: - self._sync_list_items = SyncListItemList( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['sid'], - ) - return self._sync_list_items + return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + - @property - def sync_list_permissions(self): - """ - Access the sync_list_permissions - - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionList - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionList - """ - if self._sync_list_permissions is None: - self._sync_list_permissions = SyncListPermissionList( - self._version, - service_sid=self._solution['service_sid'], - list_sid=self._solution['sid'], - ) - return self._sync_list_permissions + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class SyncListInstance(InstanceResource): - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the SyncListInstance - :returns: twilio.rest.sync.v1.service.sync_list.SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListInstance - """ - super(SyncListInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'url': payload.get('url'), - 'links': payload.get('links'), - 'revision': payload.get('revision'), - 'date_expires': deserialize.iso8601_datetime(payload.get('date_expires')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'created_by': payload.get('created_by'), +class SyncListInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), + 'revision' : payload.get('revision'), + 'date_expires' : payload.get('date_expires'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'created_by' : payload.get('created_by'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncListContext for this SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListContext - """ if self._context is None: self._context = SyncListContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Sync Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def url(self): - """ - :returns: The absolute URL of the Sync List resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The URLs of the Sync List's nested resources - :rtype: unicode - """ - return self._properties['links'] - - @property - def revision(self): - """ - :returns: The current revision of the Sync List, represented as a string - :rtype: unicode - """ - return self._properties['revision'] - - @property - def date_expires(self): - """ - :returns: The ISO 8601 date and time in GMT when the Sync List expires - :rtype: datetime - """ - return self._properties['date_expires'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - + def sync_list_items(self): + return self._proxy.sync_list_items @property - def created_by(self): - """ - :returns: The identity of the Sync List's creator - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch the SyncListInstance - - :returns: The fetched SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the SyncListInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + def sync_list_permissions(self): + return self._proxy.sync_list_permissions + - def update(self, ttl=values.unset, collection_ttl=values.unset): + def __repr__(self): """ - Update the SyncListInstance - - :param unicode ttl: An alias for collection_ttl - :param unicode collection_ttl: How long, in seconds, before the Sync List expires and is deleted - - :returns: The updated SyncListInstance - :rtype: twilio.rest.sync.v1.service.sync_list.SyncListInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update(ttl=ttl, collection_ttl=collection_ttl, ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def sync_list_items(self): - """ - Access the sync_list_items - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemList - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemList - """ - return self._proxy.sync_list_items - @property - def sync_list_permissions(self): - """ - Access the sync_list_permissions +class SyncListListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionList - :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionList - """ - return self._proxy.sync_list_permissions + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Lists' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SyncListInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SyncListPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/sync/v1/service/sync_map.py b/twilio/rest/sync/v1/service/sync_map.py deleted file mode 100644 index ad0257a54c..0000000000 --- a/twilio/rest/sync/v1/service/sync_map.py +++ /dev/null @@ -1,184 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Sync - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.sync_map.sync_map_item import SyncMapItemListInstancefrom twilio.rest.sync_map.sync_map_permission import SyncMapPermissionListInstance - - -class SyncMapContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Maps/${sid}' - - self._sync_map_items = None - self._sync_map_permissions = None - - def delete(self): - - - - """ - Deletes the SyncMapInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the SyncMapInstance - - :returns: The fetched SyncMapInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class SyncMapInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - 'revision' : payload.get('revision'), - 'date_expires' : payload.get('date_expires'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'created_by' : payload.get('created_by'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = SyncMapContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def sync_map_items(self): - return self._proxy.sync_map_items - @property - def sync_map_permissions(self): - return self._proxy.sync_map_permissions - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class SyncMapListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Maps' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return SyncMapPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/sync/v1/service/sync_map/__init__.py b/twilio/rest/sync/v1/service/sync_map/__init__.py index 3187566862..ad0257a54c 100644 --- a/twilio/rest/sync/v1/service/sync_map/__init__.py +++ b/twilio/rest/sync/v1/service/sync_map/__init__.py @@ -1,245 +1,47 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Sync + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.sync.v1.service.sync_map.sync_map_item import SyncMapItemList -from twilio.rest.sync.v1.service.sync_map.sync_map_permission import SyncMapPermissionList - - -class SyncMapList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the SyncMapList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Sync Service that the resource is associated with - - :returns: twilio.rest.sync.v1.service.sync_map.SyncMapList - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapList - """ - super(SyncMapList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Maps'.format(**self._solution) +from twilio.base.version import Version - def create(self, unique_name=values.unset, ttl=values.unset, - collection_ttl=values.unset): - """ - Create the SyncMapInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode ttl: An alias for collection_ttl - :param unicode collection_ttl: How long, in seconds, before the Sync Map expires and is deleted - - :returns: The created SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapInstance - """ - data = values.of({'UniqueName': unique_name, 'Ttl': ttl, 'CollectionTtl': collection_ttl, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams SyncMapInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.sync.v1.service.sync_map.SyncMapInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SyncMapInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.sync_map.SyncMapInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncMapInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SyncMapPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncMapInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncMapPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SyncMapContext - - :param sid: The SID of the Sync Map resource to fetch - - :returns: twilio.rest.sync.v1.service.sync_map.SyncMapContext - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapContext - """ - return SyncMapContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SyncMapContext - - :param sid: The SID of the Sync Map resource to fetch - - :returns: twilio.rest.sync.v1.service.sync_map.SyncMapContext - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapContext - """ - return SyncMapContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SyncMapPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SyncMapPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Sync Service that the resource is associated with - - :returns: twilio.rest.sync.v1.service.sync_map.SyncMapPage - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapPage - """ - super(SyncMapPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncMapInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.sync.v1.service.sync_map.SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapInstance - """ - return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.sync_map.sync_map_item import SyncMapItemListInstancefrom twilio.rest.sync_map.sync_map_permission import SyncMapPermissionListInstance class SyncMapContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the SyncMapContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Sync Service with the Sync Map resource to fetch - :param sid: The SID of the Sync Map resource to fetch - - :returns: twilio.rest.sync.v1.service.sync_map.SyncMapContext - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapContext - """ - super(SyncMapContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Maps/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Maps/${sid}' + self._sync_map_items = None self._sync_map_permissions = None - - def fetch(self): - """ - Fetch the SyncMapInstance - - :returns: The fetched SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SyncMapInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the SyncMapInstance @@ -247,262 +49,136 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, ttl=values.unset, collection_ttl=values.unset): + + def fetch(self): + """ - Update the SyncMapInstance - - :param unicode ttl: An alias for collection_ttl - :param unicode collection_ttl: How long, in seconds, before the Sync Map expires and is deleted + Fetch the SyncMapInstance - :returns: The updated SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapInstance + :returns: The fetched SyncMapInstance + #TODO: add rtype docs """ - data = values.of({'Ttl': ttl, 'CollectionTtl': collection_ttl, }) + payload = self._version.fetch(method='GET', uri=self._uri, ) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - return SyncMapInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + + + def update(self, body): + data = values.of({ + 'body': body, + }) - @property - def sync_map_items(self): - """ - Access the sync_map_items + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemList - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemList - """ - if self._sync_map_items is None: - self._sync_map_items = SyncMapItemList( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['sid'], - ) - return self._sync_map_items + return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + - @property - def sync_map_permissions(self): - """ - Access the sync_map_permissions - - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionList - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionList - """ - if self._sync_map_permissions is None: - self._sync_map_permissions = SyncMapPermissionList( - self._version, - service_sid=self._solution['service_sid'], - map_sid=self._solution['sid'], - ) - return self._sync_map_permissions + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class SyncMapInstance(InstanceResource): - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the SyncMapInstance - :returns: twilio.rest.sync.v1.service.sync_map.SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapInstance - """ - super(SyncMapInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'url': payload.get('url'), - 'links': payload.get('links'), - 'revision': payload.get('revision'), - 'date_expires': deserialize.iso8601_datetime(payload.get('date_expires')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'created_by': payload.get('created_by'), +class SyncMapInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), + 'revision' : payload.get('revision'), + 'date_expires' : payload.get('date_expires'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'created_by' : payload.get('created_by'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncMapContext for this SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapContext - """ if self._context is None: self._context = SyncMapContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Sync Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def url(self): - """ - :returns: The absolute URL of the Sync Map resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The URLs of the Sync Map's nested resources - :rtype: unicode - """ - return self._properties['links'] - - @property - def revision(self): - """ - :returns: The current revision of the Sync Map, represented as a string - :rtype: unicode - """ - return self._properties['revision'] - - @property - def date_expires(self): - """ - :returns: The ISO 8601 date and time in GMT when the Sync Map expires - :rtype: datetime - """ - return self._properties['date_expires'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - + def sync_map_items(self): + return self._proxy.sync_map_items @property - def created_by(self): - """ - :returns: The identity of the Sync Map's creator - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch the SyncMapInstance - - :returns: The fetched SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the SyncMapInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() + def sync_map_permissions(self): + return self._proxy.sync_map_permissions + - def update(self, ttl=values.unset, collection_ttl=values.unset): + def __repr__(self): """ - Update the SyncMapInstance - - :param unicode ttl: An alias for collection_ttl - :param unicode collection_ttl: How long, in seconds, before the Sync Map expires and is deleted - - :returns: The updated SyncMapInstance - :rtype: twilio.rest.sync.v1.service.sync_map.SyncMapInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update(ttl=ttl, collection_ttl=collection_ttl, ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def sync_map_items(self): - """ - Access the sync_map_items - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemList - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemList - """ - return self._proxy.sync_map_items - @property - def sync_map_permissions(self): - """ - Access the sync_map_permissions +class SyncMapListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionList - :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionList - """ - return self._proxy.sync_map_permissions + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Maps' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SyncMapInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SyncMapPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/sync/v1/service/sync_stream.py b/twilio/rest/sync/v1/service/sync_stream.py deleted file mode 100644 index b77895e39f..0000000000 --- a/twilio/rest/sync/v1/service/sync_stream.py +++ /dev/null @@ -1,179 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Sync - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.sync_stream.stream_message import StreamMessageListInstance - - -class SyncStreamContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/Streams/${sid}' - - self._stream_messages = None - - def delete(self): - - - - """ - Deletes the SyncStreamInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the SyncStreamInstance - - :returns: The fetched SyncStreamInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SyncStreamInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return SyncStreamInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class SyncStreamInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - 'date_expires' : payload.get('date_expires'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'created_by' : payload.get('created_by'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = SyncStreamContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def stream_messages(self): - return self._proxy.stream_messages - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class SyncStreamListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Streams' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return SyncStreamInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return SyncStreamPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/sync/v1/service/sync_stream/__init__.py b/twilio/rest/sync/v1/service/sync_stream/__init__.py index 9f59826558..b77895e39f 100644 --- a/twilio/rest/sync/v1/service/sync_stream/__init__.py +++ b/twilio/rest/sync/v1/service/sync_stream/__init__.py @@ -1,241 +1,46 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Sync + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.sync.v1.service.sync_stream.stream_message import StreamMessageList - - -class SyncStreamList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the SyncStreamList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Sync Service that the resource is associated with - - :returns: twilio.rest.sync.v1.service.sync_stream.SyncStreamList - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamList - """ - super(SyncStreamList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Streams'.format(**self._solution) - - def create(self, unique_name=values.unset, ttl=values.unset): - """ - Create the SyncStreamInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode ttl: How long, in seconds, before the Stream expires and is deleted - - :returns: The created SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance - """ - data = values.of({'UniqueName': unique_name, 'Ttl': ttl, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return SyncStreamInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams SyncStreamInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SyncStreamInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SyncStreamInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SyncStreamPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SyncStreamInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SyncStreamPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SyncStreamContext - - :param sid: The SID of the Stream resource to fetch - - :returns: twilio.rest.sync.v1.service.sync_stream.SyncStreamContext - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamContext - """ - return SyncStreamContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SyncStreamContext - - :param sid: The SID of the Stream resource to fetch - - :returns: twilio.rest.sync.v1.service.sync_stream.SyncStreamContext - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamContext - """ - return SyncStreamContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SyncStreamPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SyncStreamPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Sync Service that the resource is associated with - - :returns: twilio.rest.sync.v1.service.sync_stream.SyncStreamPage - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamPage - """ - super(SyncStreamPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SyncStreamInstance - - :param dict payload: Payload response from the API +from twilio.base.version import Version - :returns: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance - """ - return SyncStreamInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.sync_stream.stream_message import StreamMessageListInstance class SyncStreamContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the SyncStreamContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Sync Service with the Sync Stream resource to fetch - :param sid: The SID of the Stream resource to fetch - - :returns: twilio.rest.sync.v1.service.sync_stream.SyncStreamContext - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamContext - """ - super(SyncStreamContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/Streams/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/Streams/${sid}' + self._stream_messages = None - - def fetch(self): - """ - Fetch the SyncStreamInstance - - :returns: The fetched SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SyncStreamInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - + def delete(self): + + + """ Deletes the SyncStreamInstance @@ -243,225 +48,132 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, ttl=values.unset): + + def fetch(self): + """ - Update the SyncStreamInstance - - :param unicode ttl: How long, in seconds, before the Stream expires and is deleted + Fetch the SyncStreamInstance - :returns: The updated SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance + :returns: The fetched SyncStreamInstance + #TODO: add rtype docs """ - data = values.of({'Ttl': ttl, }) + payload = self._version.fetch(method='GET', uri=self._uri, ) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + return SyncStreamInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - return SyncStreamInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + + + def update(self, body): + data = values.of({ + 'body': body, + }) - @property - def stream_messages(self): - """ - Access the stream_messages + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageList - :rtype: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageList - """ - if self._stream_messages is None: - self._stream_messages = StreamMessageList( - self._version, - service_sid=self._solution['service_sid'], - stream_sid=self._solution['sid'], - ) - return self._stream_messages + return SyncStreamInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + + + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class SyncStreamInstance(InstanceResource): - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the SyncStreamInstance - :returns: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance - """ - super(SyncStreamInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'url': payload.get('url'), - 'links': payload.get('links'), - 'date_expires': deserialize.iso8601_datetime(payload.get('date_expires')), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'created_by': payload.get('created_by'), +class SyncStreamInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), + 'date_expires' : payload.get('date_expires'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'created_by' : payload.get('created_by'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SyncStreamContext for this SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamContext - """ if self._context is None: self._context = SyncStreamContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Sync Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def url(self): - """ - :returns: The absolute URL of the Message Stream resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The URLs of the Stream's nested resources - :rtype: unicode - """ - return self._properties['links'] - - @property - def date_expires(self): - """ - :returns: The ISO 8601 date and time in GMT when the Message Stream expires - :rtype: datetime - """ - return self._properties['date_expires'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def created_by(self): - """ - :returns: The Identity of the Stream's creator - :rtype: unicode - """ - return self._properties['created_by'] - - def fetch(self): - """ - Fetch the SyncStreamInstance - - :returns: The fetched SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the SyncStreamInstance + def stream_messages(self): + return self._proxy.stream_messages + - :returns: True if delete succeeds, False otherwise - :rtype: bool + def __repr__(self): """ - return self._proxy.delete() - - def update(self, ttl=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the SyncStreamInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode ttl: How long, in seconds, before the Stream expires and is deleted - :returns: The updated SyncStreamInstance - :rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance - """ - return self._proxy.update(ttl=ttl, ) - @property - def stream_messages(self): - """ - Access the stream_messages +class SyncStreamListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageList - :rtype: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageList - """ - return self._proxy.stream_messages + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Streams' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return SyncStreamInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return SyncStreamPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace.py b/twilio/rest/taskrouter/v1/workspace.py deleted file mode 100644 index 7be23e30bb..0000000000 --- a/twilio/rest/taskrouter/v1/workspace.py +++ /dev/null @@ -1,220 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Taskrouter - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.workspace.activity import ActivityListInstancefrom twilio.rest.workspace.event import EventListInstancefrom twilio.rest.workspace.task import TaskListInstancefrom twilio.rest.workspace.task_channel import TaskChannelListInstancefrom twilio.rest.workspace.task_queue import TaskQueueListInstancefrom twilio.rest.workspace.worker import WorkerListInstancefrom twilio.rest.workspace.workflow import WorkflowListInstancefrom twilio.rest.workspace.workspace_cumulative_statistics import WorkspaceCumulativeStatisticsListInstancefrom twilio.rest.workspace.workspace_real_time_statistics import WorkspaceRealTimeStatisticsListInstancefrom twilio.rest.workspace.workspace_statistics import WorkspaceStatisticsListInstance - - -class WorkspaceContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Workspaces/${sid}' - - self._activities = None - self._events = None - self._tasks = None - self._task_channels = None - self._task_queues = None - self._workers = None - self._workflows = None - self._cumulative_statistics = None - self._real_time_statistics = None - self._statistics = None - - def delete(self): - - - - """ - Deletes the WorkspaceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the WorkspaceInstance - - :returns: The fetched WorkspaceInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return WorkspaceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return WorkspaceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class WorkspaceInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'default_activity_name' : payload.get('default_activity_name'), - 'default_activity_sid' : payload.get('default_activity_sid'), - 'event_callback_url' : payload.get('event_callback_url'), - 'events_filter' : payload.get('events_filter'), - 'friendly_name' : payload.get('friendly_name'), - 'multi_task_enabled' : payload.get('multi_task_enabled'), - 'sid' : payload.get('sid'), - 'timeout_activity_name' : payload.get('timeout_activity_name'), - 'timeout_activity_sid' : payload.get('timeout_activity_sid'), - 'prioritize_queue_order' : payload.get('prioritize_queue_order'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = WorkspaceContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def activities(self): - return self._proxy.activities - @property - def events(self): - return self._proxy.events - @property - def tasks(self): - return self._proxy.tasks - @property - def task_channels(self): - return self._proxy.task_channels - @property - def task_queues(self): - return self._proxy.task_queues - @property - def workers(self): - return self._proxy.workers - @property - def workflows(self): - return self._proxy.workflows - @property - def cumulative_statistics(self): - return self._proxy.cumulative_statistics - @property - def real_time_statistics(self): - return self._proxy.real_time_statistics - @property - def statistics(self): - return self._proxy.statistics - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class WorkspaceListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Workspaces' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return WorkspaceInstance(self._version, payload, ) - - """ - - """ - def page(self, friendly_name, page_size): - - data = values.of({ - 'friendly_name': friendly_name,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return WorkspacePage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/taskrouter/v1/workspace/__init__.py b/twilio/rest/taskrouter/v1/workspace/__init__.py index 995a2dd06b..7be23e30bb 100644 --- a/twilio/rest/taskrouter/v1/workspace/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/__init__.py @@ -1,774 +1,220 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.taskrouter.v1.workspace.activity import ActivityList -from twilio.rest.taskrouter.v1.workspace.event import EventList -from twilio.rest.taskrouter.v1.workspace.task import TaskList -from twilio.rest.taskrouter.v1.workspace.task_channel import TaskChannelList -from twilio.rest.taskrouter.v1.workspace.task_queue import TaskQueueList -from twilio.rest.taskrouter.v1.workspace.worker import WorkerList -from twilio.rest.taskrouter.v1.workspace.workflow import WorkflowList -from twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics import WorkspaceCumulativeStatisticsList -from twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics import WorkspaceRealTimeStatisticsList -from twilio.rest.taskrouter.v1.workspace.workspace_statistics import WorkspaceStatisticsList - - -class WorkspaceList(ListResource): - - def __init__(self, version): - """ - Initialize the WorkspaceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.taskrouter.v1.workspace.WorkspaceList - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceList - """ - super(WorkspaceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Workspaces'.format(**self._solution) - - def stream(self, friendly_name=values.unset, limit=None, page_size=None): - """ - Streams WorkspaceInstance 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 unicode friendly_name: The friendly_name of the Workspace resources to read - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.taskrouter.v1.workspace.WorkspaceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(friendly_name=friendly_name, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, friendly_name=values.unset, limit=None, page_size=None): - """ - Lists WorkspaceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode friendly_name: The friendly_name of the Workspace resources to read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.WorkspaceInstance] - """ - return list(self.stream(friendly_name=friendly_name, limit=limit, page_size=page_size, )) - - def page(self, friendly_name=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of WorkspaceInstance records from the API. - Request is executed immediately - - :param unicode friendly_name: The friendly_name of the Workspace resources to read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspacePage - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return WorkspacePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of WorkspaceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspacePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return WorkspacePage(self._version, response, self._solution) - - def create(self, friendly_name, event_callback_url=values.unset, - events_filter=values.unset, multi_task_enabled=values.unset, - template=values.unset, prioritize_queue_order=values.unset): - """ - Create the WorkspaceInstance - - :param unicode friendly_name: A string to describe the Workspace resource - :param unicode event_callback_url: The URL we should call when an event occurs - :param unicode events_filter: The list of Workspace events for which to call event_callback_url - :param bool multi_task_enabled: Whether multi-tasking is enabled - :param unicode template: An available template name - :param WorkspaceInstance.QueueOrder prioritize_queue_order: The type of TaskQueue to prioritize when Workers are receiving Tasks from both types of TaskQueues - - :returns: The created WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'EventCallbackUrl': event_callback_url, - 'EventsFilter': events_filter, - 'MultiTaskEnabled': multi_task_enabled, - 'Template': template, - 'PrioritizeQueueOrder': prioritize_queue_order, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return WorkspaceInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a WorkspaceContext - - :param sid: The SID of the resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.WorkspaceContext - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceContext - """ - return WorkspaceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a WorkspaceContext - - :param sid: The SID of the resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.WorkspaceContext - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceContext - """ - return WorkspaceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base.version import Version +from twilio.base.page import Page -class WorkspacePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the WorkspacePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.WorkspacePage - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspacePage - """ - super(WorkspacePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkspaceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceInstance - """ - return WorkspaceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.workspace.activity import ActivityListInstancefrom twilio.rest.workspace.event import EventListInstancefrom twilio.rest.workspace.task import TaskListInstancefrom twilio.rest.workspace.task_channel import TaskChannelListInstancefrom twilio.rest.workspace.task_queue import TaskQueueListInstancefrom twilio.rest.workspace.worker import WorkerListInstancefrom twilio.rest.workspace.workflow import WorkflowListInstancefrom twilio.rest.workspace.workspace_cumulative_statistics import WorkspaceCumulativeStatisticsListInstancefrom twilio.rest.workspace.workspace_real_time_statistics import WorkspaceRealTimeStatisticsListInstancefrom twilio.rest.workspace.workspace_statistics import WorkspaceStatisticsListInstance class WorkspaceContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the WorkspaceContext - - :param Version version: Version that contains the resource - :param sid: The SID of the resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.WorkspaceContext - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceContext - """ - super(WorkspaceContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Workspaces/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Workspaces/${sid}' + self._activities = None self._events = None self._tasks = None + self._task_channels = None self._task_queues = None self._workers = None self._workflows = None - self._statistics = None - self._real_time_statistics = None self._cumulative_statistics = None - self._task_channels = None + self._real_time_statistics = None + self._statistics = None + + def delete(self): + + + + """ + Deletes the WorkspaceInstance + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the WorkspaceInstance :returns: The fetched WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return WorkspaceInstance(self._version, payload, sid=self._solution['sid'], ) + - def update(self, default_activity_sid=values.unset, - event_callback_url=values.unset, events_filter=values.unset, - friendly_name=values.unset, multi_task_enabled=values.unset, - timeout_activity_sid=values.unset, - prioritize_queue_order=values.unset): - """ - Update the WorkspaceInstance - - :param unicode default_activity_sid: The SID of the Activity that will be used when new Workers are created in the Workspace - :param unicode event_callback_url: The URL we should call when an event occurs - :param unicode events_filter: The list of Workspace events for which to call event_callback_url - :param unicode friendly_name: A string to describe the Workspace resource - :param bool multi_task_enabled: Whether multi-tasking is enabled - :param unicode timeout_activity_sid: The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response - :param WorkspaceInstance.QueueOrder prioritize_queue_order: The type of TaskQueue to prioritize when Workers are receiving Tasks from both types of TaskQueues - - :returns: The updated WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceInstance - """ + + + def update(self, body): data = values.of({ - 'DefaultActivitySid': default_activity_sid, - 'EventCallbackUrl': event_callback_url, - 'EventsFilter': events_filter, - 'FriendlyName': friendly_name, - 'MultiTaskEnabled': multi_task_enabled, - 'TimeoutActivitySid': timeout_activity_sid, - 'PrioritizeQueueOrder': prioritize_queue_order, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return WorkspaceInstance(self._version, payload, sid=self._solution['sid'], ) + + - def delete(self): - """ - Deletes the WorkspaceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def activities(self): - """ - Access the activities - - :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityList - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityList - """ - if self._activities is None: - self._activities = ActivityList(self._version, workspace_sid=self._solution['sid'], ) - return self._activities - - @property - def events(self): - """ - Access the events - - :returns: twilio.rest.taskrouter.v1.workspace.event.EventList - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventList - """ - if self._events is None: - self._events = EventList(self._version, workspace_sid=self._solution['sid'], ) - return self._events - - @property - def tasks(self): - """ - Access the tasks - - :returns: twilio.rest.taskrouter.v1.workspace.task.TaskList - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskList - """ - if self._tasks is None: - self._tasks = TaskList(self._version, workspace_sid=self._solution['sid'], ) - return self._tasks - - @property - def task_queues(self): - """ - Access the task_queues - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueList - """ - if self._task_queues is None: - self._task_queues = TaskQueueList(self._version, workspace_sid=self._solution['sid'], ) - return self._task_queues - - @property - def workers(self): - """ - Access the workers - - :returns: twilio.rest.taskrouter.v1.workspace.worker.WorkerList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerList - """ - if self._workers is None: - self._workers = WorkerList(self._version, workspace_sid=self._solution['sid'], ) - return self._workers - - @property - def workflows(self): - """ - Access the workflows - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowList - """ - if self._workflows is None: - self._workflows = WorkflowList(self._version, workspace_sid=self._solution['sid'], ) - return self._workflows - - @property - def statistics(self): - """ - Access the statistics - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsList - """ - if self._statistics is None: - self._statistics = WorkspaceStatisticsList(self._version, workspace_sid=self._solution['sid'], ) - return self._statistics - - @property - def real_time_statistics(self): - """ - Access the real_time_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsList - """ - if self._real_time_statistics is None: - self._real_time_statistics = WorkspaceRealTimeStatisticsList( - self._version, - workspace_sid=self._solution['sid'], - ) - return self._real_time_statistics - - @property - def cumulative_statistics(self): - """ - Access the cumulative_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsList - """ - if self._cumulative_statistics is None: - self._cumulative_statistics = WorkspaceCumulativeStatisticsList( - self._version, - workspace_sid=self._solution['sid'], - ) - return self._cumulative_statistics - - @property - def task_channels(self): - """ - Access the task_channels - - :returns: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelList - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelList - """ - if self._task_channels is None: - self._task_channels = TaskChannelList(self._version, workspace_sid=self._solution['sid'], ) - return self._task_channels + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class WorkspaceInstance(InstanceResource): + return '' - class QueueOrder(object): - FIFO = "FIFO" - LIFO = "LIFO" - def __init__(self, version, payload, sid=None): - """ - Initialize the WorkspaceInstance - :returns: twilio.rest.taskrouter.v1.workspace.WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceInstance - """ - super(WorkspaceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'default_activity_name': payload.get('default_activity_name'), - 'default_activity_sid': payload.get('default_activity_sid'), - 'event_callback_url': payload.get('event_callback_url'), - 'events_filter': payload.get('events_filter'), - 'friendly_name': payload.get('friendly_name'), - 'multi_task_enabled': payload.get('multi_task_enabled'), - 'sid': payload.get('sid'), - 'timeout_activity_name': payload.get('timeout_activity_name'), - 'timeout_activity_sid': payload.get('timeout_activity_sid'), - 'prioritize_queue_order': payload.get('prioritize_queue_order'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class WorkspaceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'default_activity_name' : payload.get('default_activity_name'), + 'default_activity_sid' : payload.get('default_activity_sid'), + 'event_callback_url' : payload.get('event_callback_url'), + 'events_filter' : payload.get('events_filter'), + 'friendly_name' : payload.get('friendly_name'), + 'multi_task_enabled' : payload.get('multi_task_enabled'), + 'sid' : payload.get('sid'), + 'timeout_activity_name' : payload.get('timeout_activity_name'), + 'timeout_activity_sid' : payload.get('timeout_activity_sid'), + 'prioritize_queue_order' : payload.get('prioritize_queue_order'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkspaceContext for this WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceContext - """ if self._context is None: - self._context = WorkspaceContext(self._version, sid=self._solution['sid'], ) + self._context = WorkspaceContext( + self._version, + sid=self._solution['sid'], + ) return self._context - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def default_activity_name(self): - """ - :returns: The name of the default activity - :rtype: unicode - """ - return self._properties['default_activity_name'] - - @property - def default_activity_sid(self): - """ - :returns: The SID of the Activity that will be used when new Workers are created in the Workspace - :rtype: unicode - """ - return self._properties['default_activity_sid'] - - @property - def event_callback_url(self): - """ - :returns: The URL we call when an event occurs - :rtype: unicode - """ - return self._properties['event_callback_url'] - - @property - def events_filter(self): - """ - :returns: The list of Workspace events for which to call event_callback_url - :rtype: unicode - """ - return self._properties['events_filter'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the Workspace resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def multi_task_enabled(self): - """ - :returns: Whether multi-tasking is enabled - :rtype: bool - """ - return self._properties['multi_task_enabled'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def timeout_activity_name(self): - """ - :returns: The name of the timeout activity - :rtype: unicode - """ - return self._properties['timeout_activity_name'] - - @property - def timeout_activity_sid(self): - """ - :returns: The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response - :rtype: unicode - """ - return self._properties['timeout_activity_sid'] - - @property - def prioritize_queue_order(self): - """ - :returns: The type of TaskQueue to prioritize when Workers are receiving Tasks from both types of TaskQueues - :rtype: WorkspaceInstance.QueueOrder - """ - return self._properties['prioritize_queue_order'] - - @property - def url(self): - """ - :returns: The absolute URL of the Workspace resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the WorkspaceInstance - - :returns: The fetched WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceInstance - """ - return self._proxy.fetch() - - def update(self, default_activity_sid=values.unset, - event_callback_url=values.unset, events_filter=values.unset, - friendly_name=values.unset, multi_task_enabled=values.unset, - timeout_activity_sid=values.unset, - prioritize_queue_order=values.unset): - """ - Update the WorkspaceInstance - - :param unicode default_activity_sid: The SID of the Activity that will be used when new Workers are created in the Workspace - :param unicode event_callback_url: The URL we should call when an event occurs - :param unicode events_filter: The list of Workspace events for which to call event_callback_url - :param unicode friendly_name: A string to describe the Workspace resource - :param bool multi_task_enabled: Whether multi-tasking is enabled - :param unicode timeout_activity_sid: The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response - :param WorkspaceInstance.QueueOrder prioritize_queue_order: The type of TaskQueue to prioritize when Workers are receiving Tasks from both types of TaskQueues - - :returns: The updated WorkspaceInstance - :rtype: twilio.rest.taskrouter.v1.workspace.WorkspaceInstance - """ - return self._proxy.update( - default_activity_sid=default_activity_sid, - event_callback_url=event_callback_url, - events_filter=events_filter, - friendly_name=friendly_name, - multi_task_enabled=multi_task_enabled, - timeout_activity_sid=timeout_activity_sid, - prioritize_queue_order=prioritize_queue_order, - ) - - def delete(self): - """ - Deletes the WorkspaceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - @property def activities(self): - """ - Access the activities - - :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityList - :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityList - """ return self._proxy.activities - @property def events(self): - """ - Access the events - - :returns: twilio.rest.taskrouter.v1.workspace.event.EventList - :rtype: twilio.rest.taskrouter.v1.workspace.event.EventList - """ return self._proxy.events - @property def tasks(self): - """ - Access the tasks - - :returns: twilio.rest.taskrouter.v1.workspace.task.TaskList - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskList - """ return self._proxy.tasks - + @property + def task_channels(self): + return self._proxy.task_channels @property def task_queues(self): - """ - Access the task_queues - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueList - """ return self._proxy.task_queues - @property def workers(self): - """ - Access the workers - - :returns: twilio.rest.taskrouter.v1.workspace.worker.WorkerList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerList - """ return self._proxy.workers - @property def workflows(self): - """ - Access the workflows - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowList - """ return self._proxy.workflows - + @property + def cumulative_statistics(self): + return self._proxy.cumulative_statistics + @property + def real_time_statistics(self): + return self._proxy.real_time_statistics @property def statistics(self): - """ - Access the statistics - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsList - """ return self._proxy.statistics + - @property - def real_time_statistics(self): + def __repr__(self): """ - Access the real_time_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_real_time_statistics.WorkspaceRealTimeStatisticsList + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.real_time_statistics + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def cumulative_statistics(self): - """ - Access the cumulative_statistics - :returns: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workspace_cumulative_statistics.WorkspaceCumulativeStatisticsList - """ - return self._proxy.cumulative_statistics - @property - def task_channels(self): - """ - Access the task_channels +class WorkspaceListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelList - :rtype: twilio.rest.taskrouter.v1.workspace.task_channel.TaskChannelList - """ - return self._proxy.task_channels + # Path Solution + self._solution = { } + self._uri = '/Workspaces' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return WorkspaceInstance(self._version, payload, ) + + """ + + """ + def page(self, friendly_name, page_size): + + data = values.of({ + 'friendly_name': friendly_name,'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return WorkspacePage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/task.py b/twilio/rest/taskrouter/v1/workspace/task.py deleted file mode 100644 index c73aad90df..0000000000 --- a/twilio/rest/taskrouter/v1/workspace/task.py +++ /dev/null @@ -1,190 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Taskrouter - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.task.reservation import ReservationListInstance - - -class TaskContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'workspace_sid': workspace_sid, 'sid': sid, } - self._uri = '/Workspaces/${workspace_sid}/Tasks/${sid}' - - self._reservations = None - - def delete(self, if_match): - - - - """ - Deletes the TaskInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the TaskInstance - - :returns: The fetched TaskInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TaskInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) - - - - - def update(self, if_match, body): - data = values.of({ - 'if_match': if_match,'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return TaskInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class TaskInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'age' : payload.get('age'), - 'assignment_status' : payload.get('assignment_status'), - 'attributes' : payload.get('attributes'), - 'addons' : payload.get('addons'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'task_queue_entered_date' : payload.get('task_queue_entered_date'), - 'priority' : payload.get('priority'), - 'reason' : payload.get('reason'), - 'sid' : payload.get('sid'), - 'task_queue_sid' : payload.get('task_queue_sid'), - 'task_queue_friendly_name' : payload.get('task_queue_friendly_name'), - 'task_channel_sid' : payload.get('task_channel_sid'), - 'task_channel_unique_name' : payload.get('task_channel_unique_name'), - 'timeout' : payload.get('timeout'), - 'workflow_sid' : payload.get('workflow_sid'), - 'workflow_friendly_name' : payload.get('workflow_friendly_name'), - 'workspace_sid' : payload.get('workspace_sid'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'workspace_sid': workspace_sid or self._properties['workspace_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = TaskContext( - self._version, - workspace_sid=self._solution['workspace_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def reservations(self): - return self._proxy.reservations - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class TaskListInstance(ListResource): - def __init__(self, version: Version, workspace_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/${workspace_sid}/Tasks' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return TaskInstance(self._version, payload, workspace_sid=self._solution['workspace_sid']) - - """ - - """ - def page(self, priority, assignment_status, workflow_sid, workflow_name, task_queue_sid, task_queue_name, evaluate_task_attributes, ordering, has_addons, page_size): - - data = values.of({ - 'priority': priority,'assignment_status': assignment_status,'workflow_sid': workflow_sid,'workflow_name': workflow_name,'task_queue_sid': task_queue_sid,'task_queue_name': task_queue_name,'evaluate_task_attributes': evaluate_task_attributes,'ordering': ordering,'has_addons': has_addons,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return TaskPage(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/taskrouter/v1/workspace/task/__init__.py b/twilio/rest/taskrouter/v1/workspace/task/__init__.py index 8b9d2e96ae..c73aad90df 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,684 +19,172 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.taskrouter.v1.workspace.task.reservation import ReservationList - - -class TaskList(ListResource): - - def __init__(self, version, workspace_sid): - """ - Initialize the TaskList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that contains the Task - - :returns: twilio.rest.taskrouter.v1.workspace.task.TaskList - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskList - """ - super(TaskList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/Tasks'.format(**self._solution) - - def stream(self, priority=values.unset, assignment_status=values.unset, - workflow_sid=values.unset, workflow_name=values.unset, - task_queue_sid=values.unset, task_queue_name=values.unset, - evaluate_task_attributes=values.unset, ordering=values.unset, - has_addons=values.unset, limit=None, page_size=None): - """ - Streams TaskInstance 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 unicode priority: The priority value of the Tasks to read - :param list[unicode] assignment_status: Returns the list of all Tasks in the Workspace with the specified assignment_status - :param unicode workflow_sid: The SID of the Workflow with the Tasks to read - :param unicode workflow_name: The friendly name of the Workflow with the Tasks to read - :param unicode task_queue_sid: The SID of the TaskQueue with the Tasks to read - :param unicode task_queue_name: The friendly_name of the TaskQueue with the Tasks to read - :param unicode evaluate_task_attributes: The task attributes of the Tasks to read - :param unicode ordering: Controls the order of the Tasks returned - :param bool has_addons: Whether to read Tasks with addons - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.taskrouter.v1.workspace.task.TaskInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - priority=priority, - assignment_status=assignment_status, - workflow_sid=workflow_sid, - workflow_name=workflow_name, - task_queue_sid=task_queue_sid, - task_queue_name=task_queue_name, - evaluate_task_attributes=evaluate_task_attributes, - ordering=ordering, - has_addons=has_addons, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, priority=values.unset, assignment_status=values.unset, - workflow_sid=values.unset, workflow_name=values.unset, - task_queue_sid=values.unset, task_queue_name=values.unset, - evaluate_task_attributes=values.unset, ordering=values.unset, - has_addons=values.unset, limit=None, page_size=None): - """ - Lists TaskInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode priority: The priority value of the Tasks to read - :param list[unicode] assignment_status: Returns the list of all Tasks in the Workspace with the specified assignment_status - :param unicode workflow_sid: The SID of the Workflow with the Tasks to read - :param unicode workflow_name: The friendly name of the Workflow with the Tasks to read - :param unicode task_queue_sid: The SID of the TaskQueue with the Tasks to read - :param unicode task_queue_name: The friendly_name of the TaskQueue with the Tasks to read - :param unicode evaluate_task_attributes: The task attributes of the Tasks to read - :param unicode ordering: Controls the order of the Tasks returned - :param bool has_addons: Whether to read Tasks with addons - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.task.TaskInstance] - """ - return list(self.stream( - priority=priority, - assignment_status=assignment_status, - workflow_sid=workflow_sid, - workflow_name=workflow_name, - task_queue_sid=task_queue_sid, - task_queue_name=task_queue_name, - evaluate_task_attributes=evaluate_task_attributes, - ordering=ordering, - has_addons=has_addons, - limit=limit, - page_size=page_size, - )) - - def page(self, priority=values.unset, assignment_status=values.unset, - workflow_sid=values.unset, workflow_name=values.unset, - task_queue_sid=values.unset, task_queue_name=values.unset, - evaluate_task_attributes=values.unset, ordering=values.unset, - has_addons=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of TaskInstance records from the API. - Request is executed immediately - - :param unicode priority: The priority value of the Tasks to read - :param list[unicode] assignment_status: Returns the list of all Tasks in the Workspace with the specified assignment_status - :param unicode workflow_sid: The SID of the Workflow with the Tasks to read - :param unicode workflow_name: The friendly name of the Workflow with the Tasks to read - :param unicode task_queue_sid: The SID of the TaskQueue with the Tasks to read - :param unicode task_queue_name: The friendly_name of the TaskQueue with the Tasks to read - :param unicode evaluate_task_attributes: The task attributes of the Tasks to read - :param unicode ordering: Controls the order of the Tasks returned - :param bool has_addons: Whether to read Tasks with addons - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskPage - """ - data = values.of({ - 'Priority': priority, - 'AssignmentStatus': serialize.map(assignment_status, lambda e: e), - 'WorkflowSid': workflow_sid, - 'WorkflowName': workflow_name, - 'TaskQueueSid': task_queue_sid, - 'TaskQueueName': task_queue_name, - 'EvaluateTaskAttributes': evaluate_task_attributes, - 'Ordering': ordering, - 'HasAddons': has_addons, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return TaskPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TaskInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TaskPage(self._version, response, self._solution) - - def create(self, timeout=values.unset, priority=values.unset, - task_channel=values.unset, workflow_sid=values.unset, - attributes=values.unset): - """ - Create the TaskInstance - - :param unicode timeout: The amount of time in seconds the task can live before being assigned - :param unicode priority: The priority to assign the new task and override the default - :param unicode task_channel: When MultiTasking is enabled specify the TaskChannel by passing either its unique_name or SID - :param unicode workflow_sid: The SID of the Workflow that you would like to handle routing for the new Task - :param unicode attributes: A URL-encoded JSON string describing the attributes of the task - - :returns: The created TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskInstance - """ - data = values.of({ - 'Timeout': timeout, - 'Priority': priority, - 'TaskChannel': task_channel, - 'WorkflowSid': workflow_sid, - 'Attributes': attributes, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return TaskInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - def get(self, sid): - """ - Constructs a TaskContext - - :param sid: The SID of the resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.task.TaskContext - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskContext - """ - return TaskContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a TaskContext - - :param sid: The SID of the resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.task.TaskContext - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskContext - """ - return TaskContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - +from twilio.base.version import Version -class TaskPage(Page): +from twilio.base.page import Page - def __init__(self, version, response, solution): - """ - Initialize the TaskPage +# from twilio.rest.task.reservation import ReservationListInstance - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that contains the Task - :returns: twilio.rest.taskrouter.v1.workspace.task.TaskPage - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskPage - """ - super(TaskPage, self).__init__(version, response) +class TaskContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TaskInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.task.TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskInstance - """ - return TaskInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TaskContext(InstanceContext): + self._solution = { 'workspace_sid': workspace_sid, 'sid': sid, } + self._uri = '/Workspaces/${workspace_sid}/Tasks/${sid}' + + self._reservations = None + + def delete(self, if_match): + + - def __init__(self, version, workspace_sid, sid): """ - Initialize the TaskContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the Task to fetch - :param sid: The SID of the resource to fetch + Deletes the TaskInstance - :returns: twilio.rest.taskrouter.v1.workspace.task.TaskContext - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskContext + :returns: True if delete succeeds, False otherwise + :rtype: bool """ - super(TaskContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/Tasks/{sid}'.format(**self._solution) - - # Dependents - self._reservations = None - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the TaskInstance :returns: The fetched TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return TaskInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def update(self, attributes=values.unset, assignment_status=values.unset, - reason=values.unset, priority=values.unset, - task_channel=values.unset, if_match=values.unset): - """ - Update the TaskInstance - - :param unicode attributes: The JSON string that describes the custom attributes of the task - :param TaskInstance.Status assignment_status: The new status of the task - :param unicode reason: The reason that the Task was canceled or complete - :param unicode priority: The Task's new priority value - :param unicode task_channel: When MultiTasking is enabled, specify the TaskChannel with the task to update - :param unicode if_match: The If-Match HTTP request header + return TaskInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) + - :returns: The updated TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskInstance - """ + + + def update(self, if_match, body): data = values.of({ - 'Attributes': attributes, - 'AssignmentStatus': assignment_status, - 'Reason': reason, - 'Priority': priority, - 'TaskChannel': task_channel, + 'if_match': if_match,'body': body, }) - headers = values.of({'If-Match': if_match, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) - return TaskInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - def delete(self, if_match=values.unset): - """ - Deletes the TaskInstance + return TaskInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) + + - :param unicode if_match: The If-Match HTTP request header - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - headers = values.of({'If-Match': if_match, }) - - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) - - @property - def reservations(self): - """ - Access the reservations - - :returns: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationList - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationList - """ - if self._reservations is None: - self._reservations = ReservationList( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_sid=self._solution['sid'], - ) - return self._reservations + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class TaskInstance(InstanceResource): - class Status(object): - PENDING = "pending" - RESERVED = "reserved" - ASSIGNED = "assigned" - CANCELED = "canceled" - COMPLETED = "completed" - WRAPPING = "wrapping" - def __init__(self, version, payload, workspace_sid, sid=None): - """ - Initialize the TaskInstance - - :returns: twilio.rest.taskrouter.v1.workspace.task.TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskInstance - """ - super(TaskInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'age': deserialize.integer(payload.get('age')), - 'assignment_status': payload.get('assignment_status'), - 'attributes': payload.get('attributes'), - 'addons': payload.get('addons'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'task_queue_entered_date': deserialize.iso8601_datetime(payload.get('task_queue_entered_date')), - 'priority': deserialize.integer(payload.get('priority')), - 'reason': payload.get('reason'), - 'sid': payload.get('sid'), - 'task_queue_sid': payload.get('task_queue_sid'), - 'task_queue_friendly_name': payload.get('task_queue_friendly_name'), - 'task_channel_sid': payload.get('task_channel_sid'), - 'task_channel_unique_name': payload.get('task_channel_unique_name'), - 'timeout': deserialize.integer(payload.get('timeout')), - 'workflow_sid': payload.get('workflow_sid'), - 'workflow_friendly_name': payload.get('workflow_friendly_name'), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class TaskInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'age' : payload.get('age'), + 'assignment_status' : payload.get('assignment_status'), + 'attributes' : payload.get('attributes'), + 'addons' : payload.get('addons'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'task_queue_entered_date' : payload.get('task_queue_entered_date'), + 'priority' : payload.get('priority'), + 'reason' : payload.get('reason'), + 'sid' : payload.get('sid'), + 'task_queue_sid' : payload.get('task_queue_sid'), + 'task_queue_friendly_name' : payload.get('task_queue_friendly_name'), + 'task_channel_sid' : payload.get('task_channel_sid'), + 'task_channel_unique_name' : payload.get('task_channel_unique_name'), + 'timeout' : payload.get('timeout'), + 'workflow_sid' : payload.get('workflow_sid'), + 'workflow_friendly_name' : payload.get('workflow_friendly_name'), + 'workspace_sid' : payload.get('workspace_sid'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TaskContext for this TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskContext - """ if self._context is None: self._context = TaskContext( self._version, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], + workspace_sid=self._solution['workspace_sid'],sid=self._solution['sid'], ) return self._context @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def age(self): - """ - :returns: The number of seconds since the Task was created - :rtype: unicode - """ - return self._properties['age'] - - @property - def assignment_status(self): - """ - :returns: The current status of the Task's assignment - :rtype: TaskInstance.Status - """ - return self._properties['assignment_status'] - - @property - def attributes(self): - """ - :returns: The JSON string with custom attributes of the work - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def addons(self): - """ - :returns: An object that contains the addon data for all installed addons - :rtype: unicode - """ - return self._properties['addons'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def task_queue_entered_date(self): - """ - :returns: The ISO 8601 date and time in GMT when the Task entered the TaskQueue. - :rtype: datetime - """ - return self._properties['task_queue_entered_date'] - - @property - def priority(self): - """ - :returns: Retrieve the list of all Tasks in the Workspace with the specified priority - :rtype: unicode - """ - return self._properties['priority'] - - @property - def reason(self): - """ - :returns: The reason the Task was canceled or completed - :rtype: unicode - """ - return self._properties['reason'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def task_queue_sid(self): - """ - :returns: The SID of the TaskQueue - :rtype: unicode - """ - return self._properties['task_queue_sid'] - - @property - def task_queue_friendly_name(self): - """ - :returns: The friendly name of the TaskQueue - :rtype: unicode - """ - return self._properties['task_queue_friendly_name'] - - @property - def task_channel_sid(self): - """ - :returns: The SID of the TaskChannel - :rtype: unicode - """ - return self._properties['task_channel_sid'] - - @property - def task_channel_unique_name(self): - """ - :returns: The unique name of the TaskChannel - :rtype: unicode - """ - return self._properties['task_channel_unique_name'] - - @property - def timeout(self): - """ - :returns: The amount of time in seconds that the Task can live before being assigned - :rtype: unicode - """ - return self._properties['timeout'] - - @property - def workflow_sid(self): - """ - :returns: The SID of the Workflow that is controlling the Task - :rtype: unicode - """ - return self._properties['workflow_sid'] - - @property - def workflow_friendly_name(self): - """ - :returns: The friendly name of the Workflow that is controlling the Task - :rtype: unicode - """ - return self._properties['workflow_friendly_name'] - - @property - def workspace_sid(self): - """ - :returns: The SID of the Workspace that contains the Task - :rtype: unicode - """ - return self._properties['workspace_sid'] - - @property - def url(self): - """ - :returns: The absolute URL of the Task resource - :rtype: unicode - """ - return self._properties['url'] + def reservations(self): + return self._proxy.reservations + - @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode + def __repr__(self): """ - return self._properties['links'] - - def fetch(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Fetch the TaskInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: The fetched TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskInstance - """ - return self._proxy.fetch() - def update(self, attributes=values.unset, assignment_status=values.unset, - reason=values.unset, priority=values.unset, - task_channel=values.unset, if_match=values.unset): - """ - Update the TaskInstance - :param unicode attributes: The JSON string that describes the custom attributes of the task - :param TaskInstance.Status assignment_status: The new status of the task - :param unicode reason: The reason that the Task was canceled or complete - :param unicode priority: The Task's new priority value - :param unicode task_channel: When MultiTasking is enabled, specify the TaskChannel with the task to update - :param unicode if_match: The If-Match HTTP request header +class TaskListInstance(ListResource): + def __init__(self, version: Version, workspace_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The updated TaskInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task.TaskInstance - """ - return self._proxy.update( - attributes=attributes, - assignment_status=assignment_status, - reason=reason, - priority=priority, - task_channel=task_channel, - if_match=if_match, - ) - - def delete(self, if_match=values.unset): - """ - Deletes the TaskInstance + # Path Solution + self._solution = { 'workspace_sid': workspace_sid, } + self._uri = '/Workspaces/${workspace_sid}/Tasks' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - :param unicode if_match: The If-Match HTTP request header + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete(if_match=if_match, ) + return TaskInstance(self._version, payload, workspace_sid=self._solution['workspace_sid']) + + """ + + """ + def page(self, priority, assignment_status, workflow_sid, workflow_name, task_queue_sid, task_queue_name, evaluate_task_attributes, ordering, has_addons, page_size): + + data = values.of({ + 'priority': priority,'assignment_status': assignment_status,'workflow_sid': workflow_sid,'workflow_name': workflow_name,'task_queue_sid': task_queue_sid,'task_queue_name': task_queue_name,'evaluate_task_attributes': evaluate_task_attributes,'ordering': ordering,'has_addons': has_addons,'page_size': page_size, + }) - @property - def reservations(self): - """ - Access the reservations + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationList - :rtype: twilio.rest.taskrouter.v1.workspace.task.reservation.ReservationList - """ - return self._proxy.reservations + return TaskPage(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue.py b/twilio/rest/taskrouter/v1/workspace/task_queue.py deleted file mode 100644 index 0ada3f290e..0000000000 --- a/twilio/rest/taskrouter/v1/workspace/task_queue.py +++ /dev/null @@ -1,193 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Taskrouter - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.task_queue.task_queue_cumulative_statistics import TaskQueueCumulativeStatisticsListInstancefrom twilio.rest.task_queue.task_queue_real_time_statistics import TaskQueueRealTimeStatisticsListInstancefrom twilio.rest.task_queue.task_queue_statistics import TaskQueueStatisticsListInstancefrom twilio.rest.task_queue.task_queues_statistics import TaskQueuesStatisticsListInstance - - -class TaskQueueContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'workspace_sid': workspace_sid, 'sid': sid, } - self._uri = '/Workspaces/${workspace_sid}/TaskQueues/${sid}' - - self._cumulative_statistics = None - self._real_time_statistics = None - self._statistics = None - - def delete(self): - - - - """ - Deletes the TaskQueueInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the TaskQueueInstance - - :returns: The fetched TaskQueueInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TaskQueueInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return TaskQueueInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class TaskQueueInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'assignment_activity_sid' : payload.get('assignment_activity_sid'), - 'assignment_activity_name' : payload.get('assignment_activity_name'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'friendly_name' : payload.get('friendly_name'), - 'max_reserved_workers' : payload.get('max_reserved_workers'), - 'reservation_activity_sid' : payload.get('reservation_activity_sid'), - 'reservation_activity_name' : payload.get('reservation_activity_name'), - 'sid' : payload.get('sid'), - 'target_workers' : payload.get('target_workers'), - 'task_order' : payload.get('task_order'), - 'url' : payload.get('url'), - 'workspace_sid' : payload.get('workspace_sid'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'workspace_sid': workspace_sid or self._properties['workspace_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = TaskQueueContext( - self._version, - workspace_sid=self._solution['workspace_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def cumulative_statistics(self): - return self._proxy.cumulative_statistics - @property - def real_time_statistics(self): - return self._proxy.real_time_statistics - @property - def statistics(self): - return self._proxy.statistics - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class TaskQueueListInstance(ListResource): - def __init__(self, version: Version, workspace_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/${workspace_sid}/TaskQueues' - - self._statistics = None - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return TaskQueueInstance(self._version, payload, workspace_sid=self._solution['workspace_sid']) - - """ - - """ - def page(self, friendly_name, evaluate_worker_attributes, worker_sid, ordering, page_size): - - data = values.of({ - 'friendly_name': friendly_name,'evaluate_worker_attributes': evaluate_worker_attributes,'worker_sid': worker_sid,'ordering': ordering,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return TaskQueuePage(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py index c270f1c0b9..0ada3f290e 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py @@ -1,674 +1,193 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics import TaskQueueCumulativeStatisticsList -from twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics import TaskQueueRealTimeStatisticsList -from twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics import TaskQueueStatisticsList -from twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics import TaskQueuesStatisticsList +from twilio.base.version import Version +from twilio.base.page import Page -class TaskQueueList(ListResource): - - def __init__(self, version, workspace_sid): - """ - Initialize the TaskQueueList +# from twilio.rest.task_queue.task_queue_cumulative_statistics import TaskQueueCumulativeStatisticsListInstancefrom twilio.rest.task_queue.task_queue_real_time_statistics import TaskQueueRealTimeStatisticsListInstancefrom twilio.rest.task_queue.task_queue_statistics import TaskQueueStatisticsListInstancefrom twilio.rest.task_queue.task_queues_statistics import TaskQueuesStatisticsListInstance - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that contains the TaskQueue - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueList - """ - super(TaskQueueList, self).__init__(version) +class TaskQueueContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/TaskQueues'.format(**self._solution) - - # Components + self._solution = { 'workspace_sid': workspace_sid, 'sid': sid, } + self._uri = '/Workspaces/${workspace_sid}/TaskQueues/${sid}' + + self._cumulative_statistics = None + self._real_time_statistics = None self._statistics = None + + def delete(self): + + - def stream(self, friendly_name=values.unset, - evaluate_worker_attributes=values.unset, worker_sid=values.unset, - ordering=values.unset, limit=None, page_size=None): - """ - Streams TaskQueueInstance 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 unicode friendly_name: The friendly_name of the TaskQueue resources to read - :param unicode evaluate_worker_attributes: The attributes of the Workers to read - :param unicode worker_sid: The SID of the Worker with the TaskQueue resources to read - :param unicode ordering: Sorting parameter for TaskQueues - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - friendly_name=friendly_name, - evaluate_worker_attributes=evaluate_worker_attributes, - worker_sid=worker_sid, - ordering=ordering, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, friendly_name=values.unset, - evaluate_worker_attributes=values.unset, worker_sid=values.unset, - ordering=values.unset, limit=None, page_size=None): - """ - Lists TaskQueueInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode friendly_name: The friendly_name of the TaskQueue resources to read - :param unicode evaluate_worker_attributes: The attributes of the Workers to read - :param unicode worker_sid: The SID of the Worker with the TaskQueue resources to read - :param unicode ordering: Sorting parameter for TaskQueues - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance] - """ - return list(self.stream( - friendly_name=friendly_name, - evaluate_worker_attributes=evaluate_worker_attributes, - worker_sid=worker_sid, - ordering=ordering, - limit=limit, - page_size=page_size, - )) - - def page(self, friendly_name=values.unset, - evaluate_worker_attributes=values.unset, worker_sid=values.unset, - ordering=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of TaskQueueInstance records from the API. - Request is executed immediately - - :param unicode friendly_name: The friendly_name of the TaskQueue resources to read - :param unicode evaluate_worker_attributes: The attributes of the Workers to read - :param unicode worker_sid: The SID of the Worker with the TaskQueue resources to read - :param unicode ordering: Sorting parameter for TaskQueues - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueuePage - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'EvaluateWorkerAttributes': evaluate_worker_attributes, - 'WorkerSid': worker_sid, - 'Ordering': ordering, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return TaskQueuePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TaskQueueInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueuePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TaskQueuePage(self._version, response, self._solution) - - def create(self, friendly_name, target_workers=values.unset, - max_reserved_workers=values.unset, task_order=values.unset, - reservation_activity_sid=values.unset, - assignment_activity_sid=values.unset): - """ - Create the TaskQueueInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode target_workers: A string describing the Worker selection criteria for any Tasks that enter the TaskQueue - :param unicode max_reserved_workers: The maximum number of Workers to reserve - :param TaskQueueInstance.TaskOrder task_order: How Tasks will be assigned to Workers - :param unicode reservation_activity_sid: The SID of the Activity to assign Workers when a task is reserved for them - :param unicode assignment_activity_sid: The SID of the Activity to assign Workers once a task is assigned to them - - :returns: The created TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'TargetWorkers': target_workers, - 'MaxReservedWorkers': max_reserved_workers, - 'TaskOrder': task_order, - 'ReservationActivitySid': reservation_activity_sid, - 'AssignmentActivitySid': assignment_activity_sid, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return TaskQueueInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - @property - def statistics(self): - """ - Access the statistics - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsList - """ - if self._statistics is None: - self._statistics = TaskQueuesStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - return self._statistics - - def get(self, sid): - """ - Constructs a TaskQueueContext - - :param sid: The SID of the resource to - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueContext - """ - return TaskQueueContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a TaskQueueContext - - :param sid: The SID of the resource to - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueContext - """ - return TaskQueueContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TaskQueuePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the TaskQueuePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that contains the TaskQueue - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueuePage - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueuePage - """ - super(TaskQueuePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TaskQueueInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance - """ - return TaskQueueInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TaskQueueContext(InstanceContext): - - def __init__(self, version, workspace_sid, sid): """ - Initialize the TaskQueueContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the TaskQueue to fetch - :param sid: The SID of the resource to + Deletes the TaskQueueInstance - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueContext - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueContext + :returns: True if delete succeeds, False otherwise + :rtype: bool """ - super(TaskQueueContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/TaskQueues/{sid}'.format(**self._solution) - - # Dependents - self._statistics = None - self._real_time_statistics = None - self._cumulative_statistics = None - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the TaskQueueInstance :returns: The fetched TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return TaskQueueInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset, target_workers=values.unset, - reservation_activity_sid=values.unset, - assignment_activity_sid=values.unset, - max_reserved_workers=values.unset, task_order=values.unset): - """ - Update the TaskQueueInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode target_workers: A string describing the Worker selection criteria for any Tasks that enter the TaskQueue - :param unicode reservation_activity_sid: The SID of the Activity to assign Workers when a task is reserved for them - :param unicode assignment_activity_sid: The SID of the Activity to assign Workers when a task is assigned for them - :param unicode max_reserved_workers: The maximum number of Workers to create reservations for the assignment of a task while in the queue - :param TaskQueueInstance.TaskOrder task_order: How Tasks will be assigned to Workers + return TaskQueueInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) + - :returns: The updated TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance - """ + + + def update(self, body): data = values.of({ - 'FriendlyName': friendly_name, - 'TargetWorkers': target_workers, - 'ReservationActivitySid': reservation_activity_sid, - 'AssignmentActivitySid': assignment_activity_sid, - 'MaxReservedWorkers': max_reserved_workers, - 'TaskOrder': task_order, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return TaskQueueInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the TaskQueueInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def statistics(self): - """ - Access the statistics + payload = self._version.update(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsList - """ - if self._statistics is None: - self._statistics = TaskQueueStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['sid'], - ) - return self._statistics + return TaskQueueInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) + + - @property - def real_time_statistics(self): - """ - Access the real_time_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsList - """ - if self._real_time_statistics is None: - self._real_time_statistics = TaskQueueRealTimeStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['sid'], - ) - return self._real_time_statistics - - @property - def cumulative_statistics(self): - """ - Access the cumulative_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsList - """ - if self._cumulative_statistics is None: - self._cumulative_statistics = TaskQueueCumulativeStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - task_queue_sid=self._solution['sid'], - ) - return self._cumulative_statistics + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class TaskQueueInstance(InstanceResource): - - class TaskOrder(object): - FIFO = "FIFO" - LIFO = "LIFO" - - def __init__(self, version, payload, workspace_sid, sid=None): - """ - Initialize the TaskQueueInstance - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance - """ - super(TaskQueueInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'assignment_activity_sid': payload.get('assignment_activity_sid'), - 'assignment_activity_name': payload.get('assignment_activity_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'max_reserved_workers': deserialize.integer(payload.get('max_reserved_workers')), - 'reservation_activity_sid': payload.get('reservation_activity_sid'), - 'reservation_activity_name': payload.get('reservation_activity_name'), - 'sid': payload.get('sid'), - 'target_workers': payload.get('target_workers'), - 'task_order': payload.get('task_order'), - 'url': payload.get('url'), - 'workspace_sid': payload.get('workspace_sid'), - 'links': payload.get('links'), +class TaskQueueInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'assignment_activity_sid' : payload.get('assignment_activity_sid'), + 'assignment_activity_name' : payload.get('assignment_activity_name'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'friendly_name' : payload.get('friendly_name'), + 'max_reserved_workers' : payload.get('max_reserved_workers'), + 'reservation_activity_sid' : payload.get('reservation_activity_sid'), + 'reservation_activity_name' : payload.get('reservation_activity_name'), + 'sid' : payload.get('sid'), + 'target_workers' : payload.get('target_workers'), + 'task_order' : payload.get('task_order'), + 'url' : payload.get('url'), + 'workspace_sid' : payload.get('workspace_sid'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TaskQueueContext for this TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueContext - """ if self._context is None: self._context = TaskQueueContext( self._version, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], + workspace_sid=self._solution['workspace_sid'],sid=self._solution['sid'], ) return self._context @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def assignment_activity_sid(self): - """ - :returns: The SID of the Activity to assign Workers when a task is assigned for them - :rtype: unicode - """ - return self._properties['assignment_activity_sid'] - - @property - def assignment_activity_name(self): - """ - :returns: The name of the Activity to assign Workers when a task is assigned for them - :rtype: unicode - """ - return self._properties['assignment_activity_name'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def max_reserved_workers(self): - """ - :returns: The maximum number of Workers to reserve - :rtype: unicode - """ - return self._properties['max_reserved_workers'] - - @property - def reservation_activity_sid(self): - """ - :returns: The SID of the Activity to assign Workers once a task is reserved for them - :rtype: unicode - """ - return self._properties['reservation_activity_sid'] - - @property - def reservation_activity_name(self): - """ - :returns: The name of the Activity to assign Workers once a task is reserved for them - :rtype: unicode - """ - return self._properties['reservation_activity_name'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def target_workers(self): - """ - :returns: A string describing the Worker selection criteria for any Tasks that enter the TaskQueue - :rtype: unicode - """ - return self._properties['target_workers'] - - @property - def task_order(self): - """ - :returns: How Tasks will be assigned to Workers - :rtype: TaskQueueInstance.TaskOrder - """ - return self._properties['task_order'] - - @property - def url(self): - """ - :returns: The absolute URL of the TaskQueue resource - :rtype: unicode - """ - return self._properties['url'] - + def cumulative_statistics(self): + return self._proxy.cumulative_statistics @property - def workspace_sid(self): - """ - :returns: The SID of the Workspace that contains the TaskQueue - :rtype: unicode - """ - return self._properties['workspace_sid'] - + def real_time_statistics(self): + return self._proxy.real_time_statistics @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the TaskQueueInstance - - :returns: The fetched TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance - """ - return self._proxy.fetch() + def statistics(self): + return self._proxy.statistics + - def update(self, friendly_name=values.unset, target_workers=values.unset, - reservation_activity_sid=values.unset, - assignment_activity_sid=values.unset, - max_reserved_workers=values.unset, task_order=values.unset): + def __repr__(self): """ - Update the TaskQueueInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode target_workers: A string describing the Worker selection criteria for any Tasks that enter the TaskQueue - :param unicode reservation_activity_sid: The SID of the Activity to assign Workers when a task is reserved for them - :param unicode assignment_activity_sid: The SID of the Activity to assign Workers when a task is assigned for them - :param unicode max_reserved_workers: The maximum number of Workers to create reservations for the assignment of a task while in the queue - :param TaskQueueInstance.TaskOrder task_order: How Tasks will be assigned to Workers - - :returns: The updated TaskQueueInstance - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update( - friendly_name=friendly_name, - target_workers=target_workers, - reservation_activity_sid=reservation_activity_sid, - assignment_activity_sid=assignment_activity_sid, - max_reserved_workers=max_reserved_workers, - task_order=task_order, - ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the TaskQueueInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - @property - def statistics(self): - """ - Access the statistics +class TaskQueueListInstance(ListResource): + def __init__(self, version: Version, workspace_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_statistics.TaskQueueStatisticsList - """ - return self._proxy.statistics + # Path Solution + self._solution = { 'workspace_sid': workspace_sid, } + self._uri = '/Workspaces/${workspace_sid}/TaskQueues' + + self._statistics = None + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def real_time_statistics(self): - """ - Access the real_time_statistics + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsList - """ - return self._proxy.real_time_statistics + return TaskQueueInstance(self._version, payload, workspace_sid=self._solution['workspace_sid']) + + """ + + """ + def page(self, friendly_name, evaluate_worker_attributes, worker_sid, ordering, page_size): + + data = values.of({ + 'friendly_name': friendly_name,'evaluate_worker_attributes': evaluate_worker_attributes,'worker_sid': worker_sid,'ordering': ordering,'page_size': page_size, + }) - @property - def cumulative_statistics(self): - """ - Access the cumulative_statistics + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsList - """ - return self._proxy.cumulative_statistics + return TaskQueuePage(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/worker.py b/twilio/rest/taskrouter/v1/workspace/worker.py deleted file mode 100644 index 9108f0ff5b..0000000000 --- a/twilio/rest/taskrouter/v1/workspace/worker.py +++ /dev/null @@ -1,193 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Taskrouter - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.worker.reservation import ReservationListInstancefrom twilio.rest.worker.worker_channel import WorkerChannelListInstancefrom twilio.rest.worker.worker_statistics import WorkerStatisticsListInstancefrom twilio.rest.worker.workers_cumulative_statistics import WorkersCumulativeStatisticsListInstancefrom twilio.rest.worker.workers_real_time_statistics import WorkersRealTimeStatisticsListInstancefrom twilio.rest.worker.workers_statistics import WorkersStatisticsListInstance - - -class WorkerContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'workspace_sid': workspace_sid, 'sid': sid, } - self._uri = '/Workspaces/${workspace_sid}/Workers/${sid}' - - self._reservations = None - self._worker_channels = None - self._statistics = None - - def delete(self, if_match): - - - - """ - Deletes the WorkerInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the WorkerInstance - - :returns: The fetched WorkerInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return WorkerInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) - - - - - def update(self, if_match, body): - data = values.of({ - 'if_match': if_match,'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return WorkerInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class WorkerInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'activity_name' : payload.get('activity_name'), - 'activity_sid' : payload.get('activity_sid'), - 'attributes' : payload.get('attributes'), - 'available' : payload.get('available'), - 'date_created' : payload.get('date_created'), - 'date_status_changed' : payload.get('date_status_changed'), - 'date_updated' : payload.get('date_updated'), - 'friendly_name' : payload.get('friendly_name'), - 'sid' : payload.get('sid'), - 'workspace_sid' : payload.get('workspace_sid'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'workspace_sid': workspace_sid or self._properties['workspace_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = WorkerContext( - self._version, - workspace_sid=self._solution['workspace_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def reservations(self): - return self._proxy.reservations - @property - def worker_channels(self): - return self._proxy.worker_channels - @property - def statistics(self): - return self._proxy.statistics - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class WorkerListInstance(ListResource): - def __init__(self, version: Version, workspace_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/${workspace_sid}/Workers' - - self._cumulative_statistics = None - self._real_time_statistics = None - self._statistics = None - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return WorkerInstance(self._version, payload, workspace_sid=self._solution['workspace_sid']) - - """ - - """ - def page(self, activity_name, activity_sid, available, friendly_name, target_workers_expression, task_queue_name, task_queue_sid, ordering, page_size): - - data = values.of({ - 'activity_name': activity_name,'activity_sid': activity_sid,'available': available,'friendly_name': friendly_name,'target_workers_expression': target_workers_expression,'task_queue_name': task_queue_name,'task_queue_sid': task_queue_sid,'ordering': ordering,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return WorkerPage(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py b/twilio/rest/taskrouter/v1/workspace/worker/__init__.py index b800ed8e87..9108f0ff5b 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/__init__.py @@ -1,728 +1,193 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.taskrouter.v1.workspace.worker.reservation import ReservationList -from twilio.rest.taskrouter.v1.workspace.worker.worker_channel import WorkerChannelList -from twilio.rest.taskrouter.v1.workspace.worker.worker_statistics import WorkerStatisticsList -from twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics import WorkersCumulativeStatisticsList -from twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics import WorkersRealTimeStatisticsList -from twilio.rest.taskrouter.v1.workspace.worker.workers_statistics import WorkersStatisticsList +from twilio.base.version import Version +from twilio.base.page import Page -class WorkerList(ListResource): - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkerList +# from twilio.rest.worker.reservation import ReservationListInstancefrom twilio.rest.worker.worker_channel import WorkerChannelListInstancefrom twilio.rest.worker.worker_statistics import WorkerStatisticsListInstancefrom twilio.rest.worker.workers_cumulative_statistics import WorkersCumulativeStatisticsListInstancefrom twilio.rest.worker.workers_real_time_statistics import WorkersRealTimeStatisticsListInstancefrom twilio.rest.worker.workers_statistics import WorkersStatisticsListInstance - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that contains the Worker - :returns: twilio.rest.taskrouter.v1.workspace.worker.WorkerList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerList - """ - super(WorkerList, self).__init__(version) +class WorkerContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers'.format(**self._solution) - - # Components + self._solution = { 'workspace_sid': workspace_sid, 'sid': sid, } + self._uri = '/Workspaces/${workspace_sid}/Workers/${sid}' + + self._reservations = None + self._worker_channels = None self._statistics = None + + def delete(self, if_match): + + - def stream(self, activity_name=values.unset, activity_sid=values.unset, - available=values.unset, friendly_name=values.unset, - target_workers_expression=values.unset, task_queue_name=values.unset, - task_queue_sid=values.unset, ordering=values.unset, limit=None, - page_size=None): - """ - Streams WorkerInstance 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 unicode activity_name: The activity_name of the Worker resources to read - :param unicode activity_sid: The activity_sid of the Worker resources to read - :param unicode available: Whether to return Worker resources that are available or unavailable - :param unicode friendly_name: The friendly_name of the Worker resources to read - :param unicode target_workers_expression: Filter by Workers that would match an expression on a TaskQueue - :param unicode task_queue_name: The friendly_name of the TaskQueue that the Workers to read are eligible for - :param unicode task_queue_sid: The SID of the TaskQueue that the Workers to read are eligible for - :param unicode ordering: Sorting parameter for Workers - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - activity_name=activity_name, - activity_sid=activity_sid, - available=available, - friendly_name=friendly_name, - target_workers_expression=target_workers_expression, - task_queue_name=task_queue_name, - task_queue_sid=task_queue_sid, - ordering=ordering, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, activity_name=values.unset, activity_sid=values.unset, - available=values.unset, friendly_name=values.unset, - target_workers_expression=values.unset, task_queue_name=values.unset, - task_queue_sid=values.unset, ordering=values.unset, limit=None, - page_size=None): - """ - Lists WorkerInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode activity_name: The activity_name of the Worker resources to read - :param unicode activity_sid: The activity_sid of the Worker resources to read - :param unicode available: Whether to return Worker resources that are available or unavailable - :param unicode friendly_name: The friendly_name of the Worker resources to read - :param unicode target_workers_expression: Filter by Workers that would match an expression on a TaskQueue - :param unicode task_queue_name: The friendly_name of the TaskQueue that the Workers to read are eligible for - :param unicode task_queue_sid: The SID of the TaskQueue that the Workers to read are eligible for - :param unicode ordering: Sorting parameter for Workers - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance] - """ - return list(self.stream( - activity_name=activity_name, - activity_sid=activity_sid, - available=available, - friendly_name=friendly_name, - target_workers_expression=target_workers_expression, - task_queue_name=task_queue_name, - task_queue_sid=task_queue_sid, - ordering=ordering, - limit=limit, - page_size=page_size, - )) - - def page(self, activity_name=values.unset, activity_sid=values.unset, - available=values.unset, friendly_name=values.unset, - target_workers_expression=values.unset, task_queue_name=values.unset, - task_queue_sid=values.unset, ordering=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of WorkerInstance records from the API. - Request is executed immediately - - :param unicode activity_name: The activity_name of the Worker resources to read - :param unicode activity_sid: The activity_sid of the Worker resources to read - :param unicode available: Whether to return Worker resources that are available or unavailable - :param unicode friendly_name: The friendly_name of the Worker resources to read - :param unicode target_workers_expression: Filter by Workers that would match an expression on a TaskQueue - :param unicode task_queue_name: The friendly_name of the TaskQueue that the Workers to read are eligible for - :param unicode task_queue_sid: The SID of the TaskQueue that the Workers to read are eligible for - :param unicode ordering: Sorting parameter for Workers - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerPage """ - data = values.of({ - 'ActivityName': activity_name, - 'ActivitySid': activity_sid, - 'Available': available, - 'FriendlyName': friendly_name, - 'TargetWorkersExpression': target_workers_expression, - 'TaskQueueName': task_queue_name, - 'TaskQueueSid': task_queue_sid, - 'Ordering': ordering, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return WorkerPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of WorkerInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return WorkerPage(self._version, response, self._solution) - - def create(self, friendly_name, activity_sid=values.unset, - attributes=values.unset): - """ - Create the WorkerInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode activity_sid: The SID of a valid Activity that describes the new Worker's initial state - :param unicode attributes: A valid JSON string that describes the new Worker - - :returns: The created WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'ActivitySid': activity_sid, - 'Attributes': attributes, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return WorkerInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - @property - def statistics(self): - """ - Access the statistics - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsList - """ - if self._statistics is None: - self._statistics = WorkersStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - return self._statistics - - def get(self, sid): - """ - Constructs a WorkerContext - - :param sid: The SID of the resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.worker.WorkerContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerContext - """ - return WorkerContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a WorkerContext - - :param sid: The SID of the resource to fetch - - :returns: twilio.rest.taskrouter.v1.workspace.worker.WorkerContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerContext - """ - return WorkerContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WorkerPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the WorkerPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that contains the Worker - - :returns: twilio.rest.taskrouter.v1.workspace.worker.WorkerPage - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerPage - """ - super(WorkerPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkerInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance - """ - return WorkerInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WorkerContext(InstanceContext): - - def __init__(self, version, workspace_sid, sid): - """ - Initialize the WorkerContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the Worker to fetch - :param sid: The SID of the resource to fetch + Deletes the WorkerInstance - :returns: twilio.rest.taskrouter.v1.workspace.worker.WorkerContext - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerContext + :returns: True if delete succeeds, False otherwise + :rtype: bool """ - super(WorkerContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/Workers/{sid}'.format(**self._solution) - - # Dependents - self._real_time_statistics = None - self._cumulative_statistics = None - self._statistics = None - self._reservations = None - self._worker_channels = None - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the WorkerInstance :returns: The fetched WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return WorkerInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) + return WorkerInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) + - def update(self, activity_sid=values.unset, attributes=values.unset, - friendly_name=values.unset, reject_pending_reservations=values.unset, - if_match=values.unset): - """ - Update the WorkerInstance - - :param unicode activity_sid: The SID of the Activity that describes the Worker's initial state - :param unicode attributes: The JSON string that describes the Worker - :param unicode friendly_name: A string to describe the Worker - :param bool reject_pending_reservations: Whether to reject the Worker's pending reservations - :param unicode if_match: The If-Match HTTP request header - - :returns: The updated WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance - """ + + + def update(self, if_match, body): data = values.of({ - 'ActivitySid': activity_sid, - 'Attributes': attributes, - 'FriendlyName': friendly_name, - 'RejectPendingReservations': reject_pending_reservations, + 'if_match': if_match,'body': body, }) - headers = values.of({'If-Match': if_match, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) - - return WorkerInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def delete(self, if_match=values.unset): - """ - Deletes the WorkerInstance - - :param unicode if_match: The If-Match HTTP request header - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - headers = values.of({'If-Match': if_match, }) - - return self._version.delete(method='DELETE', uri=self._uri, headers=headers, ) - - @property - def real_time_statistics(self): - """ - Access the real_time_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsList - """ - if self._real_time_statistics is None: - self._real_time_statistics = WorkersRealTimeStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - return self._real_time_statistics - - @property - def cumulative_statistics(self): - """ - Access the cumulative_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsList - """ - if self._cumulative_statistics is None: - self._cumulative_statistics = WorkersCumulativeStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - ) - return self._cumulative_statistics - - @property - def statistics(self): - """ - Access the statistics - - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsList - """ - if self._statistics is None: - self._statistics = WorkerStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['sid'], - ) - return self._statistics - @property - def reservations(self): - """ - Access the reservations - - :returns: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationList - """ - if self._reservations is None: - self._reservations = ReservationList( - self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['sid'], - ) - return self._reservations + payload = self._version.update(method='post', uri=self._uri, data=data, ) - @property - def worker_channels(self): - """ - Access the worker_channels + return WorkerInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) + + - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelList - """ - if self._worker_channels is None: - self._worker_channels = WorkerChannelList( - self._version, - workspace_sid=self._solution['workspace_sid'], - worker_sid=self._solution['sid'], - ) - return self._worker_channels + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class WorkerInstance(InstanceResource): - - def __init__(self, version, payload, workspace_sid, sid=None): - """ - Initialize the WorkerInstance - :returns: twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance - """ - super(WorkerInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'activity_name': payload.get('activity_name'), - 'activity_sid': payload.get('activity_sid'), - 'attributes': payload.get('attributes'), - 'available': payload.get('available'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_status_changed': deserialize.iso8601_datetime(payload.get('date_status_changed')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'friendly_name': payload.get('friendly_name'), - 'sid': payload.get('sid'), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class WorkerInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'activity_name' : payload.get('activity_name'), + 'activity_sid' : payload.get('activity_sid'), + 'attributes' : payload.get('attributes'), + 'available' : payload.get('available'), + 'date_created' : payload.get('date_created'), + 'date_status_changed' : payload.get('date_status_changed'), + 'date_updated' : payload.get('date_updated'), + 'friendly_name' : payload.get('friendly_name'), + 'sid' : payload.get('sid'), + 'workspace_sid' : payload.get('workspace_sid'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkerContext for this WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerContext - """ if self._context is None: self._context = WorkerContext( self._version, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], + workspace_sid=self._solution['workspace_sid'],sid=self._solution['sid'], ) return self._context @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def activity_name(self): - """ - :returns: The friendly_name of the Worker's current Activity - :rtype: unicode - """ - return self._properties['activity_name'] - - @property - def activity_sid(self): - """ - :returns: The SID of the Worker's current Activity - :rtype: unicode - """ - return self._properties['activity_sid'] - - @property - def attributes(self): - """ - :returns: The JSON string that describes the Worker - :rtype: unicode - """ - return self._properties['attributes'] - - @property - def available(self): - """ - :returns: Whether the Worker is available to perform tasks - :rtype: bool - """ - return self._properties['available'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_status_changed(self): - """ - :returns: The date and time in GMT of the last change to the Worker's activity - :rtype: datetime - """ - return self._properties['date_status_changed'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def workspace_sid(self): - """ - :returns: The SID of the Workspace that contains the Worker - :rtype: unicode - """ - return self._properties['workspace_sid'] - + def reservations(self): + return self._proxy.reservations @property - def url(self): - """ - :returns: The absolute URL of the Worker resource - :rtype: unicode - """ - return self._properties['url'] - + def worker_channels(self): + return self._proxy.worker_channels @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the WorkerInstance - - :returns: The fetched WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance - """ - return self._proxy.fetch() - - def update(self, activity_sid=values.unset, attributes=values.unset, - friendly_name=values.unset, reject_pending_reservations=values.unset, - if_match=values.unset): - """ - Update the WorkerInstance - - :param unicode activity_sid: The SID of the Activity that describes the Worker's initial state - :param unicode attributes: The JSON string that describes the Worker - :param unicode friendly_name: A string to describe the Worker - :param bool reject_pending_reservations: Whether to reject the Worker's pending reservations - :param unicode if_match: The If-Match HTTP request header - - :returns: The updated WorkerInstance - :rtype: twilio.rest.taskrouter.v1.workspace.worker.WorkerInstance - """ - return self._proxy.update( - activity_sid=activity_sid, - attributes=attributes, - friendly_name=friendly_name, - reject_pending_reservations=reject_pending_reservations, - if_match=if_match, - ) - - def delete(self, if_match=values.unset): - """ - Deletes the WorkerInstance - - :param unicode if_match: The If-Match HTTP request header - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete(if_match=if_match, ) + def statistics(self): + return self._proxy.statistics + - @property - def real_time_statistics(self): + def __repr__(self): """ - Access the real_time_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsList + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.real_time_statistics + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def cumulative_statistics(self): - """ - Access the cumulative_statistics - :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_cumulative_statistics.WorkersCumulativeStatisticsList - """ - return self._proxy.cumulative_statistics - @property - def statistics(self): - """ - Access the statistics +class WorkerListInstance(ListResource): + def __init__(self, version: Version, workspace_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsList - """ - return self._proxy.statistics + # Path Solution + self._solution = { 'workspace_sid': workspace_sid, } + self._uri = '/Workspaces/${workspace_sid}/Workers' + + self._cumulative_statistics = None + self._real_time_statistics = None + self._statistics = None + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def reservations(self): - """ - Access the reservations + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.reservation.ReservationList - """ - return self._proxy.reservations + return WorkerInstance(self._version, payload, workspace_sid=self._solution['workspace_sid']) + + """ + + """ + def page(self, activity_name, activity_sid, available, friendly_name, target_workers_expression, task_queue_name, task_queue_sid, ordering, page_size): + + data = values.of({ + 'activity_name': activity_name,'activity_sid': activity_sid,'available': available,'friendly_name': friendly_name,'target_workers_expression': target_workers_expression,'task_queue_name': task_queue_name,'task_queue_sid': task_queue_sid,'ordering': ordering,'page_size': page_size, + }) - @property - def worker_channels(self): - """ - Access the worker_channels + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelList - :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_channel.WorkerChannelList - """ - return self._proxy.worker_channels + return WorkerPage(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/taskrouter/v1/workspace/workflow.py b/twilio/rest/taskrouter/v1/workspace/workflow.py deleted file mode 100644 index aedce900a4..0000000000 --- a/twilio/rest/taskrouter/v1/workspace/workflow.py +++ /dev/null @@ -1,190 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Taskrouter - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.workflow.workflow_cumulative_statistics import WorkflowCumulativeStatisticsListInstancefrom twilio.rest.workflow.workflow_real_time_statistics import WorkflowRealTimeStatisticsListInstancefrom twilio.rest.workflow.workflow_statistics import WorkflowStatisticsListInstance - - -class WorkflowContext(InstanceContext): - def __init__(self, version: Version, workspace_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'workspace_sid': workspace_sid, 'sid': sid, } - self._uri = '/Workspaces/${workspace_sid}/Workflows/${sid}' - - self._cumulative_statistics = None - self._real_time_statistics = None - self._statistics = None - - def delete(self): - - - - """ - Deletes the WorkflowInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the WorkflowInstance - - :returns: The fetched WorkflowInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return WorkflowInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return WorkflowInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class WorkflowInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'assignment_callback_url' : payload.get('assignment_callback_url'), - 'configuration' : payload.get('configuration'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'document_content_type' : payload.get('document_content_type'), - 'fallback_assignment_callback_url' : payload.get('fallback_assignment_callback_url'), - 'friendly_name' : payload.get('friendly_name'), - 'sid' : payload.get('sid'), - 'task_reservation_timeout' : payload.get('task_reservation_timeout'), - 'workspace_sid' : payload.get('workspace_sid'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'workspace_sid': workspace_sid or self._properties['workspace_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = WorkflowContext( - self._version, - workspace_sid=self._solution['workspace_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def cumulative_statistics(self): - return self._proxy.cumulative_statistics - @property - def real_time_statistics(self): - return self._proxy.real_time_statistics - @property - def statistics(self): - return self._proxy.statistics - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class WorkflowListInstance(ListResource): - def __init__(self, version: Version, workspace_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/${workspace_sid}/Workflows' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return WorkflowInstance(self._version, payload, workspace_sid=self._solution['workspace_sid']) - - """ - - """ - def page(self, friendly_name, page_size): - - data = values.of({ - 'friendly_name': friendly_name,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return WorkflowPage(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py b/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py index 3443dc7b49..aedce900a4 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py @@ -1,602 +1,190 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics import WorkflowCumulativeStatisticsList -from twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics import WorkflowRealTimeStatisticsList -from twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics import WorkflowStatisticsList - - -class WorkflowList(ListResource): - - def __init__(self, version, workspace_sid): - """ - Initialize the WorkflowList - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace that contains the Workflow - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowList - """ - super(WorkflowList, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, } - self._uri = '/Workspaces/{workspace_sid}/Workflows'.format(**self._solution) - - def stream(self, friendly_name=values.unset, limit=None, page_size=None): - """ - Streams WorkflowInstance 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 unicode friendly_name: The friendly_name of the Workflow resources to read - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(friendly_name=friendly_name, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, friendly_name=values.unset, limit=None, page_size=None): - """ - Lists WorkflowInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode friendly_name: The friendly_name of the Workflow resources to read - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance] - """ - return list(self.stream(friendly_name=friendly_name, limit=limit, page_size=page_size, )) - - def page(self, friendly_name=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of WorkflowInstance records from the API. - Request is executed immediately - - :param unicode friendly_name: The friendly_name of the Workflow resources to read - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowPage - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return WorkflowPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of WorkflowInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return WorkflowPage(self._version, response, self._solution) - - def create(self, friendly_name, configuration, - assignment_callback_url=values.unset, - fallback_assignment_callback_url=values.unset, - task_reservation_timeout=values.unset): - """ - Create the WorkflowInstance - - :param unicode friendly_name: descriptive string that you create to describe the Workflow resource - :param unicode configuration: A JSON string that contains the rules to apply to the Workflow - :param unicode assignment_callback_url: The URL from your application that will process task assignment events - :param unicode fallback_assignment_callback_url: The URL that we should call when a call to the `assignment_callback_url` fails - :param unicode task_reservation_timeout: How long TaskRouter will wait for a confirmation response from your application after it assigns a Task to a Worker - - :returns: The created WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Configuration': configuration, - 'AssignmentCallbackUrl': assignment_callback_url, - 'FallbackAssignmentCallbackUrl': fallback_assignment_callback_url, - 'TaskReservationTimeout': task_reservation_timeout, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return WorkflowInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - def get(self, sid): - """ - Constructs a WorkflowContext - - :param sid: The SID of the resource - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowContext - """ - return WorkflowContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a WorkflowContext - - :param sid: The SID of the resource - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowContext - """ - return WorkflowContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - +from twilio.base.version import Version -class WorkflowPage(Page): +from twilio.base.page import Page - def __init__(self, version, response, solution): - """ - Initialize the WorkflowPage +# from twilio.rest.workflow.workflow_cumulative_statistics import WorkflowCumulativeStatisticsListInstancefrom twilio.rest.workflow.workflow_real_time_statistics import WorkflowRealTimeStatisticsListInstancefrom twilio.rest.workflow.workflow_statistics import WorkflowStatisticsListInstance - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param workspace_sid: The SID of the Workspace that contains the Workflow - :returns: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowPage - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowPage - """ - super(WorkflowPage, self).__init__(version, response) +class WorkflowContext(InstanceContext): + def __init__(self, version: Version, workspace_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of WorkflowInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance - """ - return WorkflowInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class WorkflowContext(InstanceContext): + self._solution = { 'workspace_sid': workspace_sid, 'sid': sid, } + self._uri = '/Workspaces/${workspace_sid}/Workflows/${sid}' + + self._cumulative_statistics = None + self._real_time_statistics = None + self._statistics = None + + def delete(self): + + - def __init__(self, version, workspace_sid, sid): """ - Initialize the WorkflowContext - - :param Version version: Version that contains the resource - :param workspace_sid: The SID of the Workspace with the Workflow to fetch - :param sid: The SID of the resource + Deletes the WorkflowInstance - :returns: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowContext - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowContext + :returns: True if delete succeeds, False otherwise + :rtype: bool """ - super(WorkflowContext, self).__init__(version) - - # Path Solution - self._solution = {'workspace_sid': workspace_sid, 'sid': sid, } - self._uri = '/Workspaces/{workspace_sid}/Workflows/{sid}'.format(**self._solution) - - # Dependents - self._statistics = None - self._real_time_statistics = None - self._cumulative_statistics = None - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the WorkflowInstance :returns: The fetched WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return WorkflowInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def update(self, friendly_name=values.unset, - assignment_callback_url=values.unset, - fallback_assignment_callback_url=values.unset, - configuration=values.unset, task_reservation_timeout=values.unset, - re_evaluate_tasks=values.unset): - """ - Update the WorkflowInstance - - :param unicode friendly_name: descriptive string that you create to describe the Workflow resource - :param unicode assignment_callback_url: The URL from your application that will process task assignment events - :param unicode fallback_assignment_callback_url: The URL that we should call when a call to the `assignment_callback_url` fails - :param unicode configuration: A JSON string that contains the rules to apply to the Workflow - :param unicode task_reservation_timeout: How long TaskRouter will wait for a confirmation response from your application after it assigns a Task to a Worker - :param unicode re_evaluate_tasks: Whether or not to re-evaluate Tasks + return WorkflowInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) + - :returns: The updated WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance - """ + + + def update(self, body): data = values.of({ - 'FriendlyName': friendly_name, - 'AssignmentCallbackUrl': assignment_callback_url, - 'FallbackAssignmentCallbackUrl': fallback_assignment_callback_url, - 'Configuration': configuration, - 'TaskReservationTimeout': task_reservation_timeout, - 'ReEvaluateTasks': re_evaluate_tasks, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return WorkflowInstance( - self._version, - payload, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the WorkflowInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def statistics(self): - """ - Access the statistics - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsList - """ - if self._statistics is None: - self._statistics = WorkflowStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['sid'], - ) - return self._statistics - - @property - def real_time_statistics(self): - """ - Access the real_time_statistics - - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsList - """ - if self._real_time_statistics is None: - self._real_time_statistics = WorkflowRealTimeStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['sid'], - ) - return self._real_time_statistics + payload = self._version.update(method='post', uri=self._uri, data=data, ) - @property - def cumulative_statistics(self): - """ - Access the cumulative_statistics + return WorkflowInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], ) + + - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsList - """ - if self._cumulative_statistics is None: - self._cumulative_statistics = WorkflowCumulativeStatisticsList( - self._version, - workspace_sid=self._solution['workspace_sid'], - workflow_sid=self._solution['sid'], - ) - return self._cumulative_statistics + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class WorkflowInstance(InstanceResource): - - def __init__(self, version, payload, workspace_sid, sid=None): - """ - Initialize the WorkflowInstance - :returns: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance - """ - super(WorkflowInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'assignment_callback_url': payload.get('assignment_callback_url'), - 'configuration': payload.get('configuration'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'document_content_type': payload.get('document_content_type'), - 'fallback_assignment_callback_url': payload.get('fallback_assignment_callback_url'), - 'friendly_name': payload.get('friendly_name'), - 'sid': payload.get('sid'), - 'task_reservation_timeout': deserialize.integer(payload.get('task_reservation_timeout')), - 'workspace_sid': payload.get('workspace_sid'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class WorkflowInstance(InstanceResource): + def __init__(self, version, payload, workspace_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'assignment_callback_url' : payload.get('assignment_callback_url'), + 'configuration' : payload.get('configuration'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'document_content_type' : payload.get('document_content_type'), + 'fallback_assignment_callback_url' : payload.get('fallback_assignment_callback_url'), + 'friendly_name' : payload.get('friendly_name'), + 'sid' : payload.get('sid'), + 'task_reservation_timeout' : payload.get('task_reservation_timeout'), + 'workspace_sid' : payload.get('workspace_sid'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'workspace_sid': workspace_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'workspace_sid': workspace_sid or self._properties['workspace_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: WorkflowContext for this WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowContext - """ if self._context is None: self._context = WorkflowContext( self._version, - workspace_sid=self._solution['workspace_sid'], - sid=self._solution['sid'], + workspace_sid=self._solution['workspace_sid'],sid=self._solution['sid'], ) return self._context @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def assignment_callback_url(self): - """ - :returns: The URL that we call when a task managed by the Workflow is assigned to a Worker - :rtype: unicode - """ - return self._properties['assignment_callback_url'] - - @property - def configuration(self): - """ - :returns: A JSON string that contains the Workflow's configuration - :rtype: unicode - """ - return self._properties['configuration'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def document_content_type(self): - """ - :returns: The MIME type of the document - :rtype: unicode - """ - return self._properties['document_content_type'] - - @property - def fallback_assignment_callback_url(self): - """ - :returns: The URL that we call when a call to the `assignment_callback_url` fails - :rtype: unicode - """ - return self._properties['fallback_assignment_callback_url'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the Workflow resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def task_reservation_timeout(self): - """ - :returns: How long TaskRouter will wait for a confirmation response from your application after it assigns a Task to a Worker - :rtype: unicode - """ - return self._properties['task_reservation_timeout'] - - @property - def workspace_sid(self): - """ - :returns: The SID of the Workspace that contains the Workflow - :rtype: unicode - """ - return self._properties['workspace_sid'] - + def cumulative_statistics(self): + return self._proxy.cumulative_statistics @property - def url(self): - """ - :returns: The absolute URL of the Workflow resource - :rtype: unicode - """ - return self._properties['url'] - + def real_time_statistics(self): + return self._proxy.real_time_statistics @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the WorkflowInstance - - :returns: The fetched WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance - """ - return self._proxy.fetch() + def statistics(self): + return self._proxy.statistics + - def update(self, friendly_name=values.unset, - assignment_callback_url=values.unset, - fallback_assignment_callback_url=values.unset, - configuration=values.unset, task_reservation_timeout=values.unset, - re_evaluate_tasks=values.unset): + def __repr__(self): """ - Update the WorkflowInstance - - :param unicode friendly_name: descriptive string that you create to describe the Workflow resource - :param unicode assignment_callback_url: The URL from your application that will process task assignment events - :param unicode fallback_assignment_callback_url: The URL that we should call when a call to the `assignment_callback_url` fails - :param unicode configuration: A JSON string that contains the rules to apply to the Workflow - :param unicode task_reservation_timeout: How long TaskRouter will wait for a confirmation response from your application after it assigns a Task to a Worker - :param unicode re_evaluate_tasks: Whether or not to re-evaluate Tasks - - :returns: The updated WorkflowInstance - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.WorkflowInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update( - friendly_name=friendly_name, - assignment_callback_url=assignment_callback_url, - fallback_assignment_callback_url=fallback_assignment_callback_url, - configuration=configuration, - task_reservation_timeout=task_reservation_timeout, - re_evaluate_tasks=re_evaluate_tasks, - ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the WorkflowInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - @property - def statistics(self): - """ - Access the statistics +class WorkflowListInstance(ListResource): + def __init__(self, version: Version, workspace_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsList - """ - return self._proxy.statistics + # Path Solution + self._solution = { 'workspace_sid': workspace_sid, } + self._uri = '/Workspaces/${workspace_sid}/Workflows' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def real_time_statistics(self): - """ - Access the real_time_statistics + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsList - """ - return self._proxy.real_time_statistics + return WorkflowInstance(self._version, payload, workspace_sid=self._solution['workspace_sid']) + + """ + + """ + def page(self, friendly_name, page_size): + + data = values.of({ + 'friendly_name': friendly_name,'page_size': page_size, + }) - @property - def cumulative_statistics(self): - """ - Access the cumulative_statistics + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsList - :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_cumulative_statistics.WorkflowCumulativeStatisticsList - """ - return self._proxy.cumulative_statistics + return WorkflowPage(self._version, payload, workspace_sid=self._solution['workspace_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/trunking/v1/trunk.py b/twilio/rest/trunking/v1/trunk.py deleted file mode 100644 index 07dd975998..0000000000 --- a/twilio/rest/trunking/v1/trunk.py +++ /dev/null @@ -1,202 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Trunking - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.trunk.credential_list import CredentialListListInstancefrom twilio.rest.trunk.ip_access_control_list import IpAccessControlListListInstancefrom twilio.rest.trunk.origination_url import OriginationUrlListInstancefrom twilio.rest.trunk.phone_number import PhoneNumberListInstancefrom twilio.rest.trunk.recording import RecordingListInstance - - -class TrunkContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Trunks/${sid}' - - self._credentials_lists = None - self._ip_access_control_lists = None - self._origination_urls = None - self._phone_numbers = None - self._recordings = None - - def delete(self): - - - - """ - Deletes the TrunkInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the TrunkInstance - - :returns: The fetched TrunkInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TrunkInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return TrunkInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class TrunkInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'domain_name' : payload.get('domain_name'), - 'disaster_recovery_method' : payload.get('disaster_recovery_method'), - 'disaster_recovery_url' : payload.get('disaster_recovery_url'), - 'friendly_name' : payload.get('friendly_name'), - 'secure' : payload.get('secure'), - 'recording' : payload.get('recording'), - 'transfer_mode' : payload.get('transfer_mode'), - 'transfer_caller_id' : payload.get('transfer_caller_id'), - 'cnam_lookup_enabled' : payload.get('cnam_lookup_enabled'), - 'auth_type' : payload.get('auth_type'), - 'auth_type_set' : payload.get('auth_type_set'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'sid' : payload.get('sid'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = TrunkContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def credentials_lists(self): - return self._proxy.credentials_lists - @property - def ip_access_control_lists(self): - return self._proxy.ip_access_control_lists - @property - def origination_urls(self): - return self._proxy.origination_urls - @property - def phone_numbers(self): - return self._proxy.phone_numbers - @property - def recordings(self): - return self._proxy.recordings - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class TrunkListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Trunks' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return TrunkInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return TrunkPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/trunking/v1/trunk/__init__.py b/twilio/rest/trunking/v1/trunk/__init__.py index 065ce67b34..07dd975998 100644 --- a/twilio/rest/trunking/v1/trunk/__init__.py +++ b/twilio/rest/trunking/v1/trunk/__init__.py @@ -1,676 +1,202 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trunking + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.trunking.v1.trunk.credential_list import CredentialListList -from twilio.rest.trunking.v1.trunk.ip_access_control_list import IpAccessControlListList -from twilio.rest.trunking.v1.trunk.origination_url import OriginationUrlList -from twilio.rest.trunking.v1.trunk.phone_number import PhoneNumberList -from twilio.rest.trunking.v1.trunk.recording import RecordingList - - -class TrunkList(ListResource): - - def __init__(self, version): - """ - Initialize the TrunkList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.trunking.v1.trunk.TrunkList - :rtype: twilio.rest.trunking.v1.trunk.TrunkList - """ - super(TrunkList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Trunks'.format(**self._solution) - - def create(self, friendly_name=values.unset, domain_name=values.unset, - disaster_recovery_url=values.unset, - disaster_recovery_method=values.unset, transfer_mode=values.unset, - secure=values.unset, cnam_lookup_enabled=values.unset, - transfer_caller_id=values.unset): - """ - Create the TrunkInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode domain_name: The unique address you reserve on Twilio to which you route your SIP traffic - :param unicode disaster_recovery_url: The HTTP URL that we should call if an error occurs while sending SIP traffic towards your configured Origination URL - :param unicode disaster_recovery_method: The HTTP method we should use to call the disaster_recovery_url - :param TrunkInstance.TransferSetting transfer_mode: The call transfer settings for the trunk - :param bool secure: Whether Secure Trunking is enabled for the trunk - :param bool cnam_lookup_enabled: Whether Caller ID Name (CNAM) lookup should be enabled for the trunk - :param TrunkInstance.TransferCallerId transfer_caller_id: Caller Id for transfer target - - :returns: The created TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'DomainName': domain_name, - 'DisasterRecoveryUrl': disaster_recovery_url, - 'DisasterRecoveryMethod': disaster_recovery_method, - 'TransferMode': transfer_mode, - 'Secure': secure, - 'CnamLookupEnabled': cnam_lookup_enabled, - 'TransferCallerId': transfer_caller_id, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return TrunkInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams TrunkInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.trunking.v1.trunk.TrunkInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists TrunkInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.trunking.v1.trunk.TrunkInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of TrunkInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return TrunkPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TrunkInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TrunkPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a TrunkContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trunking.v1.trunk.TrunkContext - :rtype: twilio.rest.trunking.v1.trunk.TrunkContext - """ - return TrunkContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a TrunkContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trunking.v1.trunk.TrunkContext - :rtype: twilio.rest.trunking.v1.trunk.TrunkContext - """ - return TrunkContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class TrunkPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the TrunkPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.trunking.v1.trunk.TrunkPage - :rtype: twilio.rest.trunking.v1.trunk.TrunkPage - """ - super(TrunkPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TrunkInstance - - :param dict payload: Payload response from the API +from twilio.base.version import Version - :returns: twilio.rest.trunking.v1.trunk.TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkInstance - """ - return TrunkInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.trunk.credential_list import CredentialListListInstancefrom twilio.rest.trunk.ip_access_control_list import IpAccessControlListListInstancefrom twilio.rest.trunk.origination_url import OriginationUrlListInstancefrom twilio.rest.trunk.phone_number import PhoneNumberListInstancefrom twilio.rest.trunk.recording import RecordingListInstance class TrunkContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the TrunkContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.trunking.v1.trunk.TrunkContext - :rtype: twilio.rest.trunking.v1.trunk.TrunkContext - """ - super(TrunkContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Trunks/{sid}'.format(**self._solution) - - # Dependents - self._origination_urls = None + self._solution = { 'sid': sid, } + self._uri = '/Trunks/${sid}' + self._credentials_lists = None self._ip_access_control_lists = None + self._origination_urls = None self._phone_numbers = None self._recordings = None + + def delete(self): + + + """ + Deletes the TrunkInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the TrunkInstance :returns: The fetched TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return TrunkInstance(self._version, payload, sid=self._solution['sid'], ) + - def delete(self): - """ - Deletes the TrunkInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, friendly_name=values.unset, domain_name=values.unset, - disaster_recovery_url=values.unset, - disaster_recovery_method=values.unset, transfer_mode=values.unset, - secure=values.unset, cnam_lookup_enabled=values.unset, - transfer_caller_id=values.unset): - """ - Update the TrunkInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode domain_name: The unique address you reserve on Twilio to which you route your SIP traffic - :param unicode disaster_recovery_url: The HTTP URL that we should call if an error occurs while sending SIP traffic towards your configured Origination URL - :param unicode disaster_recovery_method: The HTTP method we should use to call the disaster_recovery_url - :param TrunkInstance.TransferSetting transfer_mode: The call transfer settings for the trunk - :param bool secure: Whether Secure Trunking is enabled for the trunk - :param bool cnam_lookup_enabled: Whether Caller ID Name (CNAM) lookup should be enabled for the trunk - :param TrunkInstance.TransferCallerId transfer_caller_id: Caller Id for transfer target - - :returns: The updated TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkInstance - """ + + + def update(self, body): data = values.of({ - 'FriendlyName': friendly_name, - 'DomainName': domain_name, - 'DisasterRecoveryUrl': disaster_recovery_url, - 'DisasterRecoveryMethod': disaster_recovery_method, - 'TransferMode': transfer_mode, - 'Secure': secure, - 'CnamLookupEnabled': cnam_lookup_enabled, - 'TransferCallerId': transfer_caller_id, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return TrunkInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def origination_urls(self): - """ - Access the origination_urls - - :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlList - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlList - """ - if self._origination_urls is None: - self._origination_urls = OriginationUrlList(self._version, trunk_sid=self._solution['sid'], ) - return self._origination_urls - - @property - def credentials_lists(self): - """ - Access the credentials_lists - - :returns: twilio.rest.trunking.v1.trunk.credential_list.CredentialListList - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListList - """ - if self._credentials_lists is None: - self._credentials_lists = CredentialListList(self._version, trunk_sid=self._solution['sid'], ) - return self._credentials_lists - - @property - def ip_access_control_lists(self): - """ - Access the ip_access_control_lists - - :returns: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListList - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListList - """ - if self._ip_access_control_lists is None: - self._ip_access_control_lists = IpAccessControlListList( - self._version, - trunk_sid=self._solution['sid'], - ) - return self._ip_access_control_lists - - @property - def phone_numbers(self): - """ - Access the phone_numbers - - :returns: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberList - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberList - """ - if self._phone_numbers is None: - self._phone_numbers = PhoneNumberList(self._version, trunk_sid=self._solution['sid'], ) - return self._phone_numbers - - @property - def recordings(self): - """ - Access the recordings - - :returns: twilio.rest.trunking.v1.trunk.recording.RecordingList - :rtype: twilio.rest.trunking.v1.trunk.recording.RecordingList - """ - if self._recordings is None: - self._recordings = RecordingList(self._version, trunk_sid=self._solution['sid'], ) - return self._recordings + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class TrunkInstance(InstanceResource): - class TransferSetting(object): - DISABLE_ALL = "disable-all" - ENABLE_ALL = "enable-all" - SIP_ONLY = "sip-only" - - class TransferCallerId(object): - FROM_TRANSFEREE = "from-transferee" - FROM_TRANSFEROR = "from-transferor" - - def __init__(self, version, payload, sid=None): - """ - Initialize the TrunkInstance - - :returns: twilio.rest.trunking.v1.trunk.TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkInstance - """ - super(TrunkInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'domain_name': payload.get('domain_name'), - 'disaster_recovery_method': payload.get('disaster_recovery_method'), - 'disaster_recovery_url': payload.get('disaster_recovery_url'), - 'friendly_name': payload.get('friendly_name'), - 'secure': payload.get('secure'), - 'recording': payload.get('recording'), - 'transfer_mode': payload.get('transfer_mode'), - 'transfer_caller_id': payload.get('transfer_caller_id'), - 'cnam_lookup_enabled': payload.get('cnam_lookup_enabled'), - 'auth_type': payload.get('auth_type'), - 'auth_type_set': payload.get('auth_type_set'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'sid': payload.get('sid'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class TrunkInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'domain_name' : payload.get('domain_name'), + 'disaster_recovery_method' : payload.get('disaster_recovery_method'), + 'disaster_recovery_url' : payload.get('disaster_recovery_url'), + 'friendly_name' : payload.get('friendly_name'), + 'secure' : payload.get('secure'), + 'recording' : payload.get('recording'), + 'transfer_mode' : payload.get('transfer_mode'), + 'transfer_caller_id' : payload.get('transfer_caller_id'), + 'cnam_lookup_enabled' : payload.get('cnam_lookup_enabled'), + 'auth_type' : payload.get('auth_type'), + 'auth_type_set' : payload.get('auth_type_set'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'sid' : payload.get('sid'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TrunkContext for this TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkContext - """ if self._context is None: - self._context = TrunkContext(self._version, sid=self._solution['sid'], ) + self._context = TrunkContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def domain_name(self): - """ - :returns: The unique address you reserve on Twilio to which you route your SIP traffic - :rtype: unicode - """ - return self._properties['domain_name'] - - @property - def disaster_recovery_method(self): - """ - :returns: The HTTP method we use to call the disaster_recovery_url - :rtype: unicode - """ - return self._properties['disaster_recovery_method'] - - @property - def disaster_recovery_url(self): - """ - :returns: The HTTP URL that we call if an error occurs while sending SIP traffic towards your configured Origination URL - :rtype: unicode - """ - return self._properties['disaster_recovery_url'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def secure(self): - """ - :returns: Whether Secure Trunking is enabled for the trunk - :rtype: bool - """ - return self._properties['secure'] - - @property - def recording(self): - """ - :returns: The recording settings for the trunk - :rtype: dict - """ - return self._properties['recording'] - - @property - def transfer_mode(self): - """ - :returns: The call transfer settings for the trunk - :rtype: TrunkInstance.TransferSetting - """ - return self._properties['transfer_mode'] - - @property - def transfer_caller_id(self): - """ - :returns: Caller Id for transfer target - :rtype: TrunkInstance.TransferCallerId - """ - return self._properties['transfer_caller_id'] - - @property - def cnam_lookup_enabled(self): - """ - :returns: Whether Caller ID Name (CNAM) lookup is enabled for the trunk - :rtype: bool - """ - return self._properties['cnam_lookup_enabled'] - - @property - def auth_type(self): - """ - :returns: The types of authentication mapped to the domain - :rtype: unicode - """ - return self._properties['auth_type'] - - @property - def auth_type_set(self): - """ - :returns: Reserved - :rtype: list[unicode] - """ - return self._properties['auth_type_set'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - + def credentials_lists(self): + return self._proxy.credentials_lists @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - + def ip_access_control_lists(self): + return self._proxy.ip_access_control_lists @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - + def origination_urls(self): + return self._proxy.origination_urls @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - + def phone_numbers(self): + return self._proxy.phone_numbers @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the TrunkInstance - - :returns: The fetched TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the TrunkInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, domain_name=values.unset, - disaster_recovery_url=values.unset, - disaster_recovery_method=values.unset, transfer_mode=values.unset, - secure=values.unset, cnam_lookup_enabled=values.unset, - transfer_caller_id=values.unset): - """ - Update the TrunkInstance - - :param unicode friendly_name: A string to describe the resource - :param unicode domain_name: The unique address you reserve on Twilio to which you route your SIP traffic - :param unicode disaster_recovery_url: The HTTP URL that we should call if an error occurs while sending SIP traffic towards your configured Origination URL - :param unicode disaster_recovery_method: The HTTP method we should use to call the disaster_recovery_url - :param TrunkInstance.TransferSetting transfer_mode: The call transfer settings for the trunk - :param bool secure: Whether Secure Trunking is enabled for the trunk - :param bool cnam_lookup_enabled: Whether Caller ID Name (CNAM) lookup should be enabled for the trunk - :param TrunkInstance.TransferCallerId transfer_caller_id: Caller Id for transfer target - - :returns: The updated TrunkInstance - :rtype: twilio.rest.trunking.v1.trunk.TrunkInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - domain_name=domain_name, - disaster_recovery_url=disaster_recovery_url, - disaster_recovery_method=disaster_recovery_method, - transfer_mode=transfer_mode, - secure=secure, - cnam_lookup_enabled=cnam_lookup_enabled, - transfer_caller_id=transfer_caller_id, - ) + def recordings(self): + return self._proxy.recordings + - @property - def origination_urls(self): + def __repr__(self): """ - Access the origination_urls - - :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlList - :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlList + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.origination_urls + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def credentials_lists(self): - """ - Access the credentials_lists - :returns: twilio.rest.trunking.v1.trunk.credential_list.CredentialListList - :rtype: twilio.rest.trunking.v1.trunk.credential_list.CredentialListList - """ - return self._proxy.credentials_lists - @property - def ip_access_control_lists(self): - """ - Access the ip_access_control_lists +class TrunkListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListList - :rtype: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListList - """ - return self._proxy.ip_access_control_lists + # Path Solution + self._solution = { } + self._uri = '/Trunks' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def phone_numbers(self): - """ - Access the phone_numbers + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberList - :rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberList - """ - return self._proxy.phone_numbers + return TrunkInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - @property - def recordings(self): - """ - Access the recordings + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.trunking.v1.trunk.recording.RecordingList - :rtype: twilio.rest.trunking.v1.trunk.recording.RecordingList - """ - return self._proxy.recordings + return TrunkPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/trusthub/v1/customer_profiles.py b/twilio/rest/trusthub/v1/customer_profiles.py deleted file mode 100644 index e29aa8e804..0000000000 --- a/twilio/rest/trusthub/v1/customer_profiles.py +++ /dev/null @@ -1,189 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Trusthub - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.customer_profiles.customer_profiles_channel_endpoint_assignment import CustomerProfilesChannelEndpointAssignmentListInstancefrom twilio.rest.customer_profiles.customer_profiles_entity_assignments import CustomerProfilesEntityAssignmentsListInstancefrom twilio.rest.customer_profiles.customer_profiles_evaluations import CustomerProfilesEvaluationsListInstance - - -class CustomerProfilesContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/CustomerProfiles/${sid}' - - self._customer_profiles_channel_endpoint_assignment = None - self._customer_profiles_entity_assignments = None - self._customer_profiles_evaluations = None - - def delete(self): - - - - """ - Deletes the CustomerProfilesInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the CustomerProfilesInstance - - :returns: The fetched CustomerProfilesInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CustomerProfilesInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return CustomerProfilesInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class CustomerProfilesInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'policy_sid' : payload.get('policy_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'status' : payload.get('status'), - 'valid_until' : payload.get('valid_until'), - 'email' : payload.get('email'), - 'status_callback' : payload.get('status_callback'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = CustomerProfilesContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def customer_profiles_channel_endpoint_assignment(self): - return self._proxy.customer_profiles_channel_endpoint_assignment - @property - def customer_profiles_entity_assignments(self): - return self._proxy.customer_profiles_entity_assignments - @property - def customer_profiles_evaluations(self): - return self._proxy.customer_profiles_evaluations - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class CustomerProfilesListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/CustomerProfiles' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return CustomerProfilesInstance(self._version, payload, ) - - """ - - """ - def page(self, status, friendly_name, policy_sid, page_size): - - data = values.of({ - 'status': status,'friendly_name': friendly_name,'policy_sid': policy_sid,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return CustomerProfilesPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/trusthub/v1/customer_profiles/__init__.py b/twilio/rest/trusthub/v1/customer_profiles/__init__.py index 60c22efbf8..e29aa8e804 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/__init__.py +++ b/twilio/rest/trusthub/v1/customer_profiles/__init__.py @@ -1,588 +1,189 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment import CustomerProfilesChannelEndpointAssignmentList -from twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments import CustomerProfilesEntityAssignmentsList -from twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations import CustomerProfilesEvaluationsList - - -class CustomerProfilesList(ListResource): - - def __init__(self, version): - """ - Initialize the CustomerProfilesList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesList - :rtype: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesList - """ - super(CustomerProfilesList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/CustomerProfiles'.format(**self._solution) - - def create(self, friendly_name, email, policy_sid, - status_callback=values.unset): - """ - Create the CustomerProfilesInstance - - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode email: The email address - :param unicode policy_sid: The unique string of a policy. - :param unicode status_callback: The URL we call to inform your application of status changes. - - :returns: The created CustomerProfilesInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Email': email, - 'PolicySid': policy_sid, - 'StatusCallback': status_callback, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return CustomerProfilesInstance(self._version, payload, ) - - def stream(self, status=values.unset, friendly_name=values.unset, - policy_sid=values.unset, limit=None, page_size=None): - """ - Streams CustomerProfilesInstance 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 CustomerProfilesInstance.Status status: The verification status of the Customer-Profile resource - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode policy_sid: The unique string of a policy. - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - friendly_name=friendly_name, - policy_sid=policy_sid, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, status=values.unset, friendly_name=values.unset, - policy_sid=values.unset, limit=None, page_size=None): - """ - Lists CustomerProfilesInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param CustomerProfilesInstance.Status status: The verification status of the Customer-Profile resource - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode policy_sid: The unique string of a policy. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesInstance] - """ - return list(self.stream( - status=status, - friendly_name=friendly_name, - policy_sid=policy_sid, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, friendly_name=values.unset, - policy_sid=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of CustomerProfilesInstance records from the API. - Request is executed immediately - - :param CustomerProfilesInstance.Status status: The verification status of the Customer-Profile resource - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode policy_sid: The unique string of a policy. - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CustomerProfilesInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesPage - """ - data = values.of({ - 'Status': status, - 'FriendlyName': friendly_name, - 'PolicySid': policy_sid, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CustomerProfilesPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CustomerProfilesInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CustomerProfilesInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CustomerProfilesPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a CustomerProfilesContext - - :param sid: The unique string that identifies the resource. - - :returns: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesContext - :rtype: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesContext - """ - return CustomerProfilesContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CustomerProfilesContext - - :param sid: The unique string that identifies the resource. - - :returns: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesContext - :rtype: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesContext - """ - return CustomerProfilesContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base.version import Version +from twilio.base.page import Page -class CustomerProfilesPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CustomerProfilesPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesPage - :rtype: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesPage - """ - super(CustomerProfilesPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CustomerProfilesInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesInstance - """ - return CustomerProfilesInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.customer_profiles.customer_profiles_channel_endpoint_assignment import CustomerProfilesChannelEndpointAssignmentListInstancefrom twilio.rest.customer_profiles.customer_profiles_entity_assignments import CustomerProfilesEntityAssignmentsListInstancefrom twilio.rest.customer_profiles.customer_profiles_evaluations import CustomerProfilesEvaluationsListInstance class CustomerProfilesContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the CustomerProfilesContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource. - - :returns: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesContext - :rtype: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesContext - """ - super(CustomerProfilesContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/CustomerProfiles/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/CustomerProfiles/${sid}' + + self._customer_profiles_channel_endpoint_assignment = None self._customer_profiles_entity_assignments = None self._customer_profiles_evaluations = None - self._customer_profiles_channel_endpoint_assignment = None + + def delete(self): + + + """ + Deletes the CustomerProfilesInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the CustomerProfilesInstance :returns: The fetched CustomerProfilesInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return CustomerProfilesInstance(self._version, payload, sid=self._solution['sid'], ) + - def update(self, status=values.unset, status_callback=values.unset, - friendly_name=values.unset, email=values.unset): - """ - Update the CustomerProfilesInstance - - :param CustomerProfilesInstance.Status status: The verification status of the Customer-Profile resource - :param unicode status_callback: The URL we call to inform your application of status changes. - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode email: The email address - - :returns: The updated CustomerProfilesInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesInstance - """ + + + def update(self, body): data = values.of({ - 'Status': status, - 'StatusCallback': status_callback, - 'FriendlyName': friendly_name, - 'Email': email, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return CustomerProfilesInstance(self._version, payload, sid=self._solution['sid'], ) + + - def delete(self): - """ - Deletes the CustomerProfilesInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def customer_profiles_entity_assignments(self): - """ - Access the customer_profiles_entity_assignments - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsList - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsList - """ - if self._customer_profiles_entity_assignments is None: - self._customer_profiles_entity_assignments = CustomerProfilesEntityAssignmentsList( - self._version, - customer_profile_sid=self._solution['sid'], - ) - return self._customer_profiles_entity_assignments - - @property - def customer_profiles_evaluations(self): - """ - Access the customer_profiles_evaluations - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsList - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsList - """ - if self._customer_profiles_evaluations is None: - self._customer_profiles_evaluations = CustomerProfilesEvaluationsList( - self._version, - customer_profile_sid=self._solution['sid'], - ) - return self._customer_profiles_evaluations - - @property - def customer_profiles_channel_endpoint_assignment(self): - """ - Access the customer_profiles_channel_endpoint_assignment - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentList - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentList - """ - if self._customer_profiles_channel_endpoint_assignment is None: - self._customer_profiles_channel_endpoint_assignment = CustomerProfilesChannelEndpointAssignmentList( - self._version, - customer_profile_sid=self._solution['sid'], - ) - return self._customer_profiles_channel_endpoint_assignment + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class CustomerProfilesInstance(InstanceResource): - class Status(object): - DRAFT = "draft" - PENDING_REVIEW = "pending-review" - IN_REVIEW = "in-review" - TWILIO_REJECTED = "twilio-rejected" - TWILIO_APPROVED = "twilio-approved" - - class EndUserType(object): - INDIVIDUAL = "individual" - BUSINESS = "business" - - def __init__(self, version, payload, sid=None): - """ - Initialize the CustomerProfilesInstance - - :returns: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesInstance - """ - super(CustomerProfilesInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'policy_sid': payload.get('policy_sid'), - 'friendly_name': payload.get('friendly_name'), - 'status': payload.get('status'), - 'valid_until': deserialize.iso8601_datetime(payload.get('valid_until')), - 'email': payload.get('email'), - 'status_callback': payload.get('status_callback'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class CustomerProfilesInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'policy_sid' : payload.get('policy_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'status' : payload.get('status'), + 'valid_until' : payload.get('valid_until'), + 'email' : payload.get('email'), + 'status_callback' : payload.get('status_callback'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CustomerProfilesContext for this CustomerProfilesInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesContext - """ if self._context is None: - self._context = CustomerProfilesContext(self._version, sid=self._solution['sid'], ) + self._context = CustomerProfilesContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def policy_sid(self): - """ - :returns: The unique string of a policy. - :rtype: unicode - """ - return self._properties['policy_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def status(self): - """ - :returns: The verification status of the Customer-Profile resource - :rtype: CustomerProfilesInstance.Status - """ - return self._properties['status'] - - @property - def valid_until(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource will be valid until. - :rtype: datetime - """ - return self._properties['valid_until'] - - @property - def email(self): - """ - :returns: The email address - :rtype: unicode - """ - return self._properties['email'] - - @property - def status_callback(self): - """ - :returns: The URL we call to inform your application of status changes. - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - + def customer_profiles_channel_endpoint_assignment(self): + return self._proxy.customer_profiles_channel_endpoint_assignment @property - def url(self): - """ - :returns: The absolute URL of the Customer-Profile resource - :rtype: unicode - """ - return self._properties['url'] - + def customer_profiles_entity_assignments(self): + return self._proxy.customer_profiles_entity_assignments @property - def links(self): - """ - :returns: The URLs of the Assigned Items of the Customer-Profile resource - :rtype: unicode - """ - return self._properties['links'] + def customer_profiles_evaluations(self): + return self._proxy.customer_profiles_evaluations + - def fetch(self): + def __repr__(self): """ - Fetch the CustomerProfilesInstance - - :returns: The fetched CustomerProfilesInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def update(self, status=values.unset, status_callback=values.unset, - friendly_name=values.unset, email=values.unset): - """ - Update the CustomerProfilesInstance - :param CustomerProfilesInstance.Status status: The verification status of the Customer-Profile resource - :param unicode status_callback: The URL we call to inform your application of status changes. - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode email: The email address - :returns: The updated CustomerProfilesInstance - :rtype: twilio.rest.trusthub.v1.customer_profiles.CustomerProfilesInstance - """ - return self._proxy.update( - status=status, - status_callback=status_callback, - friendly_name=friendly_name, - email=email, - ) +class CustomerProfilesListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - def delete(self): - """ - Deletes the CustomerProfilesInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def customer_profiles_entity_assignments(self): - """ - Access the customer_profiles_entity_assignments - - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsList - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments.CustomerProfilesEntityAssignmentsList - """ - return self._proxy.customer_profiles_entity_assignments + # Path Solution + self._solution = { } + self._uri = '/CustomerProfiles' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def customer_profiles_evaluations(self): - """ - Access the customer_profiles_evaluations + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsList - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations.CustomerProfilesEvaluationsList - """ - return self._proxy.customer_profiles_evaluations + return CustomerProfilesInstance(self._version, payload, ) + + """ + + """ + def page(self, status, friendly_name, policy_sid, page_size): + + data = values.of({ + 'status': status,'friendly_name': friendly_name,'policy_sid': policy_sid,'page_size': page_size, + }) - @property - def customer_profiles_channel_endpoint_assignment(self): - """ - Access the customer_profiles_channel_endpoint_assignment + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentList - :rtype: twilio.rest.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment.CustomerProfilesChannelEndpointAssignmentList - """ - return self._proxy.customer_profiles_channel_endpoint_assignment + return CustomerProfilesPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/trusthub/v1/trust_products.py b/twilio/rest/trusthub/v1/trust_products.py deleted file mode 100644 index 13d578fa80..0000000000 --- a/twilio/rest/trusthub/v1/trust_products.py +++ /dev/null @@ -1,189 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Trusthub - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.trust_products.trust_products_channel_endpoint_assignment import TrustProductsChannelEndpointAssignmentListInstancefrom twilio.rest.trust_products.trust_products_entity_assignments import TrustProductsEntityAssignmentsListInstancefrom twilio.rest.trust_products.trust_products_evaluations import TrustProductsEvaluationsListInstance - - -class TrustProductsContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/TrustProducts/${sid}' - - self._trust_products_channel_endpoint_assignment = None - self._trust_products_entity_assignments = None - self._trust_products_evaluations = None - - def delete(self): - - - - """ - Deletes the TrustProductsInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the TrustProductsInstance - - :returns: The fetched TrustProductsInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return TrustProductsInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return TrustProductsInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class TrustProductsInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'policy_sid' : payload.get('policy_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'status' : payload.get('status'), - 'valid_until' : payload.get('valid_until'), - 'email' : payload.get('email'), - 'status_callback' : payload.get('status_callback'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = TrustProductsContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def trust_products_channel_endpoint_assignment(self): - return self._proxy.trust_products_channel_endpoint_assignment - @property - def trust_products_entity_assignments(self): - return self._proxy.trust_products_entity_assignments - @property - def trust_products_evaluations(self): - return self._proxy.trust_products_evaluations - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class TrustProductsListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/TrustProducts' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return TrustProductsInstance(self._version, payload, ) - - """ - - """ - def page(self, status, friendly_name, policy_sid, page_size): - - data = values.of({ - 'status': status,'friendly_name': friendly_name,'policy_sid': policy_sid,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return TrustProductsPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/trusthub/v1/trust_products/__init__.py b/twilio/rest/trusthub/v1/trust_products/__init__.py index 275bda7366..13d578fa80 100644 --- a/twilio/rest/trusthub/v1/trust_products/__init__.py +++ b/twilio/rest/trusthub/v1/trust_products/__init__.py @@ -1,588 +1,189 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Trusthub + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment import TrustProductsChannelEndpointAssignmentList -from twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments import TrustProductsEntityAssignmentsList -from twilio.rest.trusthub.v1.trust_products.trust_products_evaluations import TrustProductsEvaluationsList - - -class TrustProductsList(ListResource): - - def __init__(self, version): - """ - Initialize the TrustProductsList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.trusthub.v1.trust_products.TrustProductsList - :rtype: twilio.rest.trusthub.v1.trust_products.TrustProductsList - """ - super(TrustProductsList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/TrustProducts'.format(**self._solution) - - def create(self, friendly_name, email, policy_sid, - status_callback=values.unset): - """ - Create the TrustProductsInstance - - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode email: The email address - :param unicode policy_sid: The unique string of a policy. - :param unicode status_callback: The URL we call to inform your application of status changes. - - :returns: The created TrustProductsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.TrustProductsInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'Email': email, - 'PolicySid': policy_sid, - 'StatusCallback': status_callback, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return TrustProductsInstance(self._version, payload, ) - - def stream(self, status=values.unset, friendly_name=values.unset, - policy_sid=values.unset, limit=None, page_size=None): - """ - Streams TrustProductsInstance 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 TrustProductsInstance.Status status: The verification status of the Customer-Profile resource - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode policy_sid: The unique string of a policy. - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.trusthub.v1.trust_products.TrustProductsInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - friendly_name=friendly_name, - policy_sid=policy_sid, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, status=values.unset, friendly_name=values.unset, - policy_sid=values.unset, limit=None, page_size=None): - """ - Lists TrustProductsInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param TrustProductsInstance.Status status: The verification status of the Customer-Profile resource - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode policy_sid: The unique string of a policy. - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.trusthub.v1.trust_products.TrustProductsInstance] - """ - return list(self.stream( - status=status, - friendly_name=friendly_name, - policy_sid=policy_sid, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, friendly_name=values.unset, - policy_sid=values.unset, page_token=values.unset, - page_number=values.unset, page_size=values.unset): - """ - Retrieve a single page of TrustProductsInstance records from the API. - Request is executed immediately - - :param TrustProductsInstance.Status status: The verification status of the Customer-Profile resource - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode policy_sid: The unique string of a policy. - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of TrustProductsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.TrustProductsPage - """ - data = values.of({ - 'Status': status, - 'FriendlyName': friendly_name, - 'PolicySid': policy_sid, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return TrustProductsPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of TrustProductsInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of TrustProductsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.TrustProductsPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return TrustProductsPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a TrustProductsContext - - :param sid: The unique string that identifies the resource. - - :returns: twilio.rest.trusthub.v1.trust_products.TrustProductsContext - :rtype: twilio.rest.trusthub.v1.trust_products.TrustProductsContext - """ - return TrustProductsContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a TrustProductsContext - - :param sid: The unique string that identifies the resource. - - :returns: twilio.rest.trusthub.v1.trust_products.TrustProductsContext - :rtype: twilio.rest.trusthub.v1.trust_products.TrustProductsContext - """ - return TrustProductsContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base.version import Version +from twilio.base.page import Page -class TrustProductsPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the TrustProductsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.trusthub.v1.trust_products.TrustProductsPage - :rtype: twilio.rest.trusthub.v1.trust_products.TrustProductsPage - """ - super(TrustProductsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of TrustProductsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.trusthub.v1.trust_products.TrustProductsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.TrustProductsInstance - """ - return TrustProductsInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.trust_products.trust_products_channel_endpoint_assignment import TrustProductsChannelEndpointAssignmentListInstancefrom twilio.rest.trust_products.trust_products_entity_assignments import TrustProductsEntityAssignmentsListInstancefrom twilio.rest.trust_products.trust_products_evaluations import TrustProductsEvaluationsListInstance class TrustProductsContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the TrustProductsContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource. - - :returns: twilio.rest.trusthub.v1.trust_products.TrustProductsContext - :rtype: twilio.rest.trusthub.v1.trust_products.TrustProductsContext - """ - super(TrustProductsContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/TrustProducts/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/TrustProducts/${sid}' + + self._trust_products_channel_endpoint_assignment = None self._trust_products_entity_assignments = None self._trust_products_evaluations = None - self._trust_products_channel_endpoint_assignment = None + + def delete(self): + + + """ + Deletes the TrustProductsInstance + + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the TrustProductsInstance :returns: The fetched TrustProductsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.TrustProductsInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return TrustProductsInstance(self._version, payload, sid=self._solution['sid'], ) + - def update(self, status=values.unset, status_callback=values.unset, - friendly_name=values.unset, email=values.unset): - """ - Update the TrustProductsInstance - - :param TrustProductsInstance.Status status: The verification status of the Customer-Profile resource - :param unicode status_callback: The URL we call to inform your application of status changes. - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode email: The email address - - :returns: The updated TrustProductsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.TrustProductsInstance - """ + + + def update(self, body): data = values.of({ - 'Status': status, - 'StatusCallback': status_callback, - 'FriendlyName': friendly_name, - 'Email': email, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return TrustProductsInstance(self._version, payload, sid=self._solution['sid'], ) + + - def delete(self): - """ - Deletes the TrustProductsInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def trust_products_entity_assignments(self): - """ - Access the trust_products_entity_assignments - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsList - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsList - """ - if self._trust_products_entity_assignments is None: - self._trust_products_entity_assignments = TrustProductsEntityAssignmentsList( - self._version, - trust_product_sid=self._solution['sid'], - ) - return self._trust_products_entity_assignments - - @property - def trust_products_evaluations(self): - """ - Access the trust_products_evaluations - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsList - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsList - """ - if self._trust_products_evaluations is None: - self._trust_products_evaluations = TrustProductsEvaluationsList( - self._version, - trust_product_sid=self._solution['sid'], - ) - return self._trust_products_evaluations - - @property - def trust_products_channel_endpoint_assignment(self): - """ - Access the trust_products_channel_endpoint_assignment - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentList - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentList - """ - if self._trust_products_channel_endpoint_assignment is None: - self._trust_products_channel_endpoint_assignment = TrustProductsChannelEndpointAssignmentList( - self._version, - trust_product_sid=self._solution['sid'], - ) - return self._trust_products_channel_endpoint_assignment + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class TrustProductsInstance(InstanceResource): - class Status(object): - DRAFT = "draft" - PENDING_REVIEW = "pending-review" - IN_REVIEW = "in-review" - TWILIO_REJECTED = "twilio-rejected" - TWILIO_APPROVED = "twilio-approved" - - class EndUserType(object): - INDIVIDUAL = "individual" - BUSINESS = "business" - - def __init__(self, version, payload, sid=None): - """ - Initialize the TrustProductsInstance - - :returns: twilio.rest.trusthub.v1.trust_products.TrustProductsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.TrustProductsInstance - """ - super(TrustProductsInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'policy_sid': payload.get('policy_sid'), - 'friendly_name': payload.get('friendly_name'), - 'status': payload.get('status'), - 'valid_until': deserialize.iso8601_datetime(payload.get('valid_until')), - 'email': payload.get('email'), - 'status_callback': payload.get('status_callback'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class TrustProductsInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'policy_sid' : payload.get('policy_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'status' : payload.get('status'), + 'valid_until' : payload.get('valid_until'), + 'email' : payload.get('email'), + 'status_callback' : payload.get('status_callback'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: TrustProductsContext for this TrustProductsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.TrustProductsContext - """ if self._context is None: - self._context = TrustProductsContext(self._version, sid=self._solution['sid'], ) + self._context = TrustProductsContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def policy_sid(self): - """ - :returns: The unique string of a policy. - :rtype: unicode - """ - return self._properties['policy_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def status(self): - """ - :returns: The verification status of the Customer-Profile resource - :rtype: TrustProductsInstance.Status - """ - return self._properties['status'] - - @property - def valid_until(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource will be valid until. - :rtype: datetime - """ - return self._properties['valid_until'] - - @property - def email(self): - """ - :returns: The email address - :rtype: unicode - """ - return self._properties['email'] - - @property - def status_callback(self): - """ - :returns: The URL we call to inform your application of status changes. - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - + def trust_products_channel_endpoint_assignment(self): + return self._proxy.trust_products_channel_endpoint_assignment @property - def url(self): - """ - :returns: The absolute URL of the Customer-Profile resource - :rtype: unicode - """ - return self._properties['url'] - + def trust_products_entity_assignments(self): + return self._proxy.trust_products_entity_assignments @property - def links(self): - """ - :returns: The URLs of the Assigned Items of the Customer-Profile resource - :rtype: unicode - """ - return self._properties['links'] + def trust_products_evaluations(self): + return self._proxy.trust_products_evaluations + - def fetch(self): + def __repr__(self): """ - Fetch the TrustProductsInstance - - :returns: The fetched TrustProductsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.TrustProductsInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def update(self, status=values.unset, status_callback=values.unset, - friendly_name=values.unset, email=values.unset): - """ - Update the TrustProductsInstance - :param TrustProductsInstance.Status status: The verification status of the Customer-Profile resource - :param unicode status_callback: The URL we call to inform your application of status changes. - :param unicode friendly_name: The string that you assigned to describe the resource - :param unicode email: The email address - :returns: The updated TrustProductsInstance - :rtype: twilio.rest.trusthub.v1.trust_products.TrustProductsInstance - """ - return self._proxy.update( - status=status, - status_callback=status_callback, - friendly_name=friendly_name, - email=email, - ) +class TrustProductsListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - def delete(self): - """ - Deletes the TrustProductsInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def trust_products_entity_assignments(self): - """ - Access the trust_products_entity_assignments - - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsList - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments.TrustProductsEntityAssignmentsList - """ - return self._proxy.trust_products_entity_assignments + # Path Solution + self._solution = { } + self._uri = '/TrustProducts' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def trust_products_evaluations(self): - """ - Access the trust_products_evaluations + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsList - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_evaluations.TrustProductsEvaluationsList - """ - return self._proxy.trust_products_evaluations + return TrustProductsInstance(self._version, payload, ) + + """ + + """ + def page(self, status, friendly_name, policy_sid, page_size): + + data = values.of({ + 'status': status,'friendly_name': friendly_name,'policy_sid': policy_sid,'page_size': page_size, + }) - @property - def trust_products_channel_endpoint_assignment(self): - """ - Access the trust_products_channel_endpoint_assignment + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentList - :rtype: twilio.rest.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment.TrustProductsChannelEndpointAssignmentList - """ - return self._proxy.trust_products_channel_endpoint_assignment + return TrustProductsPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/verify/v2/service.py b/twilio/rest/verify/v2/service.py deleted file mode 100644 index 4da0b7e902..0000000000 --- a/twilio/rest/verify/v2/service.py +++ /dev/null @@ -1,211 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Verify - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.service.access_token import AccessTokenListInstancefrom twilio.rest.service.entity import EntityListInstancefrom twilio.rest.service.messaging_configuration import MessagingConfigurationListInstancefrom twilio.rest.service.rate_limit import RateLimitListInstancefrom twilio.rest.service.verification import VerificationListInstancefrom twilio.rest.service.verification_check import VerificationCheckListInstancefrom twilio.rest.service.webhook import WebhookListInstance - - -class ServiceContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Services/${sid}' - - self._access_tokens = None - self._entities = None - self._messaging_configurations = None - self._rate_limits = None - self._verifications = None - self._verification_checks = None - self._webhooks = None - - def delete(self): - - - - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'code_length' : payload.get('code_length'), - 'lookup_enabled' : payload.get('lookup_enabled'), - 'psd2_enabled' : payload.get('psd2_enabled'), - 'skip_sms_to_landlines' : payload.get('skip_sms_to_landlines'), - 'dtmf_input_required' : payload.get('dtmf_input_required'), - 'tts_name' : payload.get('tts_name'), - 'do_not_share_warning_enabled' : payload.get('do_not_share_warning_enabled'), - 'custom_code_enabled' : payload.get('custom_code_enabled'), - 'push' : payload.get('push'), - 'totp' : payload.get('totp'), - 'default_template_sid' : payload.get('default_template_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ServiceContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def access_tokens(self): - return self._proxy.access_tokens - @property - def entities(self): - return self._proxy.entities - @property - def messaging_configurations(self): - return self._proxy.messaging_configurations - @property - def rate_limits(self): - return self._proxy.rate_limits - @property - def verifications(self): - return self._proxy.verifications - @property - def verification_checks(self): - return self._proxy.verification_checks - @property - def webhooks(self): - return self._proxy.webhooks - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ServiceListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Services' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ServicePage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/verify/v2/service/__init__.py b/twilio/rest/verify/v2/service/__init__.py index 3c1b7407dd..4da0b7e902 100644 --- a/twilio/rest/verify/v2/service/__init__.py +++ b/twilio/rest/verify/v2/service/__init__.py @@ -1,790 +1,211 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Verify + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.verify.v2.service.access_token import AccessTokenList -from twilio.rest.verify.v2.service.entity import EntityList -from twilio.rest.verify.v2.service.messaging_configuration import MessagingConfigurationList -from twilio.rest.verify.v2.service.rate_limit import RateLimitList -from twilio.rest.verify.v2.service.verification import VerificationList -from twilio.rest.verify.v2.service.verification_check import VerificationCheckList -from twilio.rest.verify.v2.service.webhook import WebhookList - - -class ServiceList(ListResource): - - def __init__(self, version): - """ - Initialize the ServiceList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.verify.v2.service.ServiceList - :rtype: twilio.rest.verify.v2.service.ServiceList - """ - super(ServiceList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Services'.format(**self._solution) - - def create(self, friendly_name, code_length=values.unset, - lookup_enabled=values.unset, skip_sms_to_landlines=values.unset, - dtmf_input_required=values.unset, tts_name=values.unset, - psd2_enabled=values.unset, do_not_share_warning_enabled=values.unset, - custom_code_enabled=values.unset, push_include_date=values.unset, - push_apn_credential_sid=values.unset, - push_fcm_credential_sid=values.unset, totp_issuer=values.unset, - totp_time_step=values.unset, totp_code_length=values.unset, - totp_skew=values.unset, default_template_sid=values.unset): - """ - Create the ServiceInstance - - :param unicode friendly_name: A string to describe the verification service - :param unicode code_length: The length of the verification code to generate - :param bool lookup_enabled: Whether to perform a lookup with each verification - :param bool skip_sms_to_landlines: Whether to skip sending SMS verifications to landlines - :param bool dtmf_input_required: Whether to ask the user to press a number before delivering the verify code in a phone call - :param unicode tts_name: The name of an alternative text-to-speech service to use in phone calls - :param bool psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification - :param bool do_not_share_warning_enabled: Whether to add a security warning at the end of an SMS. - :param bool custom_code_enabled: Whether to allow sending verifications with a custom code. - :param bool push_include_date: Optional. Include the date in the Challenge's response. Default: false. **Deprecated** do not use this parameter. - :param unicode push_apn_credential_sid: Optional. Set APN Credential for this service. - :param unicode push_fcm_credential_sid: Optional. Set FCM Credential for this service. - :param unicode totp_issuer: Optional. Set TOTP Issuer for this service. - :param unicode totp_time_step: Optional. How often, in seconds, are TOTP codes generated - :param unicode totp_code_length: Optional. Number of digits for generated TOTP codes - :param unicode totp_skew: Optional. The number of past and future time-steps valid at a given time - :param unicode default_template_sid: The verification template SMS messages. - - :returns: The created ServiceInstance - :rtype: twilio.rest.verify.v2.service.ServiceInstance - """ - data = values.of({ - 'FriendlyName': friendly_name, - 'CodeLength': code_length, - 'LookupEnabled': lookup_enabled, - 'SkipSmsToLandlines': skip_sms_to_landlines, - 'DtmfInputRequired': dtmf_input_required, - 'TtsName': tts_name, - 'Psd2Enabled': psd2_enabled, - 'DoNotShareWarningEnabled': do_not_share_warning_enabled, - 'CustomCodeEnabled': custom_code_enabled, - 'Push.IncludeDate': push_include_date, - 'Push.ApnCredentialSid': push_apn_credential_sid, - 'Push.FcmCredentialSid': push_fcm_credential_sid, - 'Totp.Issuer': totp_issuer, - 'Totp.TimeStep': totp_time_step, - 'Totp.CodeLength': totp_code_length, - 'Totp.Skew': totp_skew, - 'DefaultTemplateSid': default_template_sid, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ServiceInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ServiceInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.verify.v2.service.ServiceInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ServiceInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.verify.v2.service.ServiceInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ServiceInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ServiceInstance - :rtype: twilio.rest.verify.v2.service.ServicePage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ServicePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ServiceInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ServiceInstance - :rtype: twilio.rest.verify.v2.service.ServicePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ServicePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ServiceContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.verify.v2.service.ServiceContext - :rtype: twilio.rest.verify.v2.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ServiceContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.verify.v2.service.ServiceContext - :rtype: twilio.rest.verify.v2.service.ServiceContext - """ - return ServiceContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +from twilio.base.version import Version +from twilio.base.page import Page -class ServicePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ServicePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.verify.v2.service.ServicePage - :rtype: twilio.rest.verify.v2.service.ServicePage - """ - super(ServicePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ServiceInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.verify.v2.service.ServiceInstance - :rtype: twilio.rest.verify.v2.service.ServiceInstance - """ - return ServiceInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.service.access_token import AccessTokenListInstancefrom twilio.rest.service.entity import EntityListInstancefrom twilio.rest.service.messaging_configuration import MessagingConfigurationListInstancefrom twilio.rest.service.rate_limit import RateLimitListInstancefrom twilio.rest.service.verification import VerificationListInstancefrom twilio.rest.service.verification_check import VerificationCheckListInstancefrom twilio.rest.service.webhook import WebhookListInstance class ServiceContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the ServiceContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.verify.v2.service.ServiceContext - :rtype: twilio.rest.verify.v2.service.ServiceContext - """ - super(ServiceContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Services/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'sid': sid, } + self._uri = '/Services/${sid}' + + self._access_tokens = None + self._entities = None + self._messaging_configurations = None + self._rate_limits = None self._verifications = None self._verification_checks = None - self._rate_limits = None - self._messaging_configurations = None - self._entities = None self._webhooks = None - self._access_tokens = None + + def delete(self): + + + + """ + Deletes the ServiceInstance + :returns: True if delete succeeds, False otherwise + :rtype: bool + """ + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the ServiceInstance :returns: The fetched ServiceInstance - :rtype: twilio.rest.verify.v2.service.ServiceInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def update(self, friendly_name=values.unset, code_length=values.unset, - lookup_enabled=values.unset, skip_sms_to_landlines=values.unset, - dtmf_input_required=values.unset, tts_name=values.unset, - psd2_enabled=values.unset, do_not_share_warning_enabled=values.unset, - custom_code_enabled=values.unset, push_include_date=values.unset, - push_apn_credential_sid=values.unset, - push_fcm_credential_sid=values.unset, totp_issuer=values.unset, - totp_time_step=values.unset, totp_code_length=values.unset, - totp_skew=values.unset, default_template_sid=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: A string to describe the verification service - :param unicode code_length: The length of the verification code to generate - :param bool lookup_enabled: Whether to perform a lookup with each verification - :param bool skip_sms_to_landlines: Whether to skip sending SMS verifications to landlines - :param bool dtmf_input_required: Whether to ask the user to press a number before delivering the verify code in a phone call - :param unicode tts_name: The name of an alternative text-to-speech service to use in phone calls - :param bool psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification - :param bool do_not_share_warning_enabled: Whether to add a privacy warning at the end of an SMS. - :param bool custom_code_enabled: Whether to allow sending verifications with a custom code. - :param bool push_include_date: Optional. Include the date in the Challenge's response. Default: false. **Deprecated** do not use this parameter. - :param unicode push_apn_credential_sid: Optional. Set APN Credential for this service. - :param unicode push_fcm_credential_sid: Optional. Set FCM Credential for this service. - :param unicode totp_issuer: Optional. Set TOTP Issuer for this service. - :param unicode totp_time_step: Optional. How often, in seconds, are TOTP codes generated - :param unicode totp_code_length: Optional. Number of digits for generated TOTP codes - :param unicode totp_skew: Optional. The number of past and future time-steps valid at a given time - :param unicode default_template_sid: The verification template SMS messages. - - :returns: The updated ServiceInstance - :rtype: twilio.rest.verify.v2.service.ServiceInstance - """ + + + def update(self, body): data = values.of({ - 'FriendlyName': friendly_name, - 'CodeLength': code_length, - 'LookupEnabled': lookup_enabled, - 'SkipSmsToLandlines': skip_sms_to_landlines, - 'DtmfInputRequired': dtmf_input_required, - 'TtsName': tts_name, - 'Psd2Enabled': psd2_enabled, - 'DoNotShareWarningEnabled': do_not_share_warning_enabled, - 'CustomCodeEnabled': custom_code_enabled, - 'Push.IncludeDate': push_include_date, - 'Push.ApnCredentialSid': push_apn_credential_sid, - 'Push.FcmCredentialSid': push_fcm_credential_sid, - 'Totp.Issuer': totp_issuer, - 'Totp.TimeStep': totp_time_step, - 'Totp.CodeLength': totp_code_length, - 'Totp.Skew': totp_skew, - 'DefaultTemplateSid': default_template_sid, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return ServiceInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def verifications(self): - """ - Access the verifications - - :returns: twilio.rest.verify.v2.service.verification.VerificationList - :rtype: twilio.rest.verify.v2.service.verification.VerificationList - """ - if self._verifications is None: - self._verifications = VerificationList(self._version, service_sid=self._solution['sid'], ) - return self._verifications - - @property - def verification_checks(self): - """ - Access the verification_checks - - :returns: twilio.rest.verify.v2.service.verification_check.VerificationCheckList - :rtype: twilio.rest.verify.v2.service.verification_check.VerificationCheckList - """ - if self._verification_checks is None: - self._verification_checks = VerificationCheckList(self._version, service_sid=self._solution['sid'], ) - return self._verification_checks - - @property - def rate_limits(self): - """ - Access the rate_limits - - :returns: twilio.rest.verify.v2.service.rate_limit.RateLimitList - :rtype: twilio.rest.verify.v2.service.rate_limit.RateLimitList - """ - if self._rate_limits is None: - self._rate_limits = RateLimitList(self._version, service_sid=self._solution['sid'], ) - return self._rate_limits - - @property - def messaging_configurations(self): - """ - Access the messaging_configurations - - :returns: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationList - :rtype: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationList - """ - if self._messaging_configurations is None: - self._messaging_configurations = MessagingConfigurationList( - self._version, - service_sid=self._solution['sid'], - ) - return self._messaging_configurations - - @property - def entities(self): - """ - Access the entities - - :returns: twilio.rest.verify.v2.service.entity.EntityList - :rtype: twilio.rest.verify.v2.service.entity.EntityList - """ - if self._entities is None: - self._entities = EntityList(self._version, service_sid=self._solution['sid'], ) - return self._entities - - @property - def webhooks(self): - """ - Access the webhooks - - :returns: twilio.rest.verify.v2.service.webhook.WebhookList - :rtype: twilio.rest.verify.v2.service.webhook.WebhookList - """ - if self._webhooks is None: - self._webhooks = WebhookList(self._version, service_sid=self._solution['sid'], ) - return self._webhooks - - @property - def access_tokens(self): - """ - Access the access_tokens - - :returns: twilio.rest.verify.v2.service.access_token.AccessTokenList - :rtype: twilio.rest.verify.v2.service.access_token.AccessTokenList - """ - if self._access_tokens is None: - self._access_tokens = AccessTokenList(self._version, service_sid=self._solution['sid'], ) - return self._access_tokens + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid=None): - """ - Initialize the ServiceInstance - - :returns: twilio.rest.verify.v2.service.ServiceInstance - :rtype: twilio.rest.verify.v2.service.ServiceInstance - """ - super(ServiceInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'friendly_name': payload.get('friendly_name'), - 'code_length': deserialize.integer(payload.get('code_length')), - 'lookup_enabled': payload.get('lookup_enabled'), - 'psd2_enabled': payload.get('psd2_enabled'), - 'skip_sms_to_landlines': payload.get('skip_sms_to_landlines'), - 'dtmf_input_required': payload.get('dtmf_input_required'), - 'tts_name': payload.get('tts_name'), - 'do_not_share_warning_enabled': payload.get('do_not_share_warning_enabled'), - 'custom_code_enabled': payload.get('custom_code_enabled'), - 'push': payload.get('push'), - 'totp': payload.get('totp'), - 'default_template_sid': payload.get('default_template_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ServiceInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'code_length' : payload.get('code_length'), + 'lookup_enabled' : payload.get('lookup_enabled'), + 'psd2_enabled' : payload.get('psd2_enabled'), + 'skip_sms_to_landlines' : payload.get('skip_sms_to_landlines'), + 'dtmf_input_required' : payload.get('dtmf_input_required'), + 'tts_name' : payload.get('tts_name'), + 'do_not_share_warning_enabled' : payload.get('do_not_share_warning_enabled'), + 'custom_code_enabled' : payload.get('custom_code_enabled'), + 'push' : payload.get('push'), + 'totp' : payload.get('totp'), + 'default_template_sid' : payload.get('default_template_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ServiceContext for this ServiceInstance - :rtype: twilio.rest.verify.v2.service.ServiceContext - """ if self._context is None: - self._context = ServiceContext(self._version, sid=self._solution['sid'], ) + self._context = ServiceContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the verification service - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def code_length(self): - """ - :returns: The length of the verification code - :rtype: unicode - """ - return self._properties['code_length'] - - @property - def lookup_enabled(self): - """ - :returns: Whether to perform a lookup with each verification - :rtype: bool - """ - return self._properties['lookup_enabled'] - - @property - def psd2_enabled(self): - """ - :returns: Whether to pass PSD2 transaction parameters when starting a verification - :rtype: bool - """ - return self._properties['psd2_enabled'] - - @property - def skip_sms_to_landlines(self): - """ - :returns: Whether to skip sending SMS verifications to landlines - :rtype: bool - """ - return self._properties['skip_sms_to_landlines'] - - @property - def dtmf_input_required(self): - """ - :returns: Whether to ask the user to press a number before delivering the verify code in a phone call - :rtype: bool - """ - return self._properties['dtmf_input_required'] - - @property - def tts_name(self): - """ - :returns: The name of an alternative text-to-speech service to use in phone calls - :rtype: unicode - """ - return self._properties['tts_name'] - - @property - def do_not_share_warning_enabled(self): - """ - :returns: Whether to add a security warning at the end of an SMS. - :rtype: bool - """ - return self._properties['do_not_share_warning_enabled'] - - @property - def custom_code_enabled(self): - """ - :returns: Whether to allow sending verifications with a custom code. - :rtype: bool - """ - return self._properties['custom_code_enabled'] - - @property - def push(self): - """ - :returns: The service level configuration of factor push type. - :rtype: dict - """ - return self._properties['push'] - - @property - def totp(self): - """ - :returns: The service level configuration of factor TOTP type. - :rtype: dict - """ - return self._properties['totp'] - - @property - def default_template_sid(self): - """ - :returns: The default_template_sid - :rtype: unicode - """ - return self._properties['default_template_sid'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - + def access_tokens(self): + return self._proxy.access_tokens @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - + def entities(self): + return self._proxy.entities @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - + def messaging_configurations(self): + return self._proxy.messaging_configurations @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the ServiceInstance - - :returns: The fetched ServiceInstance - :rtype: twilio.rest.verify.v2.service.ServiceInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the ServiceInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def update(self, friendly_name=values.unset, code_length=values.unset, - lookup_enabled=values.unset, skip_sms_to_landlines=values.unset, - dtmf_input_required=values.unset, tts_name=values.unset, - psd2_enabled=values.unset, do_not_share_warning_enabled=values.unset, - custom_code_enabled=values.unset, push_include_date=values.unset, - push_apn_credential_sid=values.unset, - push_fcm_credential_sid=values.unset, totp_issuer=values.unset, - totp_time_step=values.unset, totp_code_length=values.unset, - totp_skew=values.unset, default_template_sid=values.unset): - """ - Update the ServiceInstance - - :param unicode friendly_name: A string to describe the verification service - :param unicode code_length: The length of the verification code to generate - :param bool lookup_enabled: Whether to perform a lookup with each verification - :param bool skip_sms_to_landlines: Whether to skip sending SMS verifications to landlines - :param bool dtmf_input_required: Whether to ask the user to press a number before delivering the verify code in a phone call - :param unicode tts_name: The name of an alternative text-to-speech service to use in phone calls - :param bool psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification - :param bool do_not_share_warning_enabled: Whether to add a privacy warning at the end of an SMS. - :param bool custom_code_enabled: Whether to allow sending verifications with a custom code. - :param bool push_include_date: Optional. Include the date in the Challenge's response. Default: false. **Deprecated** do not use this parameter. - :param unicode push_apn_credential_sid: Optional. Set APN Credential for this service. - :param unicode push_fcm_credential_sid: Optional. Set FCM Credential for this service. - :param unicode totp_issuer: Optional. Set TOTP Issuer for this service. - :param unicode totp_time_step: Optional. How often, in seconds, are TOTP codes generated - :param unicode totp_code_length: Optional. Number of digits for generated TOTP codes - :param unicode totp_skew: Optional. The number of past and future time-steps valid at a given time - :param unicode default_template_sid: The verification template SMS messages. - - :returns: The updated ServiceInstance - :rtype: twilio.rest.verify.v2.service.ServiceInstance - """ - return self._proxy.update( - friendly_name=friendly_name, - code_length=code_length, - lookup_enabled=lookup_enabled, - skip_sms_to_landlines=skip_sms_to_landlines, - dtmf_input_required=dtmf_input_required, - tts_name=tts_name, - psd2_enabled=psd2_enabled, - do_not_share_warning_enabled=do_not_share_warning_enabled, - custom_code_enabled=custom_code_enabled, - push_include_date=push_include_date, - push_apn_credential_sid=push_apn_credential_sid, - push_fcm_credential_sid=push_fcm_credential_sid, - totp_issuer=totp_issuer, - totp_time_step=totp_time_step, - totp_code_length=totp_code_length, - totp_skew=totp_skew, - default_template_sid=default_template_sid, - ) - + def rate_limits(self): + return self._proxy.rate_limits @property def verifications(self): - """ - Access the verifications - - :returns: twilio.rest.verify.v2.service.verification.VerificationList - :rtype: twilio.rest.verify.v2.service.verification.VerificationList - """ return self._proxy.verifications - @property def verification_checks(self): - """ - Access the verification_checks - - :returns: twilio.rest.verify.v2.service.verification_check.VerificationCheckList - :rtype: twilio.rest.verify.v2.service.verification_check.VerificationCheckList - """ return self._proxy.verification_checks - @property - def rate_limits(self): - """ - Access the rate_limits + def webhooks(self): + return self._proxy.webhooks + - :returns: twilio.rest.verify.v2.service.rate_limit.RateLimitList - :rtype: twilio.rest.verify.v2.service.rate_limit.RateLimitList + def __repr__(self): """ - return self._proxy.rate_limits - - @property - def messaging_configurations(self): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Access the messaging_configurations + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :returns: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationList - :rtype: twilio.rest.verify.v2.service.messaging_configuration.MessagingConfigurationList - """ - return self._proxy.messaging_configurations - @property - def entities(self): - """ - Access the entities - :returns: twilio.rest.verify.v2.service.entity.EntityList - :rtype: twilio.rest.verify.v2.service.entity.EntityList - """ - return self._proxy.entities +class ServiceListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - @property - def webhooks(self): - """ - Access the webhooks + # Path Solution + self._solution = { } + self._uri = '/Services' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - :returns: twilio.rest.verify.v2.service.webhook.WebhookList - :rtype: twilio.rest.verify.v2.service.webhook.WebhookList - """ - return self._proxy.webhooks + payload = self._version.create(method='post', uri=self._uri, data=data, ) - @property - def access_tokens(self): - """ - Access the access_tokens + return ServiceInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) - :returns: twilio.rest.verify.v2.service.access_token.AccessTokenList - :rtype: twilio.rest.verify.v2.service.access_token.AccessTokenList - """ - return self._proxy.access_tokens + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ServicePage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/verify/v2/service/entity.py b/twilio/rest/verify/v2/service/entity.py deleted file mode 100644 index 938bcf8f78..0000000000 --- a/twilio/rest/verify/v2/service/entity.py +++ /dev/null @@ -1,172 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Verify - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.entity.challenge import ChallengeListInstancefrom twilio.rest.entity.factor import FactorListInstancefrom twilio.rest.entity.new_factor import NewFactorListInstance - - -class EntityContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, identity: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'identity': identity, } - self._uri = '/Services/${service_sid}/Entities/${identity}' - - self._challenges = None - self._factors = None - self._new_factors = None - - def delete(self): - - - - """ - Deletes the EntityInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the EntityInstance - - :returns: The fetched EntityInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return EntityInstance(self._version, payload, service_sid=self._solution['service_sid'], identity=self._solution['identity'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class EntityInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, identity: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'identity' : payload.get('identity'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'identity': identity or self._properties['identity'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = EntityContext( - self._version, - service_sid=self._solution['service_sid'],identity=self._solution['identity'], - ) - return self._context - - @property - def challenges(self): - return self._proxy.challenges - @property - def factors(self): - return self._proxy.factors - @property - def new_factors(self): - return self._proxy.new_factors - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class EntityListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/Entities' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return EntityInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return EntityPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/verify/v2/service/entity/__init__.py b/twilio/rest/verify/v2/service/entity/__init__.py index a687fe5f71..938bcf8f78 100644 --- a/twilio/rest/verify/v2/service/entity/__init__.py +++ b/twilio/rest/verify/v2/service/entity/__init__.py @@ -1,228 +1,48 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Verify + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.verify.v2.service.entity.challenge import ChallengeList -from twilio.rest.verify.v2.service.entity.factor import FactorList -from twilio.rest.verify.v2.service.entity.new_factor import NewFactorList - - -class EntityList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the EntityList - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - - :returns: twilio.rest.verify.v2.service.entity.EntityList - :rtype: twilio.rest.verify.v2.service.entity.EntityList - """ - super(EntityList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/Entities'.format(**self._solution) - - def create(self, identity): - """ - Create the EntityInstance - - :param unicode identity: Unique external identifier of the Entity - - :returns: The created EntityInstance - :rtype: twilio.rest.verify.v2.service.entity.EntityInstance - """ - data = values.of({'Identity': identity, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return EntityInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams EntityInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.verify.v2.service.entity.EntityInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists EntityInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.verify.v2.service.entity.EntityInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of EntityInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of EntityInstance - :rtype: twilio.rest.verify.v2.service.entity.EntityPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return EntityPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of EntityInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of EntityInstance - :rtype: twilio.rest.verify.v2.service.entity.EntityPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return EntityPage(self._version, response, self._solution) - - def get(self, identity): - """ - Constructs a EntityContext - - :param identity: Unique external identifier of the Entity - - :returns: twilio.rest.verify.v2.service.entity.EntityContext - :rtype: twilio.rest.verify.v2.service.entity.EntityContext - """ - return EntityContext(self._version, service_sid=self._solution['service_sid'], identity=identity, ) - - def __call__(self, identity): - """ - Constructs a EntityContext - - :param identity: Unique external identifier of the Entity +from twilio.base.version import Version - :returns: twilio.rest.verify.v2.service.entity.EntityContext - :rtype: twilio.rest.verify.v2.service.entity.EntityContext - """ - return EntityContext(self._version, service_sid=self._solution['service_sid'], identity=identity, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class EntityPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the EntityPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - - :returns: twilio.rest.verify.v2.service.entity.EntityPage - :rtype: twilio.rest.verify.v2.service.entity.EntityPage - """ - super(EntityPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of EntityInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.verify.v2.service.entity.EntityInstance - :rtype: twilio.rest.verify.v2.service.entity.EntityInstance - """ - return EntityInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.entity.challenge import ChallengeListInstancefrom twilio.rest.entity.factor import FactorListInstancefrom twilio.rest.entity.new_factor import NewFactorListInstance class EntityContext(InstanceContext): - - def __init__(self, version, service_sid, identity): - """ - Initialize the EntityContext - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param identity: Unique external identifier of the Entity - - :returns: twilio.rest.verify.v2.service.entity.EntityContext - :rtype: twilio.rest.verify.v2.service.entity.EntityContext - """ - super(EntityContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, identity: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'identity': identity, } - self._uri = '/Services/{service_sid}/Entities/{identity}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'identity': identity, } + self._uri = '/Services/${service_sid}/Entities/${identity}' + + self._challenges = None self._factors = None self._new_factors = None - self._challenges = None - + def delete(self): + + + """ Deletes the EntityInstance @@ -230,244 +50,123 @@ def delete(self): :rtype: bool """ return self._version.delete(method='DELETE', uri=self._uri, ) - + def fetch(self): + """ Fetch the EntityInstance :returns: The fetched EntityInstance - :rtype: twilio.rest.verify.v2.service.entity.EntityInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return EntityInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - ) - - @property - def factors(self): - """ - Access the factors - - :returns: twilio.rest.verify.v2.service.entity.factor.FactorList - :rtype: twilio.rest.verify.v2.service.entity.factor.FactorList - """ - if self._factors is None: - self._factors = FactorList( - self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - ) - return self._factors - - @property - def new_factors(self): - """ - Access the new_factors + return EntityInstance(self._version, payload, service_sid=self._solution['service_sid'], identity=self._solution['identity'], ) + - :returns: twilio.rest.verify.v2.service.entity.new_factor.NewFactorList - :rtype: twilio.rest.verify.v2.service.entity.new_factor.NewFactorList - """ - if self._new_factors is None: - self._new_factors = NewFactorList( - self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - ) - return self._new_factors - - @property - def challenges(self): - """ - Access the challenges - - :returns: twilio.rest.verify.v2.service.entity.challenge.ChallengeList - :rtype: twilio.rest.verify.v2.service.entity.challenge.ChallengeList - """ - if self._challenges is None: - self._challenges = ChallengeList( - self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - ) - return self._challenges + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class EntityInstance(InstanceResource): - def __init__(self, version, payload, service_sid, identity=None): - """ - Initialize the EntityInstance - :returns: twilio.rest.verify.v2.service.entity.EntityInstance - :rtype: twilio.rest.verify.v2.service.entity.EntityInstance - """ - super(EntityInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'identity': payload.get('identity'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class EntityInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, identity: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'identity' : payload.get('identity'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'identity': identity or self._properties['identity'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'identity': identity or self._properties['identity'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: EntityContext for this EntityInstance - :rtype: twilio.rest.verify.v2.service.entity.EntityContext - """ if self._context is None: self._context = EntityContext( self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], + service_sid=self._solution['service_sid'],identity=self._solution['identity'], ) return self._context @property - def sid(self): - """ - :returns: A string that uniquely identifies this Entity. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def identity(self): - """ - :returns: Unique external identifier of the Entity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def date_created(self): - """ - :returns: The date this Entity was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Entity was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: Nested resource URLs. - :rtype: unicode - """ - return self._properties['links'] - - def delete(self): - """ - Deletes the EntityInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def fetch(self): - """ - Fetch the EntityInstance - - :returns: The fetched EntityInstance - :rtype: twilio.rest.verify.v2.service.entity.EntityInstance - """ - return self._proxy.fetch() - + def challenges(self): + return self._proxy.challenges @property def factors(self): - """ - Access the factors - - :returns: twilio.rest.verify.v2.service.entity.factor.FactorList - :rtype: twilio.rest.verify.v2.service.entity.factor.FactorList - """ return self._proxy.factors - @property def new_factors(self): - """ - Access the new_factors - - :returns: twilio.rest.verify.v2.service.entity.new_factor.NewFactorList - :rtype: twilio.rest.verify.v2.service.entity.new_factor.NewFactorList - """ return self._proxy.new_factors + - @property - def challenges(self): + def __repr__(self): """ - Access the challenges - - :returns: twilio.rest.verify.v2.service.entity.challenge.ChallengeList - :rtype: twilio.rest.verify.v2.service.entity.challenge.ChallengeList + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.challenges + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) + + + +class EntityListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) + + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/Entities' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return EntityInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return EntityPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/verify/v2/service/entity/challenge.py b/twilio/rest/verify/v2/service/entity/challenge.py deleted file mode 100644 index a2967bdbd0..0000000000 --- a/twilio/rest/verify/v2/service/entity/challenge.py +++ /dev/null @@ -1,175 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Verify - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.challenge.notification import NotificationListInstance - - -class ChallengeContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, identity: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'identity': identity, 'sid': sid, } - self._uri = '/Services/${service_sid}/Entities/${identity}/Challenges/${sid}' - - self._notifications = None - - def fetch(self): - - """ - Fetch the ChallengeInstance - - :returns: The fetched ChallengeInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ChallengeInstance(self._version, payload, service_sid=self._solution['service_sid'], identity=self._solution['identity'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ChallengeInstance(self._version, payload, service_sid=self._solution['service_sid'], identity=self._solution['identity'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ChallengeInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, identity: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'account_sid' : payload.get('account_sid'), - 'service_sid' : payload.get('service_sid'), - 'entity_sid' : payload.get('entity_sid'), - 'identity' : payload.get('identity'), - 'factor_sid' : payload.get('factor_sid'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'date_responded' : payload.get('date_responded'), - 'expiration_date' : payload.get('expiration_date'), - 'status' : payload.get('status'), - 'responded_reason' : payload.get('responded_reason'), - 'details' : payload.get('details'), - 'hidden_details' : payload.get('hidden_details'), - 'metadata' : payload.get('metadata'), - 'factor_type' : payload.get('factor_type'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'identity': identity or self._properties['identity'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ChallengeContext( - self._version, - service_sid=self._solution['service_sid'],identity=self._solution['identity'],sid=self._solution['sid'], - ) - return self._context - - @property - def notifications(self): - return self._proxy.notifications - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ChallengeListInstance(ListResource): - def __init__(self, version: Version, service_sid: str, identity: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'identity': identity, } - self._uri = '/Services/${service_sid}/Entities/${identity}/Challenges' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ChallengeInstance(self._version, payload, service_sid=self._solution['service_sid']identity=self._solution['identity']) - - """ - - """ - def page(self, factor_sid, status, order, page_size): - - data = values.of({ - 'factor_sid': factor_sid,'status': status,'order': order,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ChallengePage(self._version, payload, service_sid=self._solution['service_sid'], identity=self._solution['identity'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/verify/v2/service/entity/challenge/__init__.py b/twilio/rest/verify/v2/service/entity/challenge/__init__.py index e1db86ed6e..a2967bdbd0 100644 --- a/twilio/rest/verify/v2/service/entity/challenge/__init__.py +++ b/twilio/rest/verify/v2/service/entity/challenge/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Verify + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,601 +19,157 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.verify.v2.service.entity.challenge.notification import NotificationList - - -class ChallengeList(ListResource): - - def __init__(self, version, service_sid, identity): - """ - Initialize the ChallengeList - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param identity: Unique external identifier of the Entity - - :returns: twilio.rest.verify.v2.service.entity.challenge.ChallengeList - :rtype: twilio.rest.verify.v2.service.entity.challenge.ChallengeList - """ - super(ChallengeList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, 'identity': identity, } - self._uri = '/Services/{service_sid}/Entities/{identity}/Challenges'.format(**self._solution) - - def create(self, factor_sid, expiration_date=values.unset, - details_message=values.unset, details_fields=values.unset, - hidden_details=values.unset, auth_payload=values.unset): - """ - Create the ChallengeInstance - - :param unicode factor_sid: Factor Sid. - :param datetime expiration_date: The date-time when this Challenge expires - :param unicode details_message: Shown to the user when the push notification arrives - :param list[dict] details_fields: A list of objects that describe the Fields included in the Challenge - :param dict hidden_details: Hidden details provided to contextualize the Challenge - :param unicode auth_payload: Optional payload to verify the Challenge - - :returns: The created ChallengeInstance - :rtype: twilio.rest.verify.v2.service.entity.challenge.ChallengeInstance - """ - data = values.of({ - 'FactorSid': factor_sid, - 'ExpirationDate': serialize.iso8601_datetime(expiration_date), - 'Details.Message': details_message, - 'Details.Fields': serialize.map(details_fields, lambda e: serialize.object(e)), - 'HiddenDetails': serialize.object(hidden_details), - 'AuthPayload': auth_payload, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ChallengeInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - ) - - def stream(self, factor_sid=values.unset, status=values.unset, - order=values.unset, limit=None, page_size=None): - """ - Streams ChallengeInstance 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 unicode factor_sid: Factor Sid. - :param ChallengeInstance.ChallengeStatuses status: The Status of theChallenges to fetch - :param ChallengeInstance.ListOrders order: The sort order of the Challenges list - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.verify.v2.service.entity.challenge.ChallengeInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(factor_sid=factor_sid, status=status, order=order, page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, factor_sid=values.unset, status=values.unset, order=values.unset, - limit=None, page_size=None): - """ - Lists ChallengeInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode factor_sid: Factor Sid. - :param ChallengeInstance.ChallengeStatuses status: The Status of theChallenges to fetch - :param ChallengeInstance.ListOrders order: The sort order of the Challenges list - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.verify.v2.service.entity.challenge.ChallengeInstance] - """ - return list(self.stream( - factor_sid=factor_sid, - status=status, - order=order, - limit=limit, - page_size=page_size, - )) - - def page(self, factor_sid=values.unset, status=values.unset, order=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ChallengeInstance records from the API. - Request is executed immediately - - :param unicode factor_sid: Factor Sid. - :param ChallengeInstance.ChallengeStatuses status: The Status of theChallenges to fetch - :param ChallengeInstance.ListOrders order: The sort order of the Challenges list - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ChallengeInstance - :rtype: twilio.rest.verify.v2.service.entity.challenge.ChallengePage - """ - data = values.of({ - 'FactorSid': factor_sid, - 'Status': status, - 'Order': order, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ChallengePage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ChallengeInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ChallengeInstance - :rtype: twilio.rest.verify.v2.service.entity.challenge.ChallengePage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ChallengePage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ChallengeContext - - :param sid: A string that uniquely identifies this Challenge. - - :returns: twilio.rest.verify.v2.service.entity.challenge.ChallengeContext - :rtype: twilio.rest.verify.v2.service.entity.challenge.ChallengeContext - """ - return ChallengeContext( - self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a ChallengeContext - - :param sid: A string that uniquely identifies this Challenge. - - :returns: twilio.rest.verify.v2.service.entity.challenge.ChallengeContext - :rtype: twilio.rest.verify.v2.service.entity.challenge.ChallengeContext - """ - return ChallengeContext( - self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - sid=sid, - ) +from twilio.base.version import Version - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ChallengePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ChallengePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: Service Sid. - :param identity: Unique external identifier of the Entity - - :returns: twilio.rest.verify.v2.service.entity.challenge.ChallengePage - :rtype: twilio.rest.verify.v2.service.entity.challenge.ChallengePage - """ - super(ChallengePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ChallengeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.verify.v2.service.entity.challenge.ChallengeInstance - :rtype: twilio.rest.verify.v2.service.entity.challenge.ChallengeInstance - """ - return ChallengeInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.challenge.notification import NotificationListInstance class ChallengeContext(InstanceContext): - - def __init__(self, version, service_sid, identity, sid): - """ - Initialize the ChallengeContext - - :param Version version: Version that contains the resource - :param service_sid: Service Sid. - :param identity: Unique external identifier of the Entity - :param sid: A string that uniquely identifies this Challenge. - - :returns: twilio.rest.verify.v2.service.entity.challenge.ChallengeContext - :rtype: twilio.rest.verify.v2.service.entity.challenge.ChallengeContext - """ - super(ChallengeContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, identity: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'identity': identity, 'sid': sid, } - self._uri = '/Services/{service_sid}/Entities/{identity}/Challenges/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'identity': identity, 'sid': sid, } + self._uri = '/Services/${service_sid}/Entities/${identity}/Challenges/${sid}' + self._notifications = None - + def fetch(self): + """ Fetch the ChallengeInstance :returns: The fetched ChallengeInstance - :rtype: twilio.rest.verify.v2.service.entity.challenge.ChallengeInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return ChallengeInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - sid=self._solution['sid'], - ) - - def update(self, auth_payload=values.unset, metadata=values.unset): - """ - Update the ChallengeInstance - - :param unicode auth_payload: Optional payload to verify the Challenge - :param dict metadata: Metadata of the challenge. + return ChallengeInstance(self._version, payload, service_sid=self._solution['service_sid'], identity=self._solution['identity'], sid=self._solution['sid'], ) + - :returns: The updated ChallengeInstance - :rtype: twilio.rest.verify.v2.service.entity.challenge.ChallengeInstance - """ - data = values.of({'AuthPayload': auth_payload, 'Metadata': serialize.object(metadata), }) + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - return ChallengeInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - sid=self._solution['sid'], - ) + return ChallengeInstance(self._version, payload, service_sid=self._solution['service_sid'], identity=self._solution['identity'], sid=self._solution['sid'], ) + + - @property - def notifications(self): - """ - Access the notifications - - :returns: twilio.rest.verify.v2.service.entity.challenge.notification.NotificationList - :rtype: twilio.rest.verify.v2.service.entity.challenge.notification.NotificationList - """ - if self._notifications is None: - self._notifications = NotificationList( - self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - challenge_sid=self._solution['sid'], - ) - return self._notifications + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class ChallengeInstance(InstanceResource): - - class ChallengeStatuses(object): - PENDING = "pending" - EXPIRED = "expired" - APPROVED = "approved" - DENIED = "denied" - - class ChallengeReasons(object): - NONE = "none" - NOT_NEEDED = "not_needed" - NOT_REQUESTED = "not_requested" - - class FactorTypes(object): - PUSH = "push" - TOTP = "totp" - class ListOrders(object): - ASC = "asc" - DESC = "desc" - def __init__(self, version, payload, service_sid, identity, sid=None): - """ - Initialize the ChallengeInstance - - :returns: twilio.rest.verify.v2.service.entity.challenge.ChallengeInstance - :rtype: twilio.rest.verify.v2.service.entity.challenge.ChallengeInstance - """ - super(ChallengeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'entity_sid': payload.get('entity_sid'), - 'identity': payload.get('identity'), - 'factor_sid': payload.get('factor_sid'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'date_responded': deserialize.iso8601_datetime(payload.get('date_responded')), - 'expiration_date': deserialize.iso8601_datetime(payload.get('expiration_date')), - 'status': payload.get('status'), - 'responded_reason': payload.get('responded_reason'), - 'details': payload.get('details'), - 'hidden_details': payload.get('hidden_details'), - 'metadata': payload.get('metadata'), - 'factor_type': payload.get('factor_type'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ChallengeInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, identity: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'account_sid' : payload.get('account_sid'), + 'service_sid' : payload.get('service_sid'), + 'entity_sid' : payload.get('entity_sid'), + 'identity' : payload.get('identity'), + 'factor_sid' : payload.get('factor_sid'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'date_responded' : payload.get('date_responded'), + 'expiration_date' : payload.get('expiration_date'), + 'status' : payload.get('status'), + 'responded_reason' : payload.get('responded_reason'), + 'details' : payload.get('details'), + 'hidden_details' : payload.get('hidden_details'), + 'metadata' : payload.get('metadata'), + 'factor_type' : payload.get('factor_type'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None self._solution = { - 'service_sid': service_sid, - 'identity': identity, - 'sid': sid or self._properties['sid'], + 'service_sid': service_sid or self._properties['service_sid'],'identity': identity or self._properties['identity'],'sid': sid or self._properties['sid'], } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ChallengeContext for this ChallengeInstance - :rtype: twilio.rest.verify.v2.service.entity.challenge.ChallengeContext - """ if self._context is None: self._context = ChallengeContext( self._version, - service_sid=self._solution['service_sid'], - identity=self._solution['identity'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],identity=self._solution['identity'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: A string that uniquely identifies this Challenge. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def account_sid(self): - """ - :returns: Account Sid. - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def service_sid(self): - """ - :returns: Service Sid. - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def entity_sid(self): - """ - :returns: Entity Sid. - :rtype: unicode - """ - return self._properties['entity_sid'] - - @property - def identity(self): - """ - :returns: Unique external identifier of the Entity - :rtype: unicode - """ - return self._properties['identity'] - - @property - def factor_sid(self): - """ - :returns: Factor Sid. - :rtype: unicode - """ - return self._properties['factor_sid'] - - @property - def date_created(self): - """ - :returns: The date this Challenge was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The date this Challenge was updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def date_responded(self): - """ - :returns: The date this Challenge was responded - :rtype: datetime - """ - return self._properties['date_responded'] - - @property - def expiration_date(self): - """ - :returns: The date-time when this Challenge expires - :rtype: datetime - """ - return self._properties['expiration_date'] - - @property - def status(self): - """ - :returns: The Status of this Challenge - :rtype: ChallengeInstance.ChallengeStatuses - """ - return self._properties['status'] - - @property - def responded_reason(self): - """ - :returns: The Reason of this Challenge `status` - :rtype: ChallengeInstance.ChallengeReasons - """ - return self._properties['responded_reason'] - - @property - def details(self): - """ - :returns: Details about the Challenge. - :rtype: dict - """ - return self._properties['details'] - - @property - def hidden_details(self): - """ - :returns: Hidden details about the Challenge - :rtype: dict - """ - return self._properties['hidden_details'] - - @property - def metadata(self): - """ - :returns: Metadata of the challenge. - :rtype: dict - """ - return self._properties['metadata'] - - @property - def factor_type(self): - """ - :returns: The Factor Type of this Challenge - :rtype: ChallengeInstance.FactorTypes - """ - return self._properties['factor_type'] + def notifications(self): + return self._proxy.notifications + - @property - def url(self): + def __repr__(self): """ - :returns: The URL of this resource. - :rtype: unicode + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['url'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def links(self): - """ - :returns: Nested resource URLs. - :rtype: unicode - """ - return self._properties['links'] - def fetch(self): - """ - Fetch the ChallengeInstance - :returns: The fetched ChallengeInstance - :rtype: twilio.rest.verify.v2.service.entity.challenge.ChallengeInstance - """ - return self._proxy.fetch() +class ChallengeListInstance(ListResource): + def __init__(self, version: Version, service_sid: str, identity: str): + # TODO: needs autogenerated docs + super().__init__(version) - def update(self, auth_payload=values.unset, metadata=values.unset): - """ - Update the ChallengeInstance + # Path Solution + self._solution = { 'service_sid': service_sid, 'identity': identity, } + self._uri = '/Services/${service_sid}/Entities/${identity}/Challenges' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - :param unicode auth_payload: Optional payload to verify the Challenge - :param dict metadata: Metadata of the challenge. + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: The updated ChallengeInstance - :rtype: twilio.rest.verify.v2.service.entity.challenge.ChallengeInstance - """ - return self._proxy.update(auth_payload=auth_payload, metadata=metadata, ) + return ChallengeInstance(self._version, payload, service_sid=self._solution['service_sid']identity=self._solution['identity']) + + """ + + """ + def page(self, factor_sid, status, order, page_size): + + data = values.of({ + 'factor_sid': factor_sid,'status': status,'order': order,'page_size': page_size, + }) - @property - def notifications(self): - """ - Access the notifications + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.verify.v2.service.entity.challenge.notification.NotificationList - :rtype: twilio.rest.verify.v2.service.entity.challenge.notification.NotificationList - """ - return self._proxy.notifications + return ChallengePage(self._version, payload, service_sid=self._solution['service_sid'], identity=self._solution['identity'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/verify/v2/service/rate_limit.py b/twilio/rest/verify/v2/service/rate_limit.py deleted file mode 100644 index 804774824c..0000000000 --- a/twilio/rest/verify/v2/service/rate_limit.py +++ /dev/null @@ -1,178 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Verify - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.rate_limit.bucket import BucketListInstance - - -class RateLimitContext(InstanceContext): - def __init__(self, version: Version, service_sid: str, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/${service_sid}/RateLimits/${sid}' - - self._buckets = None - - def delete(self): - - - - """ - Deletes the RateLimitInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the RateLimitInstance - - :returns: The fetched RateLimitInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return RateLimitInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return RateLimitInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class RateLimitInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'service_sid' : payload.get('service_sid'), - 'account_sid' : payload.get('account_sid'), - 'unique_name' : payload.get('unique_name'), - 'description' : payload.get('description'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = RateLimitContext( - self._version, - service_sid=self._solution['service_sid'],sid=self._solution['sid'], - ) - return self._context - - @property - def buckets(self): - return self._proxy.buckets - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class RateLimitListInstance(ListResource): - def __init__(self, version: Version, service_sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'service_sid': service_sid, } - self._uri = '/Services/${service_sid}/RateLimits' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return RateLimitInstance(self._version, payload, service_sid=self._solution['service_sid']) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return RateLimitPage(self._version, payload, service_sid=self._solution['service_sid'], ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/verify/v2/service/rate_limit/__init__.py b/twilio/rest/verify/v2/service/rate_limit/__init__.py index 17213dba49..804774824c 100644 --- a/twilio/rest/verify/v2/service/rate_limit/__init__.py +++ b/twilio/rest/verify/v2/service/rate_limit/__init__.py @@ -1,458 +1,178 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Verify + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.verify.v2.service.rate_limit.bucket import BucketList - - -class RateLimitList(ListResource): - - def __init__(self, version, service_sid): - """ - Initialize the RateLimitList - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.verify.v2.service.rate_limit.RateLimitList - :rtype: twilio.rest.verify.v2.service.rate_limit.RateLimitList - """ - super(RateLimitList, self).__init__(version) - - # Path Solution - self._solution = {'service_sid': service_sid, } - self._uri = '/Services/{service_sid}/RateLimits'.format(**self._solution) - - def create(self, unique_name, description=values.unset): - """ - Create the RateLimitInstance - - :param unicode unique_name: A unique, developer assigned name of this Rate Limit. - :param unicode description: Description of this Rate Limit - - :returns: The created RateLimitInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.RateLimitInstance - """ - data = values.of({'UniqueName': unique_name, 'Description': description, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return RateLimitInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def stream(self, limit=None, page_size=None): - """ - Streams RateLimitInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.verify.v2.service.rate_limit.RateLimitInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists RateLimitInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.verify.v2.service.rate_limit.RateLimitInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RateLimitInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RateLimitInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.RateLimitPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return RateLimitPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RateLimitInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RateLimitInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.RateLimitPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RateLimitPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RateLimitContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.verify.v2.service.rate_limit.RateLimitContext - :rtype: twilio.rest.verify.v2.service.rate_limit.RateLimitContext - """ - return RateLimitContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) +from twilio.base.version import Version - def __call__(self, sid): - """ - Constructs a RateLimitContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.verify.v2.service.rate_limit.RateLimitContext - :rtype: twilio.rest.verify.v2.service.rate_limit.RateLimitContext - """ - return RateLimitContext(self._version, service_sid=self._solution['service_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RateLimitPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the RateLimitPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param service_sid: The SID of the Service that the resource is associated with - - :returns: twilio.rest.verify.v2.service.rate_limit.RateLimitPage - :rtype: twilio.rest.verify.v2.service.rate_limit.RateLimitPage - """ - super(RateLimitPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RateLimitInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.verify.v2.service.rate_limit.RateLimitInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.RateLimitInstance - """ - return RateLimitInstance(self._version, payload, service_sid=self._solution['service_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.rate_limit.bucket import BucketListInstance class RateLimitContext(InstanceContext): - - def __init__(self, version, service_sid, sid): - """ - Initialize the RateLimitContext - - :param Version version: Version that contains the resource - :param service_sid: The SID of the Service that the resource is associated with - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.verify.v2.service.rate_limit.RateLimitContext - :rtype: twilio.rest.verify.v2.service.rate_limit.RateLimitContext - """ - super(RateLimitContext, self).__init__(version) + def __init__(self, version: Version, service_sid: str, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'service_sid': service_sid, 'sid': sid, } - self._uri = '/Services/{service_sid}/RateLimits/{sid}'.format(**self._solution) - - # Dependents + self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._uri = '/Services/${service_sid}/RateLimits/${sid}' + self._buckets = None + + def delete(self): + + - def update(self, description=values.unset): """ - Update the RateLimitInstance - - :param unicode description: Description of this Rate Limit + Deletes the RateLimitInstance - :returns: The updated RateLimitInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.RateLimitInstance + :returns: True if delete succeeds, False otherwise + :rtype: bool """ - data = values.of({'Description': description, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return RateLimitInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the RateLimitInstance :returns: The fetched RateLimitInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.RateLimitInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) - return RateLimitInstance( - self._version, - payload, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], - ) + return RateLimitInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + - def delete(self): - """ - Deletes the RateLimitInstance + + + def update(self, body): + data = values.of({ + 'body': body, + }) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) - @property - def buckets(self): - """ - Access the buckets + return RateLimitInstance(self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], ) + + - :returns: twilio.rest.verify.v2.service.rate_limit.bucket.BucketList - :rtype: twilio.rest.verify.v2.service.rate_limit.bucket.BucketList - """ - if self._buckets is None: - self._buckets = BucketList( - self._version, - service_sid=self._solution['service_sid'], - rate_limit_sid=self._solution['sid'], - ) - return self._buckets + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class RateLimitInstance(InstanceResource): - - def __init__(self, version, payload, service_sid, sid=None): - """ - Initialize the RateLimitInstance - :returns: twilio.rest.verify.v2.service.rate_limit.RateLimitInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.RateLimitInstance - """ - super(RateLimitInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'service_sid': payload.get('service_sid'), - 'account_sid': payload.get('account_sid'), - 'unique_name': payload.get('unique_name'), - 'description': payload.get('description'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class RateLimitInstance(InstanceResource): + def __init__(self, version, payload, service_sid: str, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'service_sid' : payload.get('service_sid'), + 'account_sid' : payload.get('account_sid'), + 'unique_name' : payload.get('unique_name'), + 'description' : payload.get('description'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + self._solution = { + 'service_sid': service_sid or self._properties['service_sid'],'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RateLimitContext for this RateLimitInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.RateLimitContext - """ if self._context is None: self._context = RateLimitContext( self._version, - service_sid=self._solution['service_sid'], - sid=self._solution['sid'], + service_sid=self._solution['service_sid'],sid=self._solution['sid'], ) return self._context @property - def sid(self): - """ - :returns: A string that uniquely identifies this Rate Limit. - :rtype: unicode - """ - return self._properties['sid'] - - @property - def service_sid(self): - """ - :returns: The SID of the Service that the resource is associated with - :rtype: unicode - """ - return self._properties['service_sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def unique_name(self): - """ - :returns: A unique, developer assigned name of this Rate Limit. - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def description(self): - """ - :returns: Description of this Rate Limit - :rtype: unicode - """ - return self._properties['description'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The URL of this resource. - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - - def update(self, description=values.unset): - """ - Update the RateLimitInstance - - :param unicode description: Description of this Rate Limit - - :returns: The updated RateLimitInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.RateLimitInstance - """ - return self._proxy.update(description=description, ) + def buckets(self): + return self._proxy.buckets + - def fetch(self): + def __repr__(self): """ - Fetch the RateLimitInstance - - :returns: The fetched RateLimitInstance - :rtype: twilio.rest.verify.v2.service.rate_limit.RateLimitInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.fetch() + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the RateLimitInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - @property - def buckets(self): - """ - Access the buckets +class RateLimitListInstance(ListResource): + def __init__(self, version: Version, service_sid: str): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.verify.v2.service.rate_limit.bucket.BucketList - :rtype: twilio.rest.verify.v2.service.rate_limit.bucket.BucketList - """ - return self._proxy.buckets + # Path Solution + self._solution = { 'service_sid': service_sid, } + self._uri = '/Services/${service_sid}/RateLimits' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) + + return RateLimitInstance(self._version, payload, service_sid=self._solution['service_sid']) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return RateLimitPage(self._version, payload, service_sid=self._solution['service_sid'], ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/video/v1/composition/__init__.py b/twilio/rest/video/v1/composition/__init__.py deleted file mode 100644 index 564e0fa4a2..0000000000 --- a/twilio/rest/video/v1/composition/__init__.py +++ /dev/null @@ -1,565 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class CompositionList(ListResource): - - def __init__(self, version): - """ - Initialize the CompositionList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.video.v1.composition.CompositionList - :rtype: twilio.rest.video.v1.composition.CompositionList - """ - super(CompositionList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Compositions'.format(**self._solution) - - def stream(self, status=values.unset, date_created_after=values.unset, - date_created_before=values.unset, room_sid=values.unset, limit=None, - page_size=None): - """ - Streams CompositionInstance 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 CompositionInstance.Status status: Read only Composition resources with this status - :param datetime date_created_after: Read only Composition resources created on or after this `ISO 8601 `_ date-time with time zone - :param datetime date_created_before: Read only Composition resources created before this ISO 8601 date-time with time zone - :param unicode room_sid: Read only Composition resources with this Room SID - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.video.v1.composition.CompositionInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - date_created_after=date_created_after, - date_created_before=date_created_before, - room_sid=room_sid, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, status=values.unset, date_created_after=values.unset, - date_created_before=values.unset, room_sid=values.unset, limit=None, - page_size=None): - """ - Lists CompositionInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param CompositionInstance.Status status: Read only Composition resources with this status - :param datetime date_created_after: Read only Composition resources created on or after this `ISO 8601 `_ date-time with time zone - :param datetime date_created_before: Read only Composition resources created before this ISO 8601 date-time with time zone - :param unicode room_sid: Read only Composition resources with this Room SID - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.composition.CompositionInstance] - """ - return list(self.stream( - status=status, - date_created_after=date_created_after, - date_created_before=date_created_before, - room_sid=room_sid, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, date_created_after=values.unset, - date_created_before=values.unset, room_sid=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CompositionInstance records from the API. - Request is executed immediately - - :param CompositionInstance.Status status: Read only Composition resources with this status - :param datetime date_created_after: Read only Composition resources created on or after this `ISO 8601 `_ date-time with time zone - :param datetime date_created_before: Read only Composition resources created before this ISO 8601 date-time with time zone - :param unicode room_sid: Read only Composition resources with this Room SID - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CompositionInstance - :rtype: twilio.rest.video.v1.composition.CompositionPage - """ - data = values.of({ - 'Status': status, - 'DateCreatedAfter': serialize.iso8601_datetime(date_created_after), - 'DateCreatedBefore': serialize.iso8601_datetime(date_created_before), - 'RoomSid': room_sid, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CompositionPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CompositionInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CompositionInstance - :rtype: twilio.rest.video.v1.composition.CompositionPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CompositionPage(self._version, response, self._solution) - - def create(self, room_sid, video_layout=values.unset, - audio_sources=values.unset, audio_sources_excluded=values.unset, - resolution=values.unset, format=values.unset, - status_callback=values.unset, status_callback_method=values.unset, - trim=values.unset): - """ - Create the CompositionInstance - - :param unicode room_sid: The SID of the Group Room with the media tracks to be used as composition sources - :param dict video_layout: An object that describes the video layout of the composition - :param list[unicode] audio_sources: An array of track names from the same group room to merge - :param list[unicode] audio_sources_excluded: An array of track names to exclude - :param unicode resolution: A string that describes the columns (width) and rows (height) of the generated composed video in pixels - :param CompositionInstance.Format format: The container format of the composition's media files - :param unicode status_callback: The URL we should call to send status information to your application - :param unicode status_callback_method: The HTTP method we should use to call status_callback - :param bool trim: Whether to clip the intervals where there is no active media in the composition - - :returns: The created CompositionInstance - :rtype: twilio.rest.video.v1.composition.CompositionInstance - """ - data = values.of({ - 'RoomSid': room_sid, - 'VideoLayout': serialize.object(video_layout), - 'AudioSources': serialize.map(audio_sources, lambda e: e), - 'AudioSourcesExcluded': serialize.map(audio_sources_excluded, lambda e: e), - 'Resolution': resolution, - 'Format': format, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'Trim': trim, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return CompositionInstance(self._version, payload, ) - - def get(self, sid): - """ - Constructs a CompositionContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.composition.CompositionContext - :rtype: twilio.rest.video.v1.composition.CompositionContext - """ - return CompositionContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a CompositionContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.composition.CompositionContext - :rtype: twilio.rest.video.v1.composition.CompositionContext - """ - return CompositionContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CompositionPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the CompositionPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.video.v1.composition.CompositionPage - :rtype: twilio.rest.video.v1.composition.CompositionPage - """ - super(CompositionPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CompositionInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.video.v1.composition.CompositionInstance - :rtype: twilio.rest.video.v1.composition.CompositionInstance - """ - return CompositionInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CompositionContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the CompositionContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.composition.CompositionContext - :rtype: twilio.rest.video.v1.composition.CompositionContext - """ - super(CompositionContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Compositions/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the CompositionInstance - - :returns: The fetched CompositionInstance - :rtype: twilio.rest.video.v1.composition.CompositionInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CompositionInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the CompositionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class CompositionInstance(InstanceResource): - - class Status(object): - ENQUEUED = "enqueued" - PROCESSING = "processing" - COMPLETED = "completed" - DELETED = "deleted" - FAILED = "failed" - - class Format(object): - MP4 = "mp4" - WEBM = "webm" - - def __init__(self, version, payload, sid=None): - """ - Initialize the CompositionInstance - - :returns: twilio.rest.video.v1.composition.CompositionInstance - :rtype: twilio.rest.video.v1.composition.CompositionInstance - """ - super(CompositionInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'status': payload.get('status'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_completed': deserialize.iso8601_datetime(payload.get('date_completed')), - 'date_deleted': deserialize.iso8601_datetime(payload.get('date_deleted')), - 'sid': payload.get('sid'), - 'room_sid': payload.get('room_sid'), - 'audio_sources': payload.get('audio_sources'), - 'audio_sources_excluded': payload.get('audio_sources_excluded'), - 'video_layout': payload.get('video_layout'), - 'resolution': payload.get('resolution'), - 'trim': payload.get('trim'), - 'format': payload.get('format'), - 'bitrate': deserialize.integer(payload.get('bitrate')), - 'size': deserialize.integer(payload.get('size')), - 'duration': deserialize.integer(payload.get('duration')), - 'media_external_location': payload.get('media_external_location'), - 'status_callback': payload.get('status_callback'), - 'status_callback_method': payload.get('status_callback_method'), - 'url': payload.get('url'), - 'links': payload.get('links'), - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CompositionContext for this CompositionInstance - :rtype: twilio.rest.video.v1.composition.CompositionContext - """ - if self._context is None: - self._context = CompositionContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def status(self): - """ - :returns: The status of the composition - :rtype: CompositionInstance.Status - """ - return self._properties['status'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_completed(self): - """ - :returns: Date when the media processing task finished - :rtype: datetime - """ - return self._properties['date_completed'] - - @property - def date_deleted(self): - """ - :returns: The ISO 8601 date and time in GMT when the composition generated media was deleted - :rtype: datetime - """ - return self._properties['date_deleted'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def room_sid(self): - """ - :returns: The SID of the Group Room that generated the audio and video tracks used in the composition - :rtype: unicode - """ - return self._properties['room_sid'] - - @property - def audio_sources(self): - """ - :returns: The array of track names to include in the composition - :rtype: list[unicode] - """ - return self._properties['audio_sources'] - - @property - def audio_sources_excluded(self): - """ - :returns: The array of track names to exclude from the composition - :rtype: list[unicode] - """ - return self._properties['audio_sources_excluded'] - - @property - def video_layout(self): - """ - :returns: An object that describes the video layout of the composition - :rtype: dict - """ - return self._properties['video_layout'] - - @property - def resolution(self): - """ - :returns: The dimensions of the video image in pixels expressed as columns (width) and rows (height) - :rtype: unicode - """ - return self._properties['resolution'] - - @property - def trim(self): - """ - :returns: Whether to remove intervals with no media - :rtype: bool - """ - return self._properties['trim'] - - @property - def format(self): - """ - :returns: The container format of the composition's media files as specified in the POST request that created the Composition resource - :rtype: CompositionInstance.Format - """ - return self._properties['format'] - - @property - def bitrate(self): - """ - :returns: The average bit rate of the composition's media - :rtype: unicode - """ - return self._properties['bitrate'] - - @property - def size(self): - """ - :returns: The size of the composed media file in bytes - :rtype: unicode - """ - return self._properties['size'] - - @property - def duration(self): - """ - :returns: The duration of the composition's media file in seconds - :rtype: unicode - """ - return self._properties['duration'] - - @property - def media_external_location(self): - """ - :returns: The URL of the media file associated with the composition when stored externally - :rtype: unicode - """ - return self._properties['media_external_location'] - - @property - def status_callback(self): - """ - :returns: The URL called to send status information on every composition event. - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: The HTTP method used to call `status_callback` - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The URL of the media file associated with the composition - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the CompositionInstance - - :returns: The fetched CompositionInstance - :rtype: twilio.rest.video.v1.composition.CompositionInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the CompositionInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) diff --git a/twilio/rest/video/v1/recording/__init__.py b/twilio/rest/video/v1/recording/__init__.py deleted file mode 100644 index 8410f123b1..0000000000 --- a/twilio/rest/video/v1/recording/__init__.py +++ /dev/null @@ -1,526 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class RecordingList(ListResource): - - def __init__(self, version): - """ - Initialize the RecordingList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.video.v1.recording.RecordingList - :rtype: twilio.rest.video.v1.recording.RecordingList - """ - super(RecordingList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Recordings'.format(**self._solution) - - def stream(self, status=values.unset, source_sid=values.unset, - grouping_sid=values.unset, date_created_after=values.unset, - date_created_before=values.unset, media_type=values.unset, - limit=None, page_size=None): - """ - Streams RecordingInstance 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 RecordingInstance.Status status: Read only the recordings that have this status - :param unicode source_sid: Read only the recordings that have this source_sid - :param list[unicode] grouping_sid: Read only recordings that have this grouping_sid - :param datetime date_created_after: Read only recordings that started on or after this `ISO 8601 `_ date-time with time zone - :param datetime date_created_before: Read only recordings that started before this `ISO 8601 `_ date-time with time zone - :param RecordingInstance.Type media_type: Read only recordings that have this media type - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.video.v1.recording.RecordingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - source_sid=source_sid, - grouping_sid=grouping_sid, - date_created_after=date_created_after, - date_created_before=date_created_before, - media_type=media_type, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, status=values.unset, source_sid=values.unset, - grouping_sid=values.unset, date_created_after=values.unset, - date_created_before=values.unset, media_type=values.unset, limit=None, - page_size=None): - """ - Lists RecordingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param RecordingInstance.Status status: Read only the recordings that have this status - :param unicode source_sid: Read only the recordings that have this source_sid - :param list[unicode] grouping_sid: Read only recordings that have this grouping_sid - :param datetime date_created_after: Read only recordings that started on or after this `ISO 8601 `_ date-time with time zone - :param datetime date_created_before: Read only recordings that started before this `ISO 8601 `_ date-time with time zone - :param RecordingInstance.Type media_type: Read only recordings that have this media type - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.recording.RecordingInstance] - """ - return list(self.stream( - status=status, - source_sid=source_sid, - grouping_sid=grouping_sid, - date_created_after=date_created_after, - date_created_before=date_created_before, - media_type=media_type, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, source_sid=values.unset, - grouping_sid=values.unset, date_created_after=values.unset, - date_created_before=values.unset, media_type=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RecordingInstance records from the API. - Request is executed immediately - - :param RecordingInstance.Status status: Read only the recordings that have this status - :param unicode source_sid: Read only the recordings that have this source_sid - :param list[unicode] grouping_sid: Read only recordings that have this grouping_sid - :param datetime date_created_after: Read only recordings that started on or after this `ISO 8601 `_ date-time with time zone - :param datetime date_created_before: Read only recordings that started before this `ISO 8601 `_ date-time with time zone - :param RecordingInstance.Type media_type: Read only recordings that have this media type - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RecordingInstance - :rtype: twilio.rest.video.v1.recording.RecordingPage - """ - data = values.of({ - 'Status': status, - 'SourceSid': source_sid, - 'GroupingSid': serialize.map(grouping_sid, lambda e: e), - 'DateCreatedAfter': serialize.iso8601_datetime(date_created_after), - 'DateCreatedBefore': serialize.iso8601_datetime(date_created_before), - 'MediaType': media_type, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return RecordingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RecordingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RecordingInstance - :rtype: twilio.rest.video.v1.recording.RecordingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RecordingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RecordingContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.recording.RecordingContext - :rtype: twilio.rest.video.v1.recording.RecordingContext - """ - return RecordingContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RecordingContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.recording.RecordingContext - :rtype: twilio.rest.video.v1.recording.RecordingContext - """ - return RecordingContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RecordingPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the RecordingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.video.v1.recording.RecordingPage - :rtype: twilio.rest.video.v1.recording.RecordingPage - """ - super(RecordingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RecordingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.video.v1.recording.RecordingInstance - :rtype: twilio.rest.video.v1.recording.RecordingInstance - """ - return RecordingInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RecordingContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the RecordingContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.recording.RecordingContext - :rtype: twilio.rest.video.v1.recording.RecordingContext - """ - super(RecordingContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Recordings/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the RecordingInstance - - :returns: The fetched RecordingInstance - :rtype: twilio.rest.video.v1.recording.RecordingInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return RecordingInstance(self._version, payload, sid=self._solution['sid'], ) - - def delete(self): - """ - Deletes the RecordingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class RecordingInstance(InstanceResource): - - class Status(object): - PROCESSING = "processing" - COMPLETED = "completed" - DELETED = "deleted" - FAILED = "failed" - - class Type(object): - AUDIO = "audio" - VIDEO = "video" - DATA = "data" - - class Format(object): - MKA = "mka" - MKV = "mkv" - - class Codec(object): - VP8 = "VP8" - H264 = "H264" - OPUS = "OPUS" - PCMU = "PCMU" - - def __init__(self, version, payload, sid=None): - """ - Initialize the RecordingInstance - - :returns: twilio.rest.video.v1.recording.RecordingInstance - :rtype: twilio.rest.video.v1.recording.RecordingInstance - """ - super(RecordingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'status': payload.get('status'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'sid': payload.get('sid'), - 'source_sid': payload.get('source_sid'), - 'size': deserialize.integer(payload.get('size')), - 'url': payload.get('url'), - 'type': payload.get('type'), - 'duration': deserialize.integer(payload.get('duration')), - 'container_format': payload.get('container_format'), - 'codec': payload.get('codec'), - 'grouping_sids': payload.get('grouping_sids'), - 'track_name': payload.get('track_name'), - 'offset': deserialize.integer(payload.get('offset')), - 'media_external_location': payload.get('media_external_location'), - 'status_callback': payload.get('status_callback'), - 'status_callback_method': payload.get('status_callback_method'), - 'links': payload.get('links'), - } - - # Context - self._context = None - self._solution = {'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RecordingContext for this RecordingInstance - :rtype: twilio.rest.video.v1.recording.RecordingContext - """ - if self._context is None: - self._context = RecordingContext(self._version, sid=self._solution['sid'], ) - return self._context - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def status(self): - """ - :returns: The status of the recording - :rtype: RecordingInstance.Status - """ - return self._properties['status'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def source_sid(self): - """ - :returns: The SID of the recording source - :rtype: unicode - """ - return self._properties['source_sid'] - - @property - def size(self): - """ - :returns: The size of the recorded track, in bytes - :rtype: unicode - """ - return self._properties['size'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def type(self): - """ - :returns: The recording's media type - :rtype: RecordingInstance.Type - """ - return self._properties['type'] - - @property - def duration(self): - """ - :returns: The duration of the recording in seconds - :rtype: unicode - """ - return self._properties['duration'] - - @property - def container_format(self): - """ - :returns: The file format for the recording - :rtype: RecordingInstance.Format - """ - return self._properties['container_format'] - - @property - def codec(self): - """ - :returns: The codec used to encode the track - :rtype: RecordingInstance.Codec - """ - return self._properties['codec'] - - @property - def grouping_sids(self): - """ - :returns: A list of SIDs related to the recording - :rtype: dict - """ - return self._properties['grouping_sids'] - - @property - def track_name(self): - """ - :returns: The name that was given to the source track of the recording - :rtype: unicode - """ - return self._properties['track_name'] - - @property - def offset(self): - """ - :returns: The number of milliseconds between a point in time that is common to all rooms in a group and when the source room of the recording started - :rtype: unicode - """ - return self._properties['offset'] - - @property - def media_external_location(self): - """ - :returns: The URL of the media file associated with the recording when stored externally - :rtype: unicode - """ - return self._properties['media_external_location'] - - @property - def status_callback(self): - """ - :returns: The URL called to send status information on every recording event. - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: The HTTP method used to call `status_callback` - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the RecordingInstance - - :returns: The fetched RecordingInstance - :rtype: twilio.rest.video.v1.recording.RecordingInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the RecordingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) diff --git a/twilio/rest/video/v1/room.py b/twilio/rest/video/v1/room.py deleted file mode 100644 index 68da90f871..0000000000 --- a/twilio/rest/video/v1/room.py +++ /dev/null @@ -1,189 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Video - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.room.participant import ParticipantListInstancefrom twilio.rest.room.recording_rules import RecordingRulesListInstancefrom twilio.rest.room.room_recording import RoomRecordingListInstance - - -class RoomContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Rooms/${sid}' - - self._participants = None - self._recording_rules = None - self._recordings = None - - def fetch(self): - - """ - Fetch the RoomInstance - - :returns: The fetched RoomInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return RoomInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return RoomInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class RoomInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'status' : payload.get('status'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'account_sid' : payload.get('account_sid'), - 'enable_turn' : payload.get('enable_turn'), - 'unique_name' : payload.get('unique_name'), - 'status_callback' : payload.get('status_callback'), - 'status_callback_method' : payload.get('status_callback_method'), - 'end_time' : payload.get('end_time'), - 'duration' : payload.get('duration'), - 'type' : payload.get('type'), - 'max_participants' : payload.get('max_participants'), - 'max_participant_duration' : payload.get('max_participant_duration'), - 'max_concurrent_published_tracks' : payload.get('max_concurrent_published_tracks'), - 'record_participants_on_connect' : payload.get('record_participants_on_connect'), - 'video_codecs' : payload.get('video_codecs'), - 'media_region' : payload.get('media_region'), - 'audio_only' : payload.get('audio_only'), - 'empty_room_timeout' : payload.get('empty_room_timeout'), - 'unused_room_timeout' : payload.get('unused_room_timeout'), - 'large_room' : payload.get('large_room'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = RoomContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def participants(self): - return self._proxy.participants - @property - def recording_rules(self): - return self._proxy.recording_rules - @property - def recordings(self): - return self._proxy.recordings - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class RoomListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Rooms' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return RoomInstance(self._version, payload, ) - - """ - - """ - def page(self, status, unique_name, date_created_after, date_created_before, page_size): - - data = values.of({ - 'status': status,'unique_name': unique_name,'date_created_after': date_created_after,'date_created_before': date_created_before,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return RoomPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/video/v1/room/__init__.py b/twilio/rest/video/v1/room/__init__.py index 47bf4ad10c..68da90f871 100644 --- a/twilio/rest/video/v1/room/__init__.py +++ b/twilio/rest/video/v1/room/__init__.py @@ -1,10 +1,17 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Video + 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 twilio.base import deserialize from twilio.base import serialize @@ -12,683 +19,171 @@ from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.video.v1.room.recording import RoomRecordingList -from twilio.rest.video.v1.room.room_participant import ParticipantList -from twilio.rest.video.v1.room.room_recording_rule import RecordingRulesList - - -class RoomList(ListResource): - - def __init__(self, version): - """ - Initialize the RoomList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.video.v1.room.RoomList - :rtype: twilio.rest.video.v1.room.RoomList - """ - super(RoomList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Rooms'.format(**self._solution) - - def create(self, enable_turn=values.unset, type=values.unset, - unique_name=values.unset, status_callback=values.unset, - status_callback_method=values.unset, max_participants=values.unset, - record_participants_on_connect=values.unset, - video_codecs=values.unset, media_region=values.unset, - recording_rules=values.unset, audio_only=values.unset, - max_participant_duration=values.unset, - empty_room_timeout=values.unset, unused_room_timeout=values.unset, - large_room=values.unset): - """ - Create the RoomInstance - - :param bool enable_turn: Enable Twilio's Network Traversal TURN service - :param RoomInstance.RoomType type: The type of room - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode status_callback: The URL to send status information to your application - :param unicode status_callback_method: The HTTP method we should use to call status_callback - :param unicode max_participants: The maximum number of concurrent Participants allowed in the room - :param bool record_participants_on_connect: Whether to start recording when Participants connect - :param list[RoomInstance.VideoCodec] video_codecs: An array of the video codecs that are supported when publishing a track in the room - :param unicode media_region: The region for the media server in Group Rooms - :param dict recording_rules: A collection of Recording Rules - :param bool audio_only: Indicates whether the room will only contain audio track participants for group rooms. - :param unicode max_participant_duration: The maximum number of seconds a Participant can be connected to the room - :param unicode empty_room_timeout: Configures the time a room will remain active after last participant leaves. - :param unicode unused_room_timeout: Configures the time a room will remain active when no one joins. - :param bool large_room: Indicates whether this is a large room. - - :returns: The created RoomInstance - :rtype: twilio.rest.video.v1.room.RoomInstance - """ - data = values.of({ - 'EnableTurn': enable_turn, - 'Type': type, - 'UniqueName': unique_name, - 'StatusCallback': status_callback, - 'StatusCallbackMethod': status_callback_method, - 'MaxParticipants': max_participants, - 'RecordParticipantsOnConnect': record_participants_on_connect, - 'VideoCodecs': serialize.map(video_codecs, lambda e: e), - 'MediaRegion': media_region, - 'RecordingRules': serialize.object(recording_rules), - 'AudioOnly': audio_only, - 'MaxParticipantDuration': max_participant_duration, - 'EmptyRoomTimeout': empty_room_timeout, - 'UnusedRoomTimeout': unused_room_timeout, - 'LargeRoom': large_room, - }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return RoomInstance(self._version, payload, ) - - def stream(self, status=values.unset, unique_name=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - limit=None, page_size=None): - """ - Streams RoomInstance 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 RoomInstance.RoomStatus status: Read only the rooms with this status - :param unicode unique_name: Read only rooms with this unique_name - :param datetime date_created_after: Read only rooms that started on or after this date, given as YYYY-MM-DD - :param datetime date_created_before: Read only rooms that started before this date, given as YYYY-MM-DD - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.video.v1.room.RoomInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - unique_name=unique_name, - date_created_after=date_created_after, - date_created_before=date_created_before, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, status=values.unset, unique_name=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - limit=None, page_size=None): - """ - Lists RoomInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param RoomInstance.RoomStatus status: Read only the rooms with this status - :param unicode unique_name: Read only rooms with this unique_name - :param datetime date_created_after: Read only rooms that started on or after this date, given as YYYY-MM-DD - :param datetime date_created_before: Read only rooms that started before this date, given as YYYY-MM-DD - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.room.RoomInstance] - """ - return list(self.stream( - status=status, - unique_name=unique_name, - date_created_after=date_created_after, - date_created_before=date_created_before, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, unique_name=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RoomInstance records from the API. - Request is executed immediately - - :param RoomInstance.RoomStatus status: Read only the rooms with this status - :param unicode unique_name: Read only rooms with this unique_name - :param datetime date_created_after: Read only rooms that started on or after this date, given as YYYY-MM-DD - :param datetime date_created_before: Read only rooms that started before this date, given as YYYY-MM-DD - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RoomInstance - :rtype: twilio.rest.video.v1.room.RoomPage - """ - data = values.of({ - 'Status': status, - 'UniqueName': unique_name, - 'DateCreatedAfter': serialize.iso8601_datetime(date_created_after), - 'DateCreatedBefore': serialize.iso8601_datetime(date_created_before), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return RoomPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RoomInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RoomInstance - :rtype: twilio.rest.video.v1.room.RoomPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RoomPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RoomContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.room.RoomContext - :rtype: twilio.rest.video.v1.room.RoomContext - """ - return RoomContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RoomContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.room.RoomContext - :rtype: twilio.rest.video.v1.room.RoomContext - """ - return RoomContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RoomPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the RoomPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.video.v1.room.RoomPage - :rtype: twilio.rest.video.v1.room.RoomPage - """ - super(RoomPage, self).__init__(version, response) +from twilio.base.version import Version - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RoomInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.video.v1.room.RoomInstance - :rtype: twilio.rest.video.v1.room.RoomInstance - """ - return RoomInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.room.participant import ParticipantListInstancefrom twilio.rest.room.recording_rules import RecordingRulesListInstancefrom twilio.rest.room.room_recording import RoomRecordingListInstance class RoomContext(InstanceContext): - - def __init__(self, version, sid): - """ - Initialize the RoomContext - - :param Version version: Version that contains the resource - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.room.RoomContext - :rtype: twilio.rest.video.v1.room.RoomContext - """ - super(RoomContext, self).__init__(version) + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Rooms/{sid}'.format(**self._solution) - - # Dependents - self._recordings = None + self._solution = { 'sid': sid, } + self._uri = '/Rooms/${sid}' + self._participants = None self._recording_rules = None - + self._recordings = None + def fetch(self): + """ Fetch the RoomInstance :returns: The fetched RoomInstance - :rtype: twilio.rest.video.v1.room.RoomInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return RoomInstance(self._version, payload, sid=self._solution['sid'], ) + - def update(self, status): - """ - Update the RoomInstance - - :param RoomInstance.RoomStatus status: The new status of the resource - - :returns: The updated RoomInstance - :rtype: twilio.rest.video.v1.room.RoomInstance - """ - data = values.of({'Status': status, }) + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return RoomInstance(self._version, payload, sid=self._solution['sid'], ) + + - @property - def recordings(self): - """ - Access the recordings - - :returns: twilio.rest.video.v1.room.recording.RoomRecordingList - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingList - """ - if self._recordings is None: - self._recordings = RoomRecordingList(self._version, room_sid=self._solution['sid'], ) - return self._recordings - - @property - def participants(self): - """ - Access the participants - - :returns: twilio.rest.video.v1.room.room_participant.ParticipantList - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantList - """ - if self._participants is None: - self._participants = ParticipantList(self._version, room_sid=self._solution['sid'], ) - return self._participants - - @property - def recording_rules(self): - """ - Access the recording_rules - - :returns: twilio.rest.video.v1.room.room_recording_rule.RecordingRulesList - :rtype: twilio.rest.video.v1.room.room_recording_rule.RecordingRulesList - """ - if self._recording_rules is None: - self._recording_rules = RecordingRulesList(self._version, room_sid=self._solution['sid'], ) - return self._recording_rules + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class RoomInstance(InstanceResource): - - class RoomStatus(object): - IN_PROGRESS = "in-progress" - COMPLETED = "completed" - FAILED = "failed" - - class RoomType(object): - GO = "go" - PEER_TO_PEER = "peer-to-peer" - GROUP = "group" - GROUP_SMALL = "group-small" - - class VideoCodec(object): - VP8 = "VP8" - H264 = "H264" - def __init__(self, version, payload, sid=None): - """ - Initialize the RoomInstance - - :returns: twilio.rest.video.v1.room.RoomInstance - :rtype: twilio.rest.video.v1.room.RoomInstance - """ - super(RoomInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'status': payload.get('status'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'account_sid': payload.get('account_sid'), - 'enable_turn': payload.get('enable_turn'), - 'unique_name': payload.get('unique_name'), - 'status_callback': payload.get('status_callback'), - 'status_callback_method': payload.get('status_callback_method'), - 'end_time': deserialize.iso8601_datetime(payload.get('end_time')), - 'duration': deserialize.integer(payload.get('duration')), - 'type': payload.get('type'), - 'max_participants': deserialize.integer(payload.get('max_participants')), - 'max_participant_duration': deserialize.integer(payload.get('max_participant_duration')), - 'max_concurrent_published_tracks': deserialize.integer(payload.get('max_concurrent_published_tracks')), - 'record_participants_on_connect': payload.get('record_participants_on_connect'), - 'video_codecs': payload.get('video_codecs'), - 'media_region': payload.get('media_region'), - 'audio_only': payload.get('audio_only'), - 'empty_room_timeout': deserialize.integer(payload.get('empty_room_timeout')), - 'unused_room_timeout': deserialize.integer(payload.get('unused_room_timeout')), - 'large_room': payload.get('large_room'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class RoomInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'status' : payload.get('status'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'account_sid' : payload.get('account_sid'), + 'enable_turn' : payload.get('enable_turn'), + 'unique_name' : payload.get('unique_name'), + 'status_callback' : payload.get('status_callback'), + 'status_callback_method' : payload.get('status_callback_method'), + 'end_time' : payload.get('end_time'), + 'duration' : payload.get('duration'), + 'type' : payload.get('type'), + 'max_participants' : payload.get('max_participants'), + 'max_participant_duration' : payload.get('max_participant_duration'), + 'max_concurrent_published_tracks' : payload.get('max_concurrent_published_tracks'), + 'record_participants_on_connect' : payload.get('record_participants_on_connect'), + 'video_codecs' : payload.get('video_codecs'), + 'media_region' : payload.get('media_region'), + 'audio_only' : payload.get('audio_only'), + 'empty_room_timeout' : payload.get('empty_room_timeout'), + 'unused_room_timeout' : payload.get('unused_room_timeout'), + 'large_room' : payload.get('large_room'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RoomContext for this RoomInstance - :rtype: twilio.rest.video.v1.room.RoomContext - """ if self._context is None: - self._context = RoomContext(self._version, sid=self._solution['sid'], ) + self._context = RoomContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def status(self): - """ - :returns: The status of the room - :rtype: RoomInstance.RoomStatus - """ - return self._properties['status'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def enable_turn(self): - """ - :returns: Enable Twilio's Network Traversal TURN service - :rtype: bool - """ - return self._properties['enable_turn'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def status_callback(self): - """ - :returns: The URL to send status information to your application - :rtype: unicode - """ - return self._properties['status_callback'] - - @property - def status_callback_method(self): - """ - :returns: The HTTP method we use to call status_callback - :rtype: unicode - """ - return self._properties['status_callback_method'] - - @property - def end_time(self): - """ - :returns: The UTC end time of the room in UTC ISO 8601 format - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def duration(self): - """ - :returns: The duration of the room in seconds - :rtype: unicode - """ - return self._properties['duration'] - - @property - def type(self): - """ - :returns: The type of room - :rtype: RoomInstance.RoomType - """ - return self._properties['type'] - - @property - def max_participants(self): - """ - :returns: The maximum number of concurrent Participants allowed in the room - :rtype: unicode - """ - return self._properties['max_participants'] - - @property - def max_participant_duration(self): - """ - :returns: The maximum number of seconds a Participant can be connected to the room - :rtype: unicode - """ - return self._properties['max_participant_duration'] - - @property - def max_concurrent_published_tracks(self): - """ - :returns: The maximum number of published tracks allowed in the room at the same time - :rtype: unicode - """ - return self._properties['max_concurrent_published_tracks'] - - @property - def record_participants_on_connect(self): - """ - :returns: Whether to start recording when Participants connect - :rtype: bool - """ - return self._properties['record_participants_on_connect'] - - @property - def video_codecs(self): - """ - :returns: An array of the video codecs that are supported when publishing a track in the room - :rtype: list[RoomInstance.VideoCodec] - """ - return self._properties['video_codecs'] - - @property - def media_region(self): - """ - :returns: The region for the media server in Group Rooms - :rtype: unicode - """ - return self._properties['media_region'] - - @property - def audio_only(self): - """ - :returns: Indicates whether the room will only contain audio track participants for group rooms. - :rtype: bool - """ - return self._properties['audio_only'] - - @property - def empty_room_timeout(self): - """ - :returns: The time a room will remain active after last participant leaves. - :rtype: unicode - """ - return self._properties['empty_room_timeout'] - - @property - def unused_room_timeout(self): - """ - :returns: The time a room will remain active when no one joins. - :rtype: unicode - """ - return self._properties['unused_room_timeout'] - - @property - def large_room(self): - """ - :returns: Indicates if this is a large room. - :rtype: bool - """ - return self._properties['large_room'] - + def participants(self): + return self._proxy.participants @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - + def recording_rules(self): + return self._proxy.recording_rules @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the RoomInstance + def recordings(self): + return self._proxy.recordings + - :returns: The fetched RoomInstance - :rtype: twilio.rest.video.v1.room.RoomInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, status): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the RoomInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param RoomInstance.RoomStatus status: The new status of the resource - :returns: The updated RoomInstance - :rtype: twilio.rest.video.v1.room.RoomInstance - """ - return self._proxy.update(status, ) - @property - def recordings(self): - """ - Access the recordings +class RoomListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.video.v1.room.recording.RoomRecordingList - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingList - """ - return self._proxy.recordings + # Path Solution + self._solution = { } + self._uri = '/Rooms' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) - @property - def participants(self): - """ - Access the participants + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.video.v1.room.room_participant.ParticipantList - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantList - """ - return self._proxy.participants + return RoomInstance(self._version, payload, ) + + """ + + """ + def page(self, status, unique_name, date_created_after, date_created_before, page_size): + + data = values.of({ + 'status': status,'unique_name': unique_name,'date_created_after': date_created_after,'date_created_before': date_created_before,'page_size': page_size, + }) - @property - def recording_rules(self): - """ - Access the recording_rules + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.video.v1.room.room_recording_rule.RecordingRulesList - :rtype: twilio.rest.video.v1.room.room_recording_rule.RecordingRulesList - """ - return self._proxy.recording_rules + return RoomPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/video/v1/room/participant.py b/twilio/rest/video/v1/room/participant/__init__.py similarity index 100% rename from twilio/rest/video/v1/room/participant.py rename to twilio/rest/video/v1/room/participant/__init__.py diff --git a/twilio/rest/video/v1/room/recording/__init__.py b/twilio/rest/video/v1/room/recording/__init__.py deleted file mode 100644 index 13eb5bc722..0000000000 --- a/twilio/rest/video/v1/room/recording/__init__.py +++ /dev/null @@ -1,514 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class RoomRecordingList(ListResource): - - def __init__(self, version, room_sid): - """ - Initialize the RoomRecordingList - - :param Version version: Version that contains the resource - :param room_sid: The SID of the Room resource the recording is associated with - - :returns: twilio.rest.video.v1.room.recording.RoomRecordingList - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingList - """ - super(RoomRecordingList, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, } - self._uri = '/Rooms/{room_sid}/Recordings'.format(**self._solution) - - def stream(self, status=values.unset, source_sid=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - limit=None, page_size=None): - """ - Streams RoomRecordingInstance 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 RoomRecordingInstance.Status status: Read only the recordings with this status - :param unicode source_sid: Read only the recordings that have this source_sid - :param datetime date_created_after: Read only Recordings that started on or after this ISO 8601 datetime with time zone - :param datetime date_created_before: Read only Recordings that started before this ISO 8601 date-time with time zone - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.video.v1.room.recording.RoomRecordingInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - source_sid=source_sid, - date_created_after=date_created_after, - date_created_before=date_created_before, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, status=values.unset, source_sid=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - limit=None, page_size=None): - """ - Lists RoomRecordingInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param RoomRecordingInstance.Status status: Read only the recordings with this status - :param unicode source_sid: Read only the recordings that have this source_sid - :param datetime date_created_after: Read only Recordings that started on or after this ISO 8601 datetime with time zone - :param datetime date_created_before: Read only Recordings that started before this ISO 8601 date-time with time zone - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.room.recording.RoomRecordingInstance] - """ - return list(self.stream( - status=status, - source_sid=source_sid, - date_created_after=date_created_after, - date_created_before=date_created_before, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, source_sid=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of RoomRecordingInstance records from the API. - Request is executed immediately - - :param RoomRecordingInstance.Status status: Read only the recordings with this status - :param unicode source_sid: Read only the recordings that have this source_sid - :param datetime date_created_after: Read only Recordings that started on or after this ISO 8601 datetime with time zone - :param datetime date_created_before: Read only Recordings that started before this ISO 8601 date-time with time zone - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of RoomRecordingInstance - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingPage - """ - data = values.of({ - 'Status': status, - 'SourceSid': source_sid, - 'DateCreatedAfter': serialize.iso8601_datetime(date_created_after), - 'DateCreatedBefore': serialize.iso8601_datetime(date_created_before), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return RoomRecordingPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of RoomRecordingInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of RoomRecordingInstance - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return RoomRecordingPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a RoomRecordingContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.room.recording.RoomRecordingContext - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingContext - """ - return RoomRecordingContext(self._version, room_sid=self._solution['room_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a RoomRecordingContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.room.recording.RoomRecordingContext - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingContext - """ - return RoomRecordingContext(self._version, room_sid=self._solution['room_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RoomRecordingPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the RoomRecordingPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param room_sid: The SID of the Room resource the recording is associated with - - :returns: twilio.rest.video.v1.room.recording.RoomRecordingPage - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingPage - """ - super(RoomRecordingPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RoomRecordingInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.video.v1.room.recording.RoomRecordingInstance - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingInstance - """ - return RoomRecordingInstance(self._version, payload, room_sid=self._solution['room_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RoomRecordingContext(InstanceContext): - - def __init__(self, version, room_sid, sid): - """ - Initialize the RoomRecordingContext - - :param Version version: Version that contains the resource - :param room_sid: The SID of the Room resource with the recording to fetch - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.room.recording.RoomRecordingContext - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingContext - """ - super(RoomRecordingContext, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, 'sid': sid, } - self._uri = '/Rooms/{room_sid}/Recordings/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the RoomRecordingInstance - - :returns: The fetched RoomRecordingInstance - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return RoomRecordingInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - sid=self._solution['sid'], - ) - - def delete(self): - """ - Deletes the RoomRecordingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class RoomRecordingInstance(InstanceResource): - - class Status(object): - PROCESSING = "processing" - COMPLETED = "completed" - DELETED = "deleted" - FAILED = "failed" - - class Type(object): - AUDIO = "audio" - VIDEO = "video" - DATA = "data" - - class Format(object): - MKA = "mka" - MKV = "mkv" - - class Codec(object): - VP8 = "VP8" - H264 = "H264" - OPUS = "OPUS" - PCMU = "PCMU" - - def __init__(self, version, payload, room_sid, sid=None): - """ - Initialize the RoomRecordingInstance - - :returns: twilio.rest.video.v1.room.recording.RoomRecordingInstance - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingInstance - """ - super(RoomRecordingInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'status': payload.get('status'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'sid': payload.get('sid'), - 'source_sid': payload.get('source_sid'), - 'size': deserialize.integer(payload.get('size')), - 'url': payload.get('url'), - 'type': payload.get('type'), - 'duration': deserialize.integer(payload.get('duration')), - 'container_format': payload.get('container_format'), - 'codec': payload.get('codec'), - 'grouping_sids': payload.get('grouping_sids'), - 'track_name': payload.get('track_name'), - 'offset': deserialize.integer(payload.get('offset')), - 'media_external_location': payload.get('media_external_location'), - 'room_sid': payload.get('room_sid'), - 'links': payload.get('links'), - } - - # Context - self._context = None - self._solution = {'room_sid': room_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: RoomRecordingContext for this RoomRecordingInstance - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingContext - """ - if self._context is None: - self._context = RoomRecordingContext( - self._version, - room_sid=self._solution['room_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def status(self): - """ - :returns: The status of the recording - :rtype: RoomRecordingInstance.Status - """ - return self._properties['status'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def source_sid(self): - """ - :returns: The SID of the recording source - :rtype: unicode - """ - return self._properties['source_sid'] - - @property - def size(self): - """ - :returns: The size of the recorded track in bytes - :rtype: unicode - """ - return self._properties['size'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def type(self): - """ - :returns: The recording's media type - :rtype: RoomRecordingInstance.Type - """ - return self._properties['type'] - - @property - def duration(self): - """ - :returns: The duration of the recording in seconds - :rtype: unicode - """ - return self._properties['duration'] - - @property - def container_format(self): - """ - :returns: The file format for the recording - :rtype: RoomRecordingInstance.Format - """ - return self._properties['container_format'] - - @property - def codec(self): - """ - :returns: The codec used for the recording - :rtype: RoomRecordingInstance.Codec - """ - return self._properties['codec'] - - @property - def grouping_sids(self): - """ - :returns: A list of SIDs related to the Recording - :rtype: dict - """ - return self._properties['grouping_sids'] - - @property - def track_name(self): - """ - :returns: The name that was given to the source track of the recording - :rtype: unicode - """ - return self._properties['track_name'] - - @property - def offset(self): - """ - :returns: The number of milliseconds between a point in time that is common to all rooms in a group and when the source room of the recording started - :rtype: unicode - """ - return self._properties['offset'] - - @property - def media_external_location(self): - """ - :returns: The URL of the media file associated with the recording when stored externally - :rtype: unicode - """ - return self._properties['media_external_location'] - - @property - def room_sid(self): - """ - :returns: The SID of the Room resource the recording is associated with - :rtype: unicode - """ - return self._properties['room_sid'] - - @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the RoomRecordingInstance - - :returns: The fetched RoomRecordingInstance - :rtype: twilio.rest.video.v1.room.recording.RoomRecordingInstance - """ - return self._proxy.fetch() - - def delete(self): - """ - Deletes the RoomRecordingInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) diff --git a/twilio/rest/video/v1/room/room_participant/__init__.py b/twilio/rest/video/v1/room/room_participant/__init__.py deleted file mode 100644 index 812a89e1d5..0000000000 --- a/twilio/rest/video/v1/room/room_participant/__init__.py +++ /dev/null @@ -1,579 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.video.v1.room.room_participant.room_participant_anonymize import AnonymizeList -from twilio.rest.video.v1.room.room_participant.room_participant_published_track import PublishedTrackList -from twilio.rest.video.v1.room.room_participant.room_participant_subscribe_rule import SubscribeRulesList -from twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track import SubscribedTrackList - - -class ParticipantList(ListResource): - - def __init__(self, version, room_sid): - """ - Initialize the ParticipantList - - :param Version version: Version that contains the resource - :param room_sid: The SID of the participant's room - - :returns: twilio.rest.video.v1.room.room_participant.ParticipantList - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantList - """ - super(ParticipantList, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, } - self._uri = '/Rooms/{room_sid}/Participants'.format(**self._solution) - - def stream(self, status=values.unset, identity=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - limit=None, page_size=None): - """ - Streams ParticipantInstance 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 ParticipantInstance.Status status: Read only the participants with this status - :param unicode identity: Read only the Participants with this user identity value - :param datetime date_created_after: Read only Participants that started after this date in UTC ISO 8601 format - :param datetime date_created_before: Read only Participants that started before this date in ISO 8601 format - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.video.v1.room.room_participant.ParticipantInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - identity=identity, - date_created_after=date_created_after, - date_created_before=date_created_before, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, status=values.unset, identity=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - limit=None, page_size=None): - """ - Lists ParticipantInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param ParticipantInstance.Status status: Read only the participants with this status - :param unicode identity: Read only the Participants with this user identity value - :param datetime date_created_after: Read only Participants that started after this date in UTC ISO 8601 format - :param datetime date_created_before: Read only Participants that started before this date in ISO 8601 format - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.room.room_participant.ParticipantInstance] - """ - return list(self.stream( - status=status, - identity=identity, - date_created_after=date_created_after, - date_created_before=date_created_before, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, identity=values.unset, - date_created_after=values.unset, date_created_before=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ParticipantInstance records from the API. - Request is executed immediately - - :param ParticipantInstance.Status status: Read only the participants with this status - :param unicode identity: Read only the Participants with this user identity value - :param datetime date_created_after: Read only Participants that started after this date in UTC ISO 8601 format - :param datetime date_created_before: Read only Participants that started before this date in ISO 8601 format - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ParticipantInstance - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantPage - """ - data = values.of({ - 'Status': status, - 'Identity': identity, - 'DateCreatedAfter': serialize.iso8601_datetime(date_created_after), - 'DateCreatedBefore': serialize.iso8601_datetime(date_created_before), - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ParticipantPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ParticipantInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ParticipantInstance - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ParticipantPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ParticipantContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.room.room_participant.ParticipantContext - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantContext - """ - return ParticipantContext(self._version, room_sid=self._solution['room_sid'], sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ParticipantContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.room.room_participant.ParticipantContext - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantContext - """ - return ParticipantContext(self._version, room_sid=self._solution['room_sid'], sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ParticipantPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the ParticipantPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param room_sid: The SID of the participant's room - - :returns: twilio.rest.video.v1.room.room_participant.ParticipantPage - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantPage - """ - super(ParticipantPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ParticipantInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.video.v1.room.room_participant.ParticipantInstance - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantInstance - """ - return ParticipantInstance(self._version, payload, room_sid=self._solution['room_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ParticipantContext(InstanceContext): - - def __init__(self, version, room_sid, sid): - """ - Initialize the ParticipantContext - - :param Version version: Version that contains the resource - :param room_sid: The SID of the room with the Participant resource to fetch - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.room.room_participant.ParticipantContext - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantContext - """ - super(ParticipantContext, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, 'sid': sid, } - self._uri = '/Rooms/{room_sid}/Participants/{sid}'.format(**self._solution) - - # Dependents - self._published_tracks = None - self._subscribed_tracks = None - self._subscribe_rules = None - self._anonymize = None - - def fetch(self): - """ - Fetch the ParticipantInstance - - :returns: The fetched ParticipantInstance - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ParticipantInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - sid=self._solution['sid'], - ) - - def update(self, status=values.unset): - """ - Update the ParticipantInstance - - :param ParticipantInstance.Status status: The new status of the resource - - :returns: The updated ParticipantInstance - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantInstance - """ - data = values.of({'Status': status, }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return ParticipantInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - sid=self._solution['sid'], - ) - - @property - def published_tracks(self): - """ - Access the published_tracks - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackList - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackList - """ - if self._published_tracks is None: - self._published_tracks = PublishedTrackList( - self._version, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['sid'], - ) - return self._published_tracks - - @property - def subscribed_tracks(self): - """ - Access the subscribed_tracks - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackList - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackList - """ - if self._subscribed_tracks is None: - self._subscribed_tracks = SubscribedTrackList( - self._version, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['sid'], - ) - return self._subscribed_tracks - - @property - def subscribe_rules(self): - """ - Access the subscribe_rules - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribe_rule.SubscribeRulesList - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribe_rule.SubscribeRulesList - """ - if self._subscribe_rules is None: - self._subscribe_rules = SubscribeRulesList( - self._version, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['sid'], - ) - return self._subscribe_rules - - @property - def anonymize(self): - """ - Access the anonymize - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizeList - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizeList - """ - if self._anonymize is None: - self._anonymize = AnonymizeList( - self._version, - room_sid=self._solution['room_sid'], - sid=self._solution['sid'], - ) - return self._anonymize - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class ParticipantInstance(InstanceResource): - - class Status(object): - CONNECTED = "connected" - DISCONNECTED = "disconnected" - - def __init__(self, version, payload, room_sid, sid=None): - """ - Initialize the ParticipantInstance - - :returns: twilio.rest.video.v1.room.room_participant.ParticipantInstance - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantInstance - """ - super(ParticipantInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'room_sid': payload.get('room_sid'), - 'account_sid': payload.get('account_sid'), - 'status': payload.get('status'), - 'identity': payload.get('identity'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'start_time': deserialize.iso8601_datetime(payload.get('start_time')), - 'end_time': deserialize.iso8601_datetime(payload.get('end_time')), - 'duration': deserialize.integer(payload.get('duration')), - 'url': payload.get('url'), - 'links': payload.get('links'), - } - - # Context - self._context = None - self._solution = {'room_sid': room_sid, 'sid': sid or self._properties['sid'], } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ParticipantContext for this ParticipantInstance - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantContext - """ - if self._context is None: - self._context = ParticipantContext( - self._version, - room_sid=self._solution['room_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def room_sid(self): - """ - :returns: The SID of the participant's room - :rtype: unicode - """ - return self._properties['room_sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def status(self): - """ - :returns: The status of the Participant - :rtype: ParticipantInstance.Status - """ - return self._properties['status'] - - @property - def identity(self): - """ - :returns: The string that identifies the resource's User - :rtype: unicode - """ - return self._properties['identity'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def start_time(self): - """ - :returns: The time of participant connected to the room in ISO 8601 format - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def end_time(self): - """ - :returns: The time when the participant disconnected from the room in ISO 8601 format - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def duration(self): - """ - :returns: Duration of time in seconds the participant was connected - :rtype: unicode - """ - return self._properties['duration'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the ParticipantInstance - - :returns: The fetched ParticipantInstance - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantInstance - """ - return self._proxy.fetch() - - def update(self, status=values.unset): - """ - Update the ParticipantInstance - - :param ParticipantInstance.Status status: The new status of the resource - - :returns: The updated ParticipantInstance - :rtype: twilio.rest.video.v1.room.room_participant.ParticipantInstance - """ - return self._proxy.update(status=status, ) - - @property - def published_tracks(self): - """ - Access the published_tracks - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackList - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackList - """ - return self._proxy.published_tracks - - @property - def subscribed_tracks(self): - """ - Access the subscribed_tracks - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackList - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackList - """ - return self._proxy.subscribed_tracks - - @property - def subscribe_rules(self): - """ - Access the subscribe_rules - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribe_rule.SubscribeRulesList - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribe_rule.SubscribeRulesList - """ - return self._proxy.subscribe_rules - - @property - def anonymize(self): - """ - Access the anonymize - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizeList - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizeList - """ - return self._proxy.anonymize - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) diff --git a/twilio/rest/video/v1/room/room_participant/room_participant_anonymize.py b/twilio/rest/video/v1/room/room_participant/room_participant_anonymize.py deleted file mode 100644 index 2efa0db46e..0000000000 --- a/twilio/rest/video/v1/room/room_participant/room_participant_anonymize.py +++ /dev/null @@ -1,318 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class AnonymizeList(ListResource): - - def __init__(self, version, room_sid, sid): - """ - Initialize the AnonymizeList - - :param Version version: Version that contains the resource - :param room_sid: The SID of the participant's room - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizeList - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizeList - """ - super(AnonymizeList, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, 'sid': sid, } - - def get(self): - """ - Constructs a AnonymizeContext - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizeContext - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizeContext - """ - return AnonymizeContext( - self._version, - room_sid=self._solution['room_sid'], - sid=self._solution['sid'], - ) - - def __call__(self): - """ - Constructs a AnonymizeContext - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizeContext - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizeContext - """ - return AnonymizeContext( - self._version, - room_sid=self._solution['room_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AnonymizePage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the AnonymizePage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param room_sid: The SID of the participant's room - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizePage - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizePage - """ - super(AnonymizePage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of AnonymizeInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizeInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizeInstance - """ - return AnonymizeInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class AnonymizeContext(InstanceContext): - - def __init__(self, version, room_sid, sid): - """ - Initialize the AnonymizeContext - - :param Version version: Version that contains the resource - :param room_sid: The SID of the room with the participant to update - :param sid: The SID that identifies the resource to update - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizeContext - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizeContext - """ - super(AnonymizeContext, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, 'sid': sid, } - self._uri = '/Rooms/{room_sid}/Participants/{sid}/Anonymize'.format(**self._solution) - - def update(self): - """ - Update the AnonymizeInstance - - :returns: The updated AnonymizeInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizeInstance - """ - payload = self._version.update(method='POST', uri=self._uri, ) - - return AnonymizeInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class AnonymizeInstance(InstanceResource): - - class Status(object): - CONNECTED = "connected" - DISCONNECTED = "disconnected" - - def __init__(self, version, payload, room_sid, sid): - """ - Initialize the AnonymizeInstance - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizeInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizeInstance - """ - super(AnonymizeInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'room_sid': payload.get('room_sid'), - 'account_sid': payload.get('account_sid'), - 'status': payload.get('status'), - 'identity': payload.get('identity'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'start_time': deserialize.iso8601_datetime(payload.get('start_time')), - 'end_time': deserialize.iso8601_datetime(payload.get('end_time')), - 'duration': deserialize.integer(payload.get('duration')), - 'url': payload.get('url'), - } - - # Context - self._context = None - self._solution = {'room_sid': room_sid, 'sid': sid, } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: AnonymizeContext for this AnonymizeInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizeContext - """ - if self._context is None: - self._context = AnonymizeContext( - self._version, - room_sid=self._solution['room_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def room_sid(self): - """ - :returns: The SID of the participant's room - :rtype: unicode - """ - return self._properties['room_sid'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def status(self): - """ - :returns: The status of the Participant - :rtype: AnonymizeInstance.Status - """ - return self._properties['status'] - - @property - def identity(self): - """ - :returns: The SID of the participant - :rtype: unicode - """ - return self._properties['identity'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def start_time(self): - """ - :returns: The time of participant connected to the room in ISO 8601 format - :rtype: datetime - """ - return self._properties['start_time'] - - @property - def end_time(self): - """ - :returns: The time when the participant disconnected from the room in ISO 8601 format - :rtype: datetime - """ - return self._properties['end_time'] - - @property - def duration(self): - """ - :returns: Duration of time in seconds the participant was connected - :rtype: unicode - """ - return self._properties['duration'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - def update(self): - """ - Update the AnonymizeInstance - - :returns: The updated AnonymizeInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_anonymize.AnonymizeInstance - """ - return self._proxy.update() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) diff --git a/twilio/rest/video/v1/room/room_participant/room_participant_published_track.py b/twilio/rest/video/v1/room/room_participant/room_participant_published_track.py deleted file mode 100644 index d86d817dde..0000000000 --- a/twilio/rest/video/v1/room/room_participant/room_participant_published_track.py +++ /dev/null @@ -1,392 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class PublishedTrackList(ListResource): - - def __init__(self, version, room_sid, participant_sid): - """ - Initialize the PublishedTrackList - - :param Version version: Version that contains the resource - :param room_sid: The SID of the Room resource where the track is published - :param participant_sid: The SID of the Participant resource with the published track - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackList - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackList - """ - super(PublishedTrackList, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, 'participant_sid': participant_sid, } - self._uri = '/Rooms/{room_sid}/Participants/{participant_sid}/PublishedTracks'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams PublishedTrackInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists PublishedTrackInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of PublishedTrackInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of PublishedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return PublishedTrackPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of PublishedTrackInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of PublishedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return PublishedTrackPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a PublishedTrackContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackContext - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackContext - """ - return PublishedTrackContext( - self._version, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a PublishedTrackContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackContext - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackContext - """ - return PublishedTrackContext( - self._version, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class PublishedTrackPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the PublishedTrackPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param room_sid: The SID of the Room resource where the track is published - :param participant_sid: The SID of the Participant resource with the published track - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackPage - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackPage - """ - super(PublishedTrackPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of PublishedTrackInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackInstance - """ - return PublishedTrackInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class PublishedTrackContext(InstanceContext): - - def __init__(self, version, room_sid, participant_sid, sid): - """ - Initialize the PublishedTrackContext - - :param Version version: Version that contains the resource - :param room_sid: The SID of the Room resource where the Track resource to fetch is published - :param participant_sid: The SID of the Participant resource with the published track to fetch - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackContext - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackContext - """ - super(PublishedTrackContext, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, 'participant_sid': participant_sid, 'sid': sid, } - self._uri = '/Rooms/{room_sid}/Participants/{participant_sid}/PublishedTracks/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the PublishedTrackInstance - - :returns: The fetched PublishedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return PublishedTrackInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class PublishedTrackInstance(InstanceResource): - - class Kind(object): - AUDIO = "audio" - VIDEO = "video" - DATA = "data" - - def __init__(self, version, payload, room_sid, participant_sid, sid=None): - """ - Initialize the PublishedTrackInstance - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackInstance - """ - super(PublishedTrackInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'participant_sid': payload.get('participant_sid'), - 'room_sid': payload.get('room_sid'), - 'name': payload.get('name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'enabled': payload.get('enabled'), - 'kind': payload.get('kind'), - 'url': payload.get('url'), - } - - # Context - self._context = None - self._solution = { - 'room_sid': room_sid, - 'participant_sid': participant_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: PublishedTrackContext for this PublishedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackContext - """ - if self._context is None: - self._context = PublishedTrackContext( - self._version, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def participant_sid(self): - """ - :returns: The SID of the Participant resource with the published track - :rtype: unicode - """ - return self._properties['participant_sid'] - - @property - def room_sid(self): - """ - :returns: The SID of the Room resource where the track is published - :rtype: unicode - """ - return self._properties['room_sid'] - - @property - def name(self): - """ - :returns: The track name - :rtype: unicode - """ - return self._properties['name'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def enabled(self): - """ - :returns: Whether the track is enabled - :rtype: bool - """ - return self._properties['enabled'] - - @property - def kind(self): - """ - :returns: The track type - :rtype: PublishedTrackInstance.Kind - """ - return self._properties['kind'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the PublishedTrackInstance - - :returns: The fetched PublishedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) diff --git a/twilio/rest/video/v1/room/room_participant/room_participant_subscribe_rule.py b/twilio/rest/video/v1/room/room_participant/room_participant_subscribe_rule.py deleted file mode 100644 index 3ab9650a7b..0000000000 --- a/twilio/rest/video/v1/room/room_participant/room_participant_subscribe_rule.py +++ /dev/null @@ -1,198 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SubscribeRulesList(ListResource): - - def __init__(self, version, room_sid, participant_sid): - """ - Initialize the SubscribeRulesList - - :param Version version: Version that contains the resource - :param room_sid: The SID of the Room resource for the Subscribe Rules - :param participant_sid: The SID of the Participant resource for the Subscribe Rules - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribe_rule.SubscribeRulesList - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribe_rule.SubscribeRulesList - """ - super(SubscribeRulesList, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, 'participant_sid': participant_sid, } - self._uri = '/Rooms/{room_sid}/Participants/{participant_sid}/SubscribeRules'.format(**self._solution) - - def fetch(self): - """ - Fetch the SubscribeRulesInstance - - :returns: The fetched SubscribeRulesInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribe_rule.SubscribeRulesInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SubscribeRulesInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], - ) - - def update(self, rules=values.unset): - """ - Update the SubscribeRulesInstance - - :param dict rules: A JSON-encoded array of subscribe rules - - :returns: The updated SubscribeRulesInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribe_rule.SubscribeRulesInstance - """ - data = values.of({'Rules': serialize.object(rules), }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return SubscribeRulesInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SubscribeRulesPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SubscribeRulesPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param room_sid: The SID of the Room resource for the Subscribe Rules - :param participant_sid: The SID of the Participant resource for the Subscribe Rules - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribe_rule.SubscribeRulesPage - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribe_rule.SubscribeRulesPage - """ - super(SubscribeRulesPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SubscribeRulesInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribe_rule.SubscribeRulesInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribe_rule.SubscribeRulesInstance - """ - return SubscribeRulesInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SubscribeRulesInstance(InstanceResource): - - def __init__(self, version, payload, room_sid, participant_sid): - """ - Initialize the SubscribeRulesInstance - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribe_rule.SubscribeRulesInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribe_rule.SubscribeRulesInstance - """ - super(SubscribeRulesInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'participant_sid': payload.get('participant_sid'), - 'room_sid': payload.get('room_sid'), - 'rules': payload.get('rules'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - } - - # Context - self._context = None - self._solution = {'room_sid': room_sid, 'participant_sid': participant_sid, } - - @property - def participant_sid(self): - """ - :returns: The SID of the Participant resource for the Subscribe Rules - :rtype: unicode - """ - return self._properties['participant_sid'] - - @property - def room_sid(self): - """ - :returns: The SID of the Room resource for the Subscribe Rules - :rtype: unicode - """ - return self._properties['room_sid'] - - @property - def rules(self): - """ - :returns: A collection of Subscribe Rules that describe how to include or exclude matching tracks - :rtype: list[unicode] - """ - return self._properties['rules'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/video/v1/room/room_participant/room_participant_subscribed_track.py b/twilio/rest/video/v1/room/room_participant/room_participant_subscribed_track.py deleted file mode 100644 index 342722431f..0000000000 --- a/twilio/rest/video/v1/room/room_participant/room_participant_subscribed_track.py +++ /dev/null @@ -1,401 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import values -from twilio.base.instance_context import InstanceContext -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class SubscribedTrackList(ListResource): - - def __init__(self, version, room_sid, participant_sid): - """ - Initialize the SubscribedTrackList - - :param Version version: Version that contains the resource - :param room_sid: The SID of the room where the track is published - :param participant_sid: The SID of the participant that subscribes to the track - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackList - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackList - """ - super(SubscribedTrackList, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, 'participant_sid': participant_sid, } - self._uri = '/Rooms/{room_sid}/Participants/{participant_sid}/SubscribedTracks'.format(**self._solution) - - def stream(self, limit=None, page_size=None): - """ - Streams SubscribedTrackInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists SubscribedTrackInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SubscribedTrackInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SubscribedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return SubscribedTrackPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SubscribedTrackInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SubscribedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SubscribedTrackPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SubscribedTrackContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackContext - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackContext - """ - return SubscribedTrackContext( - self._version, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], - sid=sid, - ) - - def __call__(self, sid): - """ - Constructs a SubscribedTrackContext - - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackContext - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackContext - """ - return SubscribedTrackContext( - self._version, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], - sid=sid, - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SubscribedTrackPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the SubscribedTrackPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param room_sid: The SID of the room where the track is published - :param participant_sid: The SID of the participant that subscribes to the track - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackPage - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackPage - """ - super(SubscribedTrackPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SubscribedTrackInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackInstance - """ - return SubscribedTrackInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SubscribedTrackContext(InstanceContext): - - def __init__(self, version, room_sid, participant_sid, sid): - """ - Initialize the SubscribedTrackContext - - :param Version version: Version that contains the resource - :param room_sid: The SID of the Room where the Track resource to fetch is subscribed - :param participant_sid: The SID of the participant that subscribes to the Track resource to fetch - :param sid: The SID that identifies the resource to fetch - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackContext - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackContext - """ - super(SubscribedTrackContext, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, 'participant_sid': participant_sid, 'sid': sid, } - self._uri = '/Rooms/{room_sid}/Participants/{participant_sid}/SubscribedTracks/{sid}'.format(**self._solution) - - def fetch(self): - """ - Fetch the SubscribedTrackInstance - - :returns: The fetched SubscribedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SubscribedTrackInstance( - self._version, - payload, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], - sid=self._solution['sid'], - ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - -class SubscribedTrackInstance(InstanceResource): - - class Kind(object): - AUDIO = "audio" - VIDEO = "video" - DATA = "data" - - def __init__(self, version, payload, room_sid, participant_sid, sid=None): - """ - Initialize the SubscribedTrackInstance - - :returns: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackInstance - """ - super(SubscribedTrackInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'participant_sid': payload.get('participant_sid'), - 'publisher_sid': payload.get('publisher_sid'), - 'room_sid': payload.get('room_sid'), - 'name': payload.get('name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'enabled': payload.get('enabled'), - 'kind': payload.get('kind'), - 'url': payload.get('url'), - } - - # Context - self._context = None - self._solution = { - 'room_sid': room_sid, - 'participant_sid': participant_sid, - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SubscribedTrackContext for this SubscribedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackContext - """ - if self._context is None: - self._context = SubscribedTrackContext( - self._version, - room_sid=self._solution['room_sid'], - participant_sid=self._solution['participant_sid'], - sid=self._solution['sid'], - ) - return self._context - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def participant_sid(self): - """ - :returns: The SID of the participant that subscribes to the track - :rtype: unicode - """ - return self._properties['participant_sid'] - - @property - def publisher_sid(self): - """ - :returns: The SID of the participant that publishes the track - :rtype: unicode - """ - return self._properties['publisher_sid'] - - @property - def room_sid(self): - """ - :returns: The SID of the room where the track is published - :rtype: unicode - """ - return self._properties['room_sid'] - - @property - def name(self): - """ - :returns: The track name - :rtype: unicode - """ - return self._properties['name'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def enabled(self): - """ - :returns: Whether the track is enabled - :rtype: bool - """ - return self._properties['enabled'] - - @property - def kind(self): - """ - :returns: The track type - :rtype: SubscribedTrackInstance.Kind - """ - return self._properties['kind'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - def fetch(self): - """ - Fetch the SubscribedTrackInstance - - :returns: The fetched SubscribedTrackInstance - :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribed_track.SubscribedTrackInstance - """ - return self._proxy.fetch() - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) diff --git a/twilio/rest/video/v1/room/room_recording_rule.py b/twilio/rest/video/v1/room/room_recording_rule.py deleted file mode 100644 index c813a3122e..0000000000 --- a/twilio/rest/video/v1/room/room_recording_rule.py +++ /dev/null @@ -1,172 +0,0 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / -""" - -from twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -from twilio.base.instance_resource import InstanceResource -from twilio.base.list_resource import ListResource -from twilio.base.page import Page - - -class RecordingRulesList(ListResource): - - def __init__(self, version, room_sid): - """ - Initialize the RecordingRulesList - - :param Version version: Version that contains the resource - :param room_sid: The SID of the Room resource for the Recording Rules - - :returns: twilio.rest.video.v1.room.room_recording_rule.RecordingRulesList - :rtype: twilio.rest.video.v1.room.room_recording_rule.RecordingRulesList - """ - super(RecordingRulesList, self).__init__(version) - - # Path Solution - self._solution = {'room_sid': room_sid, } - self._uri = '/Rooms/{room_sid}/RecordingRules'.format(**self._solution) - - def fetch(self): - """ - Fetch the RecordingRulesInstance - - :returns: The fetched RecordingRulesInstance - :rtype: twilio.rest.video.v1.room.room_recording_rule.RecordingRulesInstance - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return RecordingRulesInstance(self._version, payload, room_sid=self._solution['room_sid'], ) - - def update(self, rules=values.unset): - """ - Update the RecordingRulesInstance - - :param dict rules: A JSON-encoded array of recording rules - - :returns: The updated RecordingRulesInstance - :rtype: twilio.rest.video.v1.room.room_recording_rule.RecordingRulesInstance - """ - data = values.of({'Rules': serialize.object(rules), }) - - payload = self._version.update(method='POST', uri=self._uri, data=data, ) - - return RecordingRulesInstance(self._version, payload, room_sid=self._solution['room_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RecordingRulesPage(Page): - - def __init__(self, version, response, solution): - """ - Initialize the RecordingRulesPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - :param room_sid: The SID of the Room resource for the Recording Rules - - :returns: twilio.rest.video.v1.room.room_recording_rule.RecordingRulesPage - :rtype: twilio.rest.video.v1.room.room_recording_rule.RecordingRulesPage - """ - super(RecordingRulesPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of RecordingRulesInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.video.v1.room.room_recording_rule.RecordingRulesInstance - :rtype: twilio.rest.video.v1.room.room_recording_rule.RecordingRulesInstance - """ - return RecordingRulesInstance(self._version, payload, room_sid=self._solution['room_sid'], ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class RecordingRulesInstance(InstanceResource): - - def __init__(self, version, payload, room_sid): - """ - Initialize the RecordingRulesInstance - - :returns: twilio.rest.video.v1.room.room_recording_rule.RecordingRulesInstance - :rtype: twilio.rest.video.v1.room.room_recording_rule.RecordingRulesInstance - """ - super(RecordingRulesInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'room_sid': payload.get('room_sid'), - 'rules': payload.get('rules'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - } - - # Context - self._context = None - self._solution = {'room_sid': room_sid, } - - @property - def room_sid(self): - """ - :returns: The SID of the Room resource for the Recording Rules - :rtype: unicode - """ - return self._properties['room_sid'] - - @property - def rules(self): - """ - :returns: A collection of recording Rules that describe how to include or exclude matching tracks for recording - :rtype: list[unicode] - """ - return self._properties['rules'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/voice/v1/connection_policy.py b/twilio/rest/voice/v1/connection_policy.py deleted file mode 100644 index b1f6ff75ab..0000000000 --- a/twilio/rest/voice/v1/connection_policy.py +++ /dev/null @@ -1,176 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Voice - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.connection_policy.connection_policy_target import ConnectionPolicyTargetListInstance - - -class ConnectionPolicyContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/ConnectionPolicies/${sid}' - - self._targets = None - - def delete(self): - - - - """ - Deletes the ConnectionPolicyInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the ConnectionPolicyInstance - - :returns: The fetched ConnectionPolicyInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return ConnectionPolicyInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return ConnectionPolicyInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class ConnectionPolicyInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'account_sid' : payload.get('account_sid'), - 'sid' : payload.get('sid'), - 'friendly_name' : payload.get('friendly_name'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = ConnectionPolicyContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def targets(self): - return self._proxy.targets - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class ConnectionPolicyListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/ConnectionPolicies' - - - """ - def create(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.create(method='post', uri=self._uri, data=data, ) - - return ConnectionPolicyInstance(self._version, payload, ) - - """ - - """ - def page(self, page_size): - - data = values.of({ - 'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return ConnectionPolicyPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/voice/v1/connection_policy/__init__.py b/twilio/rest/voice/v1/connection_policy/__init__.py index 9ad6a51871..b1f6ff75ab 100644 --- a/twilio/rest/voice/v1/connection_policy/__init__.py +++ b/twilio/rest/voice/v1/connection_policy/__init__.py @@ -1,421 +1,176 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Voice + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.voice.v1.connection_policy.connection_policy_target import ConnectionPolicyTargetList - - -class ConnectionPolicyList(ListResource): - - def __init__(self, version): - """ - Initialize the ConnectionPolicyList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.voice.v1.connection_policy.ConnectionPolicyList - :rtype: twilio.rest.voice.v1.connection_policy.ConnectionPolicyList - """ - super(ConnectionPolicyList, self).__init__(version) +from twilio.base.version import Version - # Path Solution - self._solution = {} - self._uri = '/ConnectionPolicies'.format(**self._solution) - - def create(self, friendly_name=values.unset): - """ - Create the ConnectionPolicyInstance - - :param unicode friendly_name: A string to describe the resource - - :returns: The created ConnectionPolicyInstance - :rtype: twilio.rest.voice.v1.connection_policy.ConnectionPolicyInstance - """ - data = values.of({'FriendlyName': friendly_name, }) - - payload = self._version.create(method='POST', uri=self._uri, data=data, ) - - return ConnectionPolicyInstance(self._version, payload, ) - - def stream(self, limit=None, page_size=None): - """ - Streams ConnectionPolicyInstance 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 int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.voice.v1.connection_policy.ConnectionPolicyInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page(page_size=limits['page_size'], ) - - return self._version.stream(page, limits['limit']) - - def list(self, limit=None, page_size=None): - """ - Lists ConnectionPolicyInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.voice.v1.connection_policy.ConnectionPolicyInstance] - """ - return list(self.stream(limit=limit, page_size=page_size, )) - - def page(self, page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of ConnectionPolicyInstance records from the API. - Request is executed immediately - - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of ConnectionPolicyInstance - :rtype: twilio.rest.voice.v1.connection_policy.ConnectionPolicyPage - """ - data = values.of({'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return ConnectionPolicyPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of ConnectionPolicyInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of ConnectionPolicyInstance - :rtype: twilio.rest.voice.v1.connection_policy.ConnectionPolicyPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return ConnectionPolicyPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a ConnectionPolicyContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.voice.v1.connection_policy.ConnectionPolicyContext - :rtype: twilio.rest.voice.v1.connection_policy.ConnectionPolicyContext - """ - return ConnectionPolicyContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a ConnectionPolicyContext - - :param sid: The unique string that identifies the resource - - :returns: twilio.rest.voice.v1.connection_policy.ConnectionPolicyContext - :rtype: twilio.rest.voice.v1.connection_policy.ConnectionPolicyContext - """ - return ConnectionPolicyContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ConnectionPolicyPage(Page): +from twilio.base.page import Page - def __init__(self, version, response, solution): - """ - Initialize the ConnectionPolicyPage +# from twilio.rest.connection_policy.connection_policy_target import ConnectionPolicyTargetListInstance - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.voice.v1.connection_policy.ConnectionPolicyPage - :rtype: twilio.rest.voice.v1.connection_policy.ConnectionPolicyPage - """ - super(ConnectionPolicyPage, self).__init__(version, response) +class ConnectionPolicyContext(InstanceContext): + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of ConnectionPolicyInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.voice.v1.connection_policy.ConnectionPolicyInstance - :rtype: twilio.rest.voice.v1.connection_policy.ConnectionPolicyInstance - """ - return ConnectionPolicyInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class ConnectionPolicyContext(InstanceContext): + self._solution = { 'sid': sid, } + self._uri = '/ConnectionPolicies/${sid}' + + self._targets = None + + def delete(self): + + - def __init__(self, version, sid): """ - Initialize the ConnectionPolicyContext - - :param Version version: Version that contains the resource - :param sid: The unique string that identifies the resource + Deletes the ConnectionPolicyInstance - :returns: twilio.rest.voice.v1.connection_policy.ConnectionPolicyContext - :rtype: twilio.rest.voice.v1.connection_policy.ConnectionPolicyContext + :returns: True if delete succeeds, False otherwise + :rtype: bool """ - super(ConnectionPolicyContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/ConnectionPolicies/{sid}'.format(**self._solution) - - # Dependents - self._targets = None - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the ConnectionPolicyInstance :returns: The fetched ConnectionPolicyInstance - :rtype: twilio.rest.voice.v1.connection_policy.ConnectionPolicyInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return ConnectionPolicyInstance(self._version, payload, sid=self._solution['sid'], ) + - def update(self, friendly_name=values.unset): - """ - Update the ConnectionPolicyInstance - - :param unicode friendly_name: A string to describe the resource - - :returns: The updated ConnectionPolicyInstance - :rtype: twilio.rest.voice.v1.connection_policy.ConnectionPolicyInstance - """ - data = values.of({'FriendlyName': friendly_name, }) + + + def update(self, body): + data = values.of({ + 'body': body, + }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return ConnectionPolicyInstance(self._version, payload, sid=self._solution['sid'], ) + + - def delete(self): - """ - Deletes the ConnectionPolicyInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def targets(self): - """ - Access the targets - - :returns: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetList - :rtype: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetList - """ - if self._targets is None: - self._targets = ConnectionPolicyTargetList( - self._version, - connection_policy_sid=self._solution['sid'], - ) - return self._targets + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - + return '' -class ConnectionPolicyInstance(InstanceResource): - def __init__(self, version, payload, sid=None): - """ - Initialize the ConnectionPolicyInstance - :returns: twilio.rest.voice.v1.connection_policy.ConnectionPolicyInstance - :rtype: twilio.rest.voice.v1.connection_policy.ConnectionPolicyInstance - """ - super(ConnectionPolicyInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'account_sid': payload.get('account_sid'), - 'sid': payload.get('sid'), - 'friendly_name': payload.get('friendly_name'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), +class ConnectionPolicyInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'account_sid' : payload.get('account_sid'), + 'sid' : payload.get('sid'), + 'friendly_name' : payload.get('friendly_name'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: ConnectionPolicyContext for this ConnectionPolicyInstance - :rtype: twilio.rest.voice.v1.connection_policy.ConnectionPolicyContext - """ if self._context is None: - self._context = ConnectionPolicyContext(self._version, sid=self._solution['sid'], ) + self._context = ConnectionPolicyContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def account_sid(self): - """ - :returns: The SID of the Account that created the resource - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def sid(self): - """ - :returns: The unique string that identifies the resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def date_created(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The RFC 2822 date and time in GMT when the resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The URLs of related resources - :rtype: unicode - """ - return self._properties['links'] - - def fetch(self): - """ - Fetch the ConnectionPolicyInstance + def targets(self): + return self._proxy.targets + - :returns: The fetched ConnectionPolicyInstance - :rtype: twilio.rest.voice.v1.connection_policy.ConnectionPolicyInstance + def __repr__(self): """ - return self._proxy.fetch() - - def update(self, friendly_name=values.unset): + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - Update the ConnectionPolicyInstance + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - :param unicode friendly_name: A string to describe the resource - :returns: The updated ConnectionPolicyInstance - :rtype: twilio.rest.voice.v1.connection_policy.ConnectionPolicyInstance - """ - return self._proxy.update(friendly_name=friendly_name, ) - def delete(self): - """ - Deletes the ConnectionPolicyInstance +class ConnectionPolicyListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - - @property - def targets(self): - """ - Access the targets + # Path Solution + self._solution = { } + self._uri = '/ConnectionPolicies' + + + """ + def create(self, body): + data = values.of({ + 'body': body, + }) + + payload = self._version.create(method='post', uri=self._uri, data=data, ) - :returns: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetList - :rtype: twilio.rest.voice.v1.connection_policy.connection_policy_target.ConnectionPolicyTargetList - """ - return self._proxy.targets + return ConnectionPolicyInstance(self._version, payload, ) + + """ + + """ + def page(self, page_size): + + data = values.of({ + 'page_size': page_size, + }) + + payload = self._version.create(method='get', uri=self._uri, data=data, ) + + return ConnectionPolicyPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/voice/v1/dialing_permissions.py b/twilio/rest/voice/v1/dialing_permissions.py deleted file mode 100644 index 4774cb8ca9..0000000000 --- a/twilio/rest/voice/v1/dialing_permissions.py +++ /dev/null @@ -1,50 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Voice - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.rest.dialing_permissions.bulk_country_update import BulkCountryUpdateListInstancefrom twilio.rest.dialing_permissions.country import CountryListInstancefrom twilio.rest.dialing_permissions.settings import SettingsListInstance - - - - -class DialingPermissionsListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/DialingPermissions' - - self._bulk_country_updates = None - self._countries = None - self._settings = None - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/voice/v1/dialing_permissions/__init__.py b/twilio/rest/voice/v1/dialing_permissions/__init__.py index 8e3a4c9b61..4774cb8ca9 100644 --- a/twilio/rest/voice/v1/dialing_permissions/__init__.py +++ b/twilio/rest/voice/v1/dialing_permissions/__init__.py @@ -1,153 +1,50 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Voice + 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 twilio.base import deserialize +from twilio.base import serialize +from twilio.base import values +from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.voice.v1.dialing_permissions.bulk_country_update import BulkCountryUpdateList -from twilio.rest.voice.v1.dialing_permissions.country import CountryList -from twilio.rest.voice.v1.dialing_permissions.settings import SettingsList +from twilio.base.version import Version +# from twilio.rest.dialing_permissions.bulk_country_update import BulkCountryUpdateListInstancefrom twilio.rest.dialing_permissions.country import CountryListInstancefrom twilio.rest.dialing_permissions.settings import SettingsListInstance -class DialingPermissionsList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - def __init__(self, version): - """ - Initialize the DialingPermissionsList - :param Version version: Version that contains the resource - :returns: twilio.rest.voice.v1.dialing_permissions.DialingPermissionsList - :rtype: twilio.rest.voice.v1.dialing_permissions.DialingPermissionsList - """ - super(DialingPermissionsList, self).__init__(version) +class DialingPermissionsListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {} - - # Components + self._solution = { } + self._uri = '/DialingPermissions' + + self._bulk_country_updates = None self._countries = None self._settings = None - self._bulk_country_updates = None - - @property - def countries(self): - """ - Access the countries - - :returns: twilio.rest.voice.v1.dialing_permissions.country.CountryList - :rtype: twilio.rest.voice.v1.dialing_permissions.country.CountryList - """ - if self._countries is None: - self._countries = CountryList(self._version, ) - return self._countries - - @property - def settings(self): - """ - Access the settings - - :returns: twilio.rest.voice.v1.dialing_permissions.settings.SettingsList - :rtype: twilio.rest.voice.v1.dialing_permissions.settings.SettingsList - """ - if self._settings is None: - self._settings = SettingsList(self._version, ) - return self._settings - - @property - def bulk_country_updates(self): - """ - Access the bulk_country_updates - - :returns: twilio.rest.voice.v1.dialing_permissions.bulk_country_update.BulkCountryUpdateList - :rtype: twilio.rest.voice.v1.dialing_permissions.bulk_country_update.BulkCountryUpdateList - """ - if self._bulk_country_updates is None: - self._bulk_country_updates = BulkCountryUpdateList(self._version, ) - return self._bulk_country_updates - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class DialingPermissionsPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the DialingPermissionsPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.voice.v1.dialing_permissions.DialingPermissionsPage - :rtype: twilio.rest.voice.v1.dialing_permissions.DialingPermissionsPage - """ - super(DialingPermissionsPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of DialingPermissionsInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.voice.v1.dialing_permissions.DialingPermissionsInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.DialingPermissionsInstance - """ - return DialingPermissionsInstance(self._version, payload, ) + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - return '' + return '' - -class DialingPermissionsInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload): - """ - Initialize the DialingPermissionsInstance - - :returns: twilio.rest.voice.v1.dialing_permissions.DialingPermissionsInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.DialingPermissionsInstance - """ - super(DialingPermissionsInstance, self).__init__(version) - - # Context - self._context = None - self._solution = {} - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' diff --git a/twilio/rest/voice/v1/dialing_permissions/country.py b/twilio/rest/voice/v1/dialing_permissions/country.py deleted file mode 100644 index b849fce589..0000000000 --- a/twilio/rest/voice/v1/dialing_permissions/country.py +++ /dev/null @@ -1,141 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Voice - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.country.highrisk_special_prefix import HighriskSpecialPrefixListInstance - - -class CountryContext(InstanceContext): - def __init__(self, version: Version, iso_code: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'iso_code': iso_code, } - self._uri = '/DialingPermissions/Countries/${iso_code}' - - self._highrisk_special_prefixes = None - - def fetch(self): - - """ - Fetch the CountryInstance - - :returns: The fetched CountryInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return CountryInstance(self._version, payload, iso_code=self._solution['iso_code'], ) - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class CountryInstance(InstanceResource): - def __init__(self, version, payload, iso_code: str): - super().__init__(version) - self._properties = { - 'iso_code' : payload.get('iso_code'), - 'name' : payload.get('name'), - 'continent' : payload.get('continent'), - 'country_codes' : payload.get('country_codes'), - 'low_risk_numbers_enabled' : payload.get('low_risk_numbers_enabled'), - 'high_risk_special_numbers_enabled' : payload.get('high_risk_special_numbers_enabled'), - 'high_risk_tollfraud_numbers_enabled' : payload.get('high_risk_tollfraud_numbers_enabled'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - } - - self._context = None - self._solution = { - 'iso_code': iso_code or self._properties['iso_code'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = CountryContext( - self._version, - iso_code=self._solution['iso_code'], - ) - return self._context - - @property - def highrisk_special_prefixes(self): - return self._proxy.highrisk_special_prefixes - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class CountryListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/DialingPermissions/Countries' - - - """ - def page(self, iso_code, continent, country_code, low_risk_numbers_enabled, high_risk_special_numbers_enabled, high_risk_tollfraud_numbers_enabled, page_size): - - data = values.of({ - 'iso_code': iso_code,'continent': continent,'country_code': country_code,'low_risk_numbers_enabled': low_risk_numbers_enabled,'high_risk_special_numbers_enabled': high_risk_special_numbers_enabled,'high_risk_tollfraud_numbers_enabled': high_risk_tollfraud_numbers_enabled,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return CountryPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/voice/v1/dialing_permissions/country/__init__.py b/twilio/rest/voice/v1/dialing_permissions/country/__init__.py index 061ab72894..b849fce589 100644 --- a/twilio/rest/voice/v1/dialing_permissions/country/__init__.py +++ b/twilio/rest/voice/v1/dialing_permissions/country/__init__.py @@ -1,448 +1,141 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + Twilio - Voice + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.voice.v1.dialing_permissions.country.highrisk_special_prefix import HighriskSpecialPrefixList - - -class CountryList(ListResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version): - """ - Initialize the CountryList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.voice.v1.dialing_permissions.country.CountryList - :rtype: twilio.rest.voice.v1.dialing_permissions.country.CountryList - """ - super(CountryList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/DialingPermissions/Countries'.format(**self._solution) - - def stream(self, iso_code=values.unset, continent=values.unset, - country_code=values.unset, low_risk_numbers_enabled=values.unset, - high_risk_special_numbers_enabled=values.unset, - high_risk_tollfraud_numbers_enabled=values.unset, limit=None, - page_size=None): - """ - Streams CountryInstance 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 unicode iso_code: Filter to retrieve the country permissions by specifying the ISO country code - :param unicode continent: Filter to retrieve the country permissions by specifying the continent - :param unicode country_code: Country code filter - :param bool low_risk_numbers_enabled: Filter to retrieve the country permissions with dialing to low-risk numbers enabled - :param bool high_risk_special_numbers_enabled: Filter to retrieve the country permissions with dialing to high-risk special service numbers enabled - :param bool high_risk_tollfraud_numbers_enabled: Filter to retrieve the country permissions with dialing to high-risk toll fraud numbers enabled - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.voice.v1.dialing_permissions.country.CountryInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - iso_code=iso_code, - continent=continent, - country_code=country_code, - low_risk_numbers_enabled=low_risk_numbers_enabled, - high_risk_special_numbers_enabled=high_risk_special_numbers_enabled, - high_risk_tollfraud_numbers_enabled=high_risk_tollfraud_numbers_enabled, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, iso_code=values.unset, continent=values.unset, - country_code=values.unset, low_risk_numbers_enabled=values.unset, - high_risk_special_numbers_enabled=values.unset, - high_risk_tollfraud_numbers_enabled=values.unset, limit=None, - page_size=None): - """ - Lists CountryInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param unicode iso_code: Filter to retrieve the country permissions by specifying the ISO country code - :param unicode continent: Filter to retrieve the country permissions by specifying the continent - :param unicode country_code: Country code filter - :param bool low_risk_numbers_enabled: Filter to retrieve the country permissions with dialing to low-risk numbers enabled - :param bool high_risk_special_numbers_enabled: Filter to retrieve the country permissions with dialing to high-risk special service numbers enabled - :param bool high_risk_tollfraud_numbers_enabled: Filter to retrieve the country permissions with dialing to high-risk toll fraud numbers enabled - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.voice.v1.dialing_permissions.country.CountryInstance] - """ - return list(self.stream( - iso_code=iso_code, - continent=continent, - country_code=country_code, - low_risk_numbers_enabled=low_risk_numbers_enabled, - high_risk_special_numbers_enabled=high_risk_special_numbers_enabled, - high_risk_tollfraud_numbers_enabled=high_risk_tollfraud_numbers_enabled, - limit=limit, - page_size=page_size, - )) - - def page(self, iso_code=values.unset, continent=values.unset, - country_code=values.unset, low_risk_numbers_enabled=values.unset, - high_risk_special_numbers_enabled=values.unset, - high_risk_tollfraud_numbers_enabled=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of CountryInstance records from the API. - Request is executed immediately - - :param unicode iso_code: Filter to retrieve the country permissions by specifying the ISO country code - :param unicode continent: Filter to retrieve the country permissions by specifying the continent - :param unicode country_code: Country code filter - :param bool low_risk_numbers_enabled: Filter to retrieve the country permissions with dialing to low-risk numbers enabled - :param bool high_risk_special_numbers_enabled: Filter to retrieve the country permissions with dialing to high-risk special service numbers enabled - :param bool high_risk_tollfraud_numbers_enabled: Filter to retrieve the country permissions with dialing to high-risk toll fraud numbers enabled - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of CountryInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.country.CountryPage - """ - data = values.of({ - 'IsoCode': iso_code, - 'Continent': continent, - 'CountryCode': country_code, - 'LowRiskNumbersEnabled': low_risk_numbers_enabled, - 'HighRiskSpecialNumbersEnabled': high_risk_special_numbers_enabled, - 'HighRiskTollfraudNumbersEnabled': high_risk_tollfraud_numbers_enabled, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) - - return CountryPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of CountryInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of CountryInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.country.CountryPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return CountryPage(self._version, response, self._solution) +from twilio.base.version import Version - def get(self, iso_code): - """ - Constructs a CountryContext - - :param iso_code: The ISO country code - - :returns: twilio.rest.voice.v1.dialing_permissions.country.CountryContext - :rtype: twilio.rest.voice.v1.dialing_permissions.country.CountryContext - """ - return CountryContext(self._version, iso_code=iso_code, ) - - def __call__(self, iso_code): - """ - Constructs a CountryContext - - :param iso_code: The ISO country code - - :returns: twilio.rest.voice.v1.dialing_permissions.country.CountryContext - :rtype: twilio.rest.voice.v1.dialing_permissions.country.CountryContext - """ - return CountryContext(self._version, iso_code=iso_code, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class CountryPage(Page): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, response, solution): - """ - Initialize the CountryPage - - :param Version version: Version that contains the resource - :param Response response: Response from the API - - :returns: twilio.rest.voice.v1.dialing_permissions.country.CountryPage - :rtype: twilio.rest.voice.v1.dialing_permissions.country.CountryPage - """ - super(CountryPage, self).__init__(version, response) - - # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of CountryInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.voice.v1.dialing_permissions.country.CountryInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.country.CountryInstance - """ - return CountryInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation +from twilio.base.page import Page - :returns: Machine friendly representation - :rtype: str - """ - return '' +# from twilio.rest.country.highrisk_special_prefix import HighriskSpecialPrefixListInstance class CountryContext(InstanceContext): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, iso_code): - """ - Initialize the CountryContext - - :param Version version: Version that contains the resource - :param iso_code: The ISO country code - - :returns: twilio.rest.voice.v1.dialing_permissions.country.CountryContext - :rtype: twilio.rest.voice.v1.dialing_permissions.country.CountryContext - """ - super(CountryContext, self).__init__(version) + def __init__(self, version: Version, iso_code: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = {'iso_code': iso_code, } - self._uri = '/DialingPermissions/Countries/{iso_code}'.format(**self._solution) - - # Dependents + self._solution = { 'iso_code': iso_code, } + self._uri = '/DialingPermissions/Countries/${iso_code}' + self._highrisk_special_prefixes = None - + def fetch(self): + """ Fetch the CountryInstance :returns: The fetched CountryInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.country.CountryInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return CountryInstance(self._version, payload, iso_code=self._solution['iso_code'], ) + - @property - def highrisk_special_prefixes(self): - """ - Access the highrisk_special_prefixes - - :returns: twilio.rest.voice.v1.dialing_permissions.country.highrisk_special_prefix.HighriskSpecialPrefixList - :rtype: twilio.rest.voice.v1.dialing_permissions.country.highrisk_special_prefix.HighriskSpecialPrefixList - """ - if self._highrisk_special_prefixes is None: - self._highrisk_special_prefixes = HighriskSpecialPrefixList( - self._version, - iso_code=self._solution['iso_code'], - ) - return self._highrisk_special_prefixes + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class CountryInstance(InstanceResource): - """ PLEASE NOTE that this class contains preview products that are subject - to change. Use them with caution. If you currently do not have developer - preview access, please contact help@twilio.com. """ - - def __init__(self, version, payload, iso_code=None): - """ - Initialize the CountryInstance - - :returns: twilio.rest.voice.v1.dialing_permissions.country.CountryInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.country.CountryInstance - """ - super(CountryInstance, self).__init__(version) - # Marshaled Properties - self._properties = { - 'iso_code': payload.get('iso_code'), - 'name': payload.get('name'), - 'continent': payload.get('continent'), - 'country_codes': payload.get('country_codes'), - 'low_risk_numbers_enabled': payload.get('low_risk_numbers_enabled'), - 'high_risk_special_numbers_enabled': payload.get('high_risk_special_numbers_enabled'), - 'high_risk_tollfraud_numbers_enabled': payload.get('high_risk_tollfraud_numbers_enabled'), - 'url': payload.get('url'), - 'links': payload.get('links'), +class CountryInstance(InstanceResource): + def __init__(self, version, payload, iso_code: str): + super().__init__(version) + self._properties = { + 'iso_code' : payload.get('iso_code'), + 'name' : payload.get('name'), + 'continent' : payload.get('continent'), + 'country_codes' : payload.get('country_codes'), + 'low_risk_numbers_enabled' : payload.get('low_risk_numbers_enabled'), + 'high_risk_special_numbers_enabled' : payload.get('high_risk_special_numbers_enabled'), + 'high_risk_tollfraud_numbers_enabled' : payload.get('high_risk_tollfraud_numbers_enabled'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), } - # Context self._context = None - self._solution = {'iso_code': iso_code or self._properties['iso_code'], } + self._solution = { + 'iso_code': iso_code or self._properties['iso_code'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: CountryContext for this CountryInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.country.CountryContext - """ if self._context is None: - self._context = CountryContext(self._version, iso_code=self._solution['iso_code'], ) + self._context = CountryContext( + self._version, + iso_code=self._solution['iso_code'], + ) return self._context @property - def iso_code(self): - """ - :returns: The ISO country code - :rtype: unicode - """ - return self._properties['iso_code'] - - @property - def name(self): - """ - :returns: The name of the country - :rtype: unicode - """ - return self._properties['name'] - - @property - def continent(self): - """ - :returns: The name of the continent in which the country is located - :rtype: unicode - """ - return self._properties['continent'] - - @property - def country_codes(self): - """ - :returns: The E.164 assigned country codes(s) - :rtype: list[unicode] - """ - return self._properties['country_codes'] - - @property - def low_risk_numbers_enabled(self): - """ - :returns: Whether dialing to low-risk numbers is enabled - :rtype: bool - """ - return self._properties['low_risk_numbers_enabled'] - - @property - def high_risk_special_numbers_enabled(self): - """ - :returns: Whether dialing to high-risk special services numbers is enabled - :rtype: bool - """ - return self._properties['high_risk_special_numbers_enabled'] + def highrisk_special_prefixes(self): + return self._proxy.highrisk_special_prefixes + - @property - def high_risk_tollfraud_numbers_enabled(self): + def __repr__(self): """ - :returns: Whether dialing to high-risk toll fraud numbers is enabled, else `false` - :rtype: bool + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._properties['high_risk_tollfraud_numbers_enabled'] + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - @property - def url(self): - """ - :returns: The absolute URL of this resource - :rtype: unicode - """ - return self._properties['url'] - @property - def links(self): - """ - :returns: A list of URLs related to this resource - :rtype: unicode - """ - return self._properties['links'] - def fetch(self): - """ - Fetch the CountryInstance +class CountryListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: The fetched CountryInstance - :rtype: twilio.rest.voice.v1.dialing_permissions.country.CountryInstance - """ - return self._proxy.fetch() + # Path Solution + self._solution = { } + self._uri = '/DialingPermissions/Countries' + + + """ + def page(self, iso_code, continent, country_code, low_risk_numbers_enabled, high_risk_special_numbers_enabled, high_risk_tollfraud_numbers_enabled, page_size): + + data = values.of({ + 'iso_code': iso_code,'continent': continent,'country_code': country_code,'low_risk_numbers_enabled': low_risk_numbers_enabled,'high_risk_special_numbers_enabled': high_risk_special_numbers_enabled,'high_risk_tollfraud_numbers_enabled': high_risk_tollfraud_numbers_enabled,'page_size': page_size, + }) - @property - def highrisk_special_prefixes(self): - """ - Access the highrisk_special_prefixes + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.voice.v1.dialing_permissions.country.highrisk_special_prefix.HighriskSpecialPrefixList - :rtype: twilio.rest.voice.v1.dialing_permissions.country.highrisk_special_prefix.HighriskSpecialPrefixList - """ - return self._proxy.highrisk_special_prefixes + return CountryPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' + diff --git a/twilio/rest/wireless/v1/sim.py b/twilio/rest/wireless/v1/sim.py deleted file mode 100644 index b9f3d4cead..0000000000 --- a/twilio/rest/wireless/v1/sim.py +++ /dev/null @@ -1,185 +0,0 @@ -""" - This code was generated by - ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - - Twilio - Wireless - 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 twilio.base import deserialize -from twilio.base import serialize -from twilio.base import values -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.sim.data_session import DataSessionListInstancefrom twilio.rest.sim.usage_record import UsageRecordListInstance - - -class SimContext(InstanceContext): - def __init__(self, version: Version, sid: str): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { 'sid': sid, } - self._uri = '/Sims/${sid}' - - self._data_sessions = None - self._usage_records = None - - def delete(self): - - - - """ - Deletes the SimInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - def fetch(self): - - """ - Fetch the SimInstance - - :returns: The fetched SimInstance - #TODO: add rtype docs - """ - payload = self._version.fetch(method='GET', uri=self._uri, ) - - return SimInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - def update(self, body): - data = values.of({ - 'body': body, - }) - - payload = self._version.update(method='post', uri=self._uri, data=data, ) - - return SimInstance(self._version, payload, sid=self._solution['sid'], ) - - - - - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - - - -class SimInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - super().__init__(version) - self._properties = { - 'sid' : payload.get('sid'), - 'unique_name' : payload.get('unique_name'), - 'account_sid' : payload.get('account_sid'), - 'rate_plan_sid' : payload.get('rate_plan_sid'), - 'friendly_name' : payload.get('friendly_name'), - 'iccid' : payload.get('iccid'), - 'e_id' : payload.get('e_id'), - 'status' : payload.get('status'), - 'reset_status' : payload.get('reset_status'), - 'commands_callback_url' : payload.get('commands_callback_url'), - 'commands_callback_method' : payload.get('commands_callback_method'), - 'sms_fallback_method' : payload.get('sms_fallback_method'), - 'sms_fallback_url' : payload.get('sms_fallback_url'), - 'sms_method' : payload.get('sms_method'), - 'sms_url' : payload.get('sms_url'), - 'voice_fallback_method' : payload.get('voice_fallback_method'), - 'voice_fallback_url' : payload.get('voice_fallback_url'), - 'voice_method' : payload.get('voice_method'), - 'voice_url' : payload.get('voice_url'), - 'date_created' : payload.get('date_created'), - 'date_updated' : payload.get('date_updated'), - 'url' : payload.get('url'), - 'links' : payload.get('links'), - 'ip_address' : payload.get('ip_address'), - } - - self._context = None - self._solution = { - 'sid': sid or self._properties['sid'], - } - - @property - def _proxy(self): - if self._context is None: - self._context = SimContext( - self._version, - sid=self._solution['sid'], - ) - return self._context - - @property - def data_sessions(self): - return self._proxy.data_sessions - @property - def usage_records(self): - return self._proxy.usage_records - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) - - - -class SimListInstance(ListResource): - def __init__(self, version: Version): - # TODO: needs autogenerated docs - super().__init__(version) - - # Path Solution - self._solution = { } - self._uri = '/Sims' - - - """ - def page(self, status, iccid, rate_plan, eid, sim_registration_code, page_size): - - data = values.of({ - 'status': status,'iccid': iccid,'rate_plan': rate_plan,'eid': eid,'sim_registration_code': sim_registration_code,'page_size': page_size, - }) - - payload = self._version.create(method='get', uri=self._uri, data=data, ) - - return SimPage(self._version, payload, ) - """ - - - def __repr__(self): - """ - Provide a friendly representation - :returns: Machine friendly representation - :rtype: str - """ - return '' - diff --git a/twilio/rest/wireless/v1/sim/__init__.py b/twilio/rest/wireless/v1/sim/__init__.py index 0fb4b39fb8..b9f3d4cead 100644 --- a/twilio/rest/wireless/v1/sim/__init__.py +++ b/twilio/rest/wireless/v1/sim/__init__.py @@ -1,728 +1,185 @@ -# coding=utf-8 -r""" -This code was generated by -\ / _ _ _| _ _ - | (_)\/(_)(_|\/| |(/_ v1.0.0 - / / """ + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Wireless + 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 twilio.base import deserialize +from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource -from twilio.base.page import Page -from twilio.rest.wireless.v1.sim.data_session import DataSessionList -from twilio.rest.wireless.v1.sim.usage_record import UsageRecordList - - -class SimList(ListResource): - - def __init__(self, version): - """ - Initialize the SimList - - :param Version version: Version that contains the resource - - :returns: twilio.rest.wireless.v1.sim.SimList - :rtype: twilio.rest.wireless.v1.sim.SimList - """ - super(SimList, self).__init__(version) - - # Path Solution - self._solution = {} - self._uri = '/Sims'.format(**self._solution) - - def stream(self, status=values.unset, iccid=values.unset, - rate_plan=values.unset, e_id=values.unset, - sim_registration_code=values.unset, limit=None, page_size=None): - """ - Streams SimInstance 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 SimInstance.Status status: Only return Sim resources with this status - :param unicode iccid: Only return Sim resources with this ICCID - :param unicode rate_plan: Only return Sim resources assigned to this RatePlan resource - :param unicode e_id: Deprecated - :param unicode sim_registration_code: Only return Sim resources with this registration code - :param int limit: Upper limit for the number of records to return. stream() - guarantees to never return more than limit. Default is no limit - :param int 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 - :rtype: list[twilio.rest.wireless.v1.sim.SimInstance] - """ - limits = self._version.read_limits(limit, page_size) - - page = self.page( - status=status, - iccid=iccid, - rate_plan=rate_plan, - e_id=e_id, - sim_registration_code=sim_registration_code, - page_size=limits['page_size'], - ) - - return self._version.stream(page, limits['limit']) - - def list(self, status=values.unset, iccid=values.unset, rate_plan=values.unset, - e_id=values.unset, sim_registration_code=values.unset, limit=None, - page_size=None): - """ - Lists SimInstance records from the API as a list. - Unlike stream(), this operation is eager and will load `limit` records into - memory before returning. - - :param SimInstance.Status status: Only return Sim resources with this status - :param unicode iccid: Only return Sim resources with this ICCID - :param unicode rate_plan: Only return Sim resources assigned to this RatePlan resource - :param unicode e_id: Deprecated - :param unicode sim_registration_code: Only return Sim resources with this registration code - :param int limit: Upper limit for the number of records to return. list() guarantees - never to return more than limit. Default is no limit - :param int 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: Generator that will yield up to limit results - :rtype: list[twilio.rest.wireless.v1.sim.SimInstance] - """ - return list(self.stream( - status=status, - iccid=iccid, - rate_plan=rate_plan, - e_id=e_id, - sim_registration_code=sim_registration_code, - limit=limit, - page_size=page_size, - )) - - def page(self, status=values.unset, iccid=values.unset, rate_plan=values.unset, - e_id=values.unset, sim_registration_code=values.unset, - page_token=values.unset, page_number=values.unset, - page_size=values.unset): - """ - Retrieve a single page of SimInstance records from the API. - Request is executed immediately - - :param SimInstance.Status status: Only return Sim resources with this status - :param unicode iccid: Only return Sim resources with this ICCID - :param unicode rate_plan: Only return Sim resources assigned to this RatePlan resource - :param unicode e_id: Deprecated - :param unicode sim_registration_code: Only return Sim resources with this registration code - :param str page_token: PageToken provided by the API - :param int page_number: Page Number, this value is simply for client state - :param int page_size: Number of records to return, defaults to 50 - - :returns: Page of SimInstance - :rtype: twilio.rest.wireless.v1.sim.SimPage - """ - data = values.of({ - 'Status': status, - 'Iccid': iccid, - 'RatePlan': rate_plan, - 'EId': e_id, - 'SimRegistrationCode': sim_registration_code, - 'PageToken': page_token, - 'Page': page_number, - 'PageSize': page_size, - }) - - response = self._version.page(method='GET', uri=self._uri, params=data, ) +from twilio.base.version import Version - return SimPage(self._version, response, self._solution) - - def get_page(self, target_url): - """ - Retrieve a specific page of SimInstance records from the API. - Request is executed immediately - - :param str target_url: API-generated URL for the requested results page - - :returns: Page of SimInstance - :rtype: twilio.rest.wireless.v1.sim.SimPage - """ - response = self._version.domain.twilio.request( - 'GET', - target_url, - ) - - return SimPage(self._version, response, self._solution) - - def get(self, sid): - """ - Constructs a SimContext - - :param sid: The SID of the Sim resource to fetch - - :returns: twilio.rest.wireless.v1.sim.SimContext - :rtype: twilio.rest.wireless.v1.sim.SimContext - """ - return SimContext(self._version, sid=sid, ) - - def __call__(self, sid): - """ - Constructs a SimContext - - :param sid: The SID of the Sim resource to fetch - - :returns: twilio.rest.wireless.v1.sim.SimContext - :rtype: twilio.rest.wireless.v1.sim.SimContext - """ - return SimContext(self._version, sid=sid, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SimPage(Page): +from twilio.base.page import Page - def __init__(self, version, response, solution): - """ - Initialize the SimPage +# from twilio.rest.sim.data_session import DataSessionListInstancefrom twilio.rest.sim.usage_record import UsageRecordListInstance - :param Version version: Version that contains the resource - :param Response response: Response from the API - :returns: twilio.rest.wireless.v1.sim.SimPage - :rtype: twilio.rest.wireless.v1.sim.SimPage - """ - super(SimPage, self).__init__(version, response) +class SimContext(InstanceContext): + def __init__(self, version: Version, sid: str): + # TODO: needs autogenerated docs + super().__init__(version) # Path Solution - self._solution = solution - - def get_instance(self, payload): - """ - Build an instance of SimInstance - - :param dict payload: Payload response from the API - - :returns: twilio.rest.wireless.v1.sim.SimInstance - :rtype: twilio.rest.wireless.v1.sim.SimInstance - """ - return SimInstance(self._version, payload, ) - - def __repr__(self): - """ - Provide a friendly representation - - :returns: Machine friendly representation - :rtype: str - """ - return '' - - -class SimContext(InstanceContext): + self._solution = { 'sid': sid, } + self._uri = '/Sims/${sid}' + + self._data_sessions = None + self._usage_records = None + + def delete(self): + + - def __init__(self, version, sid): """ - Initialize the SimContext - - :param Version version: Version that contains the resource - :param sid: The SID of the Sim resource to fetch + Deletes the SimInstance - :returns: twilio.rest.wireless.v1.sim.SimContext - :rtype: twilio.rest.wireless.v1.sim.SimContext + :returns: True if delete succeeds, False otherwise + :rtype: bool """ - super(SimContext, self).__init__(version) - - # Path Solution - self._solution = {'sid': sid, } - self._uri = '/Sims/{sid}'.format(**self._solution) - - # Dependents - self._usage_records = None - self._data_sessions = None - + return self._version.delete(method='DELETE', uri=self._uri, ) + def fetch(self): + """ Fetch the SimInstance :returns: The fetched SimInstance - :rtype: twilio.rest.wireless.v1.sim.SimInstance + #TODO: add rtype docs """ payload = self._version.fetch(method='GET', uri=self._uri, ) return SimInstance(self._version, payload, sid=self._solution['sid'], ) + - def update(self, unique_name=values.unset, callback_method=values.unset, - callback_url=values.unset, friendly_name=values.unset, - rate_plan=values.unset, status=values.unset, - commands_callback_method=values.unset, - commands_callback_url=values.unset, sms_fallback_method=values.unset, - sms_fallback_url=values.unset, sms_method=values.unset, - sms_url=values.unset, voice_fallback_method=values.unset, - voice_fallback_url=values.unset, voice_method=values.unset, - voice_url=values.unset, reset_status=values.unset, - account_sid=values.unset): - """ - Update the SimInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode callback_method: The HTTP method we should use to call callback_url - :param unicode callback_url: The URL we should call when the Sim resource has finished updating - :param unicode friendly_name: A string to describe the Sim resource - :param unicode rate_plan: The SID or unique name of the RatePlan resource to which the Sim resource should be assigned - :param SimInstance.Status status: The new status of the Sim resource - :param unicode commands_callback_method: The HTTP method we should use to call commands_callback_url - :param unicode commands_callback_url: The URL we should call when the SIM sends a Command - :param unicode sms_fallback_method: The HTTP method we should use to call sms_fallback_url - :param unicode sms_fallback_url: The URL we should call when an error occurs while retrieving or executing the TwiML requested from sms_url - :param unicode sms_method: The HTTP method we should use to call sms_url - :param unicode sms_url: The URL we should call when the SIM-connected device sends an SMS message that is not a Command - :param unicode voice_fallback_method: Deprecated - :param unicode voice_fallback_url: Deprecated - :param unicode voice_method: Deprecated - :param unicode voice_url: Deprecated - :param SimInstance.ResetStatus reset_status: Initiate a connectivity reset on a SIM - :param unicode account_sid: The SID of the Account to which the Sim resource should belong - - :returns: The updated SimInstance - :rtype: twilio.rest.wireless.v1.sim.SimInstance - """ + + + def update(self, body): data = values.of({ - 'UniqueName': unique_name, - 'CallbackMethod': callback_method, - 'CallbackUrl': callback_url, - 'FriendlyName': friendly_name, - 'RatePlan': rate_plan, - 'Status': status, - 'CommandsCallbackMethod': commands_callback_method, - 'CommandsCallbackUrl': commands_callback_url, - 'SmsFallbackMethod': sms_fallback_method, - 'SmsFallbackUrl': sms_fallback_url, - 'SmsMethod': sms_method, - 'SmsUrl': sms_url, - 'VoiceFallbackMethod': voice_fallback_method, - 'VoiceFallbackUrl': voice_fallback_url, - 'VoiceMethod': voice_method, - 'VoiceUrl': voice_url, - 'ResetStatus': reset_status, - 'AccountSid': account_sid, + 'body': body, }) - payload = self._version.update(method='POST', uri=self._uri, data=data, ) + payload = self._version.update(method='post', uri=self._uri, data=data, ) return SimInstance(self._version, payload, sid=self._solution['sid'], ) + + - def delete(self): - """ - Deletes the SimInstance - - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._version.delete(method='DELETE', uri=self._uri, ) - - @property - def usage_records(self): - """ - Access the usage_records - - :returns: twilio.rest.wireless.v1.sim.usage_record.UsageRecordList - :rtype: twilio.rest.wireless.v1.sim.usage_record.UsageRecordList - """ - if self._usage_records is None: - self._usage_records = UsageRecordList(self._version, sim_sid=self._solution['sid'], ) - return self._usage_records - - @property - def data_sessions(self): - """ - Access the data_sessions - - :returns: twilio.rest.wireless.v1.sim.data_session.DataSessionList - :rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionList - """ - if self._data_sessions is None: - self._data_sessions = DataSessionList(self._version, sim_sid=self._solution['sid'], ) - return self._data_sessions + + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' -class SimInstance(InstanceResource): - - class Status(object): - NEW = "new" - READY = "ready" - ACTIVE = "active" - SUSPENDED = "suspended" - DEACTIVATED = "deactivated" - CANCELED = "canceled" - SCHEDULED = "scheduled" - UPDATING = "updating" - class ResetStatus(object): - RESETTING = "resetting" - - def __init__(self, version, payload, sid=None): - """ - Initialize the SimInstance - - :returns: twilio.rest.wireless.v1.sim.SimInstance - :rtype: twilio.rest.wireless.v1.sim.SimInstance - """ - super(SimInstance, self).__init__(version) - - # Marshaled Properties - self._properties = { - 'sid': payload.get('sid'), - 'unique_name': payload.get('unique_name'), - 'account_sid': payload.get('account_sid'), - 'rate_plan_sid': payload.get('rate_plan_sid'), - 'friendly_name': payload.get('friendly_name'), - 'iccid': payload.get('iccid'), - 'e_id': payload.get('e_id'), - 'status': payload.get('status'), - 'reset_status': payload.get('reset_status'), - 'commands_callback_url': payload.get('commands_callback_url'), - 'commands_callback_method': payload.get('commands_callback_method'), - 'sms_fallback_method': payload.get('sms_fallback_method'), - 'sms_fallback_url': payload.get('sms_fallback_url'), - 'sms_method': payload.get('sms_method'), - 'sms_url': payload.get('sms_url'), - 'voice_fallback_method': payload.get('voice_fallback_method'), - 'voice_fallback_url': payload.get('voice_fallback_url'), - 'voice_method': payload.get('voice_method'), - 'voice_url': payload.get('voice_url'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), - 'ip_address': payload.get('ip_address'), +class SimInstance(InstanceResource): + def __init__(self, version, payload, sid: str): + super().__init__(version) + self._properties = { + 'sid' : payload.get('sid'), + 'unique_name' : payload.get('unique_name'), + 'account_sid' : payload.get('account_sid'), + 'rate_plan_sid' : payload.get('rate_plan_sid'), + 'friendly_name' : payload.get('friendly_name'), + 'iccid' : payload.get('iccid'), + 'e_id' : payload.get('e_id'), + 'status' : payload.get('status'), + 'reset_status' : payload.get('reset_status'), + 'commands_callback_url' : payload.get('commands_callback_url'), + 'commands_callback_method' : payload.get('commands_callback_method'), + 'sms_fallback_method' : payload.get('sms_fallback_method'), + 'sms_fallback_url' : payload.get('sms_fallback_url'), + 'sms_method' : payload.get('sms_method'), + 'sms_url' : payload.get('sms_url'), + 'voice_fallback_method' : payload.get('voice_fallback_method'), + 'voice_fallback_url' : payload.get('voice_fallback_url'), + 'voice_method' : payload.get('voice_method'), + 'voice_url' : payload.get('voice_url'), + 'date_created' : payload.get('date_created'), + 'date_updated' : payload.get('date_updated'), + 'url' : payload.get('url'), + 'links' : payload.get('links'), + 'ip_address' : payload.get('ip_address'), } - # Context self._context = None - self._solution = {'sid': sid or self._properties['sid'], } + self._solution = { + 'sid': sid or self._properties['sid'], + } @property def _proxy(self): - """ - Generate an instance context for the instance, the context is capable of - performing various actions. All instance actions are proxied to the context - - :returns: SimContext for this SimInstance - :rtype: twilio.rest.wireless.v1.sim.SimContext - """ if self._context is None: - self._context = SimContext(self._version, sid=self._solution['sid'], ) + self._context = SimContext( + self._version, + sid=self._solution['sid'], + ) return self._context @property - def sid(self): - """ - :returns: The unique string that identifies the Sim resource - :rtype: unicode - """ - return self._properties['sid'] - - @property - def unique_name(self): - """ - :returns: An application-defined string that uniquely identifies the resource - :rtype: unicode - """ - return self._properties['unique_name'] - - @property - def account_sid(self): - """ - :returns: The SID of the Account to which the Sim resource belongs - :rtype: unicode - """ - return self._properties['account_sid'] - - @property - def rate_plan_sid(self): - """ - :returns: The SID of the RatePlan resource to which the Sim resource is assigned. - :rtype: unicode - """ - return self._properties['rate_plan_sid'] - - @property - def friendly_name(self): - """ - :returns: The string that you assigned to describe the Sim resource - :rtype: unicode - """ - return self._properties['friendly_name'] - - @property - def iccid(self): - """ - :returns: The ICCID associated with the SIM - :rtype: unicode - """ - return self._properties['iccid'] - - @property - def e_id(self): - """ - :returns: Deprecated - :rtype: unicode - """ - return self._properties['e_id'] - - @property - def status(self): - """ - :returns: The status of the Sim resource - :rtype: SimInstance.Status - """ - return self._properties['status'] - - @property - def reset_status(self): - """ - :returns: The connectivity reset status of the SIM - :rtype: SimInstance.ResetStatus - """ - return self._properties['reset_status'] - - @property - def commands_callback_url(self): - """ - :returns: The URL we call when the SIM originates a machine-to-machine Command - :rtype: unicode - """ - return self._properties['commands_callback_url'] - - @property - def commands_callback_method(self): - """ - :returns: The HTTP method we use to call commands_callback_url - :rtype: unicode - """ - return self._properties['commands_callback_method'] - - @property - def sms_fallback_method(self): - """ - :returns: Deprecated - :rtype: unicode - """ - return self._properties['sms_fallback_method'] - - @property - def sms_fallback_url(self): - """ - :returns: Deprecated - :rtype: unicode - """ - return self._properties['sms_fallback_url'] - - @property - def sms_method(self): - """ - :returns: Deprecated - :rtype: unicode - """ - return self._properties['sms_method'] - - @property - def sms_url(self): - """ - :returns: Deprecated - :rtype: unicode - """ - return self._properties['sms_url'] - - @property - def voice_fallback_method(self): - """ - :returns: Deprecated. The HTTP method we use to call voice_fallback_url - :rtype: unicode - """ - return self._properties['voice_fallback_method'] - - @property - def voice_fallback_url(self): - """ - :returns: Deprecated. The URL we call when an error occurs while retrieving or executing the TwiML requested from voice_url - :rtype: unicode - """ - return self._properties['voice_fallback_url'] - - @property - def voice_method(self): - """ - :returns: Deprecated. The HTTP method we use to call voice_url - :rtype: unicode - """ - return self._properties['voice_method'] - - @property - def voice_url(self): - """ - :returns: Deprecated. The URL we call when the SIM-connected device makes a voice call - :rtype: unicode - """ - return self._properties['voice_url'] - - @property - def date_created(self): - """ - :returns: The ISO 8601 date and time in GMT when the resource was created - :rtype: datetime - """ - return self._properties['date_created'] - - @property - def date_updated(self): - """ - :returns: The ISO 8601 date and time in GMT when the Sim resource was last updated - :rtype: datetime - """ - return self._properties['date_updated'] - - @property - def url(self): - """ - :returns: The absolute URL of the resource - :rtype: unicode - """ - return self._properties['url'] - - @property - def links(self): - """ - :returns: The URLs of related subresources - :rtype: unicode - """ - return self._properties['links'] - + def data_sessions(self): + return self._proxy.data_sessions @property - def ip_address(self): - """ - :returns: Deprecated - :rtype: unicode - """ - return self._properties['ip_address'] - - def fetch(self): - """ - Fetch the SimInstance + def usage_records(self): + return self._proxy.usage_records + - :returns: The fetched SimInstance - :rtype: twilio.rest.wireless.v1.sim.SimInstance - """ - return self._proxy.fetch() - - def update(self, unique_name=values.unset, callback_method=values.unset, - callback_url=values.unset, friendly_name=values.unset, - rate_plan=values.unset, status=values.unset, - commands_callback_method=values.unset, - commands_callback_url=values.unset, sms_fallback_method=values.unset, - sms_fallback_url=values.unset, sms_method=values.unset, - sms_url=values.unset, voice_fallback_method=values.unset, - voice_fallback_url=values.unset, voice_method=values.unset, - voice_url=values.unset, reset_status=values.unset, - account_sid=values.unset): + def __repr__(self): """ - Update the SimInstance - - :param unicode unique_name: An application-defined string that uniquely identifies the resource - :param unicode callback_method: The HTTP method we should use to call callback_url - :param unicode callback_url: The URL we should call when the Sim resource has finished updating - :param unicode friendly_name: A string to describe the Sim resource - :param unicode rate_plan: The SID or unique name of the RatePlan resource to which the Sim resource should be assigned - :param SimInstance.Status status: The new status of the Sim resource - :param unicode commands_callback_method: The HTTP method we should use to call commands_callback_url - :param unicode commands_callback_url: The URL we should call when the SIM sends a Command - :param unicode sms_fallback_method: The HTTP method we should use to call sms_fallback_url - :param unicode sms_fallback_url: The URL we should call when an error occurs while retrieving or executing the TwiML requested from sms_url - :param unicode sms_method: The HTTP method we should use to call sms_url - :param unicode sms_url: The URL we should call when the SIM-connected device sends an SMS message that is not a Command - :param unicode voice_fallback_method: Deprecated - :param unicode voice_fallback_url: Deprecated - :param unicode voice_method: Deprecated - :param unicode voice_url: Deprecated - :param SimInstance.ResetStatus reset_status: Initiate a connectivity reset on a SIM - :param unicode account_sid: The SID of the Account to which the Sim resource should belong - - :returns: The updated SimInstance - :rtype: twilio.rest.wireless.v1.sim.SimInstance + Provide a friendly representation + :returns: Machine friendly representation + :rtype: str """ - return self._proxy.update( - unique_name=unique_name, - callback_method=callback_method, - callback_url=callback_url, - friendly_name=friendly_name, - rate_plan=rate_plan, - status=status, - commands_callback_method=commands_callback_method, - commands_callback_url=commands_callback_url, - sms_fallback_method=sms_fallback_method, - sms_fallback_url=sms_fallback_url, - sms_method=sms_method, - sms_url=sms_url, - voice_fallback_method=voice_fallback_method, - voice_fallback_url=voice_fallback_url, - voice_method=voice_method, - voice_url=voice_url, - reset_status=reset_status, - account_sid=account_sid, - ) + context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) + return ''.format(context) - def delete(self): - """ - Deletes the SimInstance - :returns: True if delete succeeds, False otherwise - :rtype: bool - """ - return self._proxy.delete() - @property - def usage_records(self): - """ - Access the usage_records +class SimListInstance(ListResource): + def __init__(self, version: Version): + # TODO: needs autogenerated docs + super().__init__(version) - :returns: twilio.rest.wireless.v1.sim.usage_record.UsageRecordList - :rtype: twilio.rest.wireless.v1.sim.usage_record.UsageRecordList - """ - return self._proxy.usage_records + # Path Solution + self._solution = { } + self._uri = '/Sims' + + + """ + def page(self, status, iccid, rate_plan, eid, sim_registration_code, page_size): + + data = values.of({ + 'status': status,'iccid': iccid,'rate_plan': rate_plan,'eid': eid,'sim_registration_code': sim_registration_code,'page_size': page_size, + }) - @property - def data_sessions(self): - """ - Access the data_sessions + payload = self._version.create(method='get', uri=self._uri, data=data, ) - :returns: twilio.rest.wireless.v1.sim.data_session.DataSessionList - :rtype: twilio.rest.wireless.v1.sim.data_session.DataSessionList - """ - return self._proxy.data_sessions + return SimPage(self._version, payload, ) + """ + def __repr__(self): """ Provide a friendly representation - :returns: Machine friendly representation :rtype: str """ - context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items()) - return ''.format(context) + return '' +