def listApplications(self, friendlyName=None, page=None, pageSize=None): """ Shows info on all TelAPI applications associated with some account. :param friendlyName: (optional) Filters by the application's FriendlyName. :param page: (optional) Used to return a particular page within the list. :param pageSize: (optional) Used to specify the amount of list items to return per page. :type friendlyName: str :type page: int :type pageSize: int :return: `Applications` object :rtype: zang.domain.list.applications.Applications :raises ZangException: """ queryParams = { 'FriendlyName': friendlyName, 'Page': page, 'PageSize': pageSize, } params = flatDict(queryParams) applications = self._executor.read(('Applications', ), Applications, params=params) return applications
def deafOrMuteParticipant( self, conferenceSid, participantSid, muted=None, deaf=None,): """ Set status of participant in a conference to muted or deaf :param conferenceSid: Conference SID :param participantSid: SID of the participant :param muted: (optional) Filter only muted participants :param deaf: (optional) Filter only deaf participants :type conferenceSid: str :type participantSid: str :type muted: (optional) bool :type deaf: (optional) bool :return: The participant in question. :rtype: zang.domain.participant.Participant :raises ZangException: """ bodyParams = { 'Muted': muted, 'Deaf': deaf, } data = flatDict(bodyParams) participant = self._executor.update( ('Conferences', conferenceSid, 'Participants', participantSid), Participant, data=data) return participant
def playAudioToParticipant( self, conferenceSid, participantSid, audioUrl=None,): """ Plays an audio file to a conference participant :param conferenceSid: Conference SID :param participantSid: SID of the participant :param audioUrl: (optional) url A URL to the audio file that will be played to the participant. :type conferenceSid: str :type participantSid: str :type audioUrl: (optional) str :return: The participant in question. :rtype: zang.domain.participant.Participant :raises ZangException: """ bodyParams = { 'AudioUrl': audioUrl, } data = flatDict(bodyParams) participant = self._executor.update( ('Conferences', conferenceSid, 'Participants', participantSid, 'Play'), Participant, data=data) return participant
def listFraudControlResources(self, page=None, pageSize=None): """ Shows information on all fraud control resources associated with some account. :param page: (optional) Used to return a particular page within the list. :param pageSize: (optional) Used to specify the amount of list items to return per page. :type page: int :type pageSize: int :return: `FraudControlRuleElements` object :rtype: zang.domain.fraud_control_rule_elements. FraudControlRuleElements :raises ZangException: """ queryParams = { 'Page': page, 'PageSize': pageSize, } params = flatDict(queryParams) fraudControlRuleElements = self._executor.read( ('Fraud',), FraudControlRuleElements, params) return fraudControlRuleElements
def updateAclIp(self, aclSid, ipSid, friendlyName=None, ipAddress=None): """ Updates IP address for IP access control list :param aclSid: IP access control list SID. :param ipSid: Access control list IP address SID. :param friendlyName: A human-readable name associated with this IP ACL. :param ipAddress: An IP address from which you wish to accept traffic. At this time, only IPv4 supported. :type aclSid: str :type ipSid: str :type friendlyName: str :type ipAddress: str :return: `IpAddress` object :rtype: zang.domain.ip_address.IpAddress :raises ZangException: """ bodyParams = { 'FriendlyName': friendlyName, 'IpAddress': ipAddress, } data = flatDict(bodyParams) ipAddress = self._executor.update( ('SIP', 'IpAccessControlLists', aclSid, 'IpAddresses', ipSid), IpAddress, data) return ipAddress
def sendDigitsToLiveCall( self, callSid, playDtmf=None, playDtmfDirection=None,): """ Use DTMF tones to mimic button presses. :param callSid: Call SID. :param playDtmf: Allowed values are the digits 0-9, #, *, W, or w. "w" and "W"stand for 1/2 second pauses. You can combine these values together, for example, "12ww34". Tones are also supported and follow the @1000 syntax, for example to play the tone 4 for two seconds, 4@2000 (milliseconds) would be used. :param playDtmfDirection: Specifies which leg of the call DTMF tones will be played on. Allowed values are “in” to send tones to the incoming caller or “out” to send tones to the out going caller. :type callSid: str :type playDtmf: str :type playDtmfDirection: zang.domain.enums.audio_direction. AudioDirection :return: An `Calls` resource. :rtype: zang.domain.list.calls.Calls :raises: ZangException """ bodyParams = { 'PlayDtmf': playDtmf, 'PlayDtmfDirection': playDtmfDirection } data = flatDict(bodyParams) call = self._executor.update(('Calls', callSid), Call, data=data) return call
def listNotifications(self, log=None, page=None, pageSize=None,): """ Shows information on some notification. :param log: Specifies that only notifications with the given log level value should be listed. Allowed values are 1,2 or 3, where 2=INFO, 1=WARNING, 0=ERROR. :param page: Used to return a particular page within the list. :param pageSize: Used to specify the amount of list items to return per page. :type log: zang.domain.enums.log_level.LogLevel :type page: int :type pageSize: int :return: `Notification` object :rtype: zang.domain.notification.Notification :raises ZangException: """ queryParams = { 'Log': log, 'Page': page, 'PageSize': pageSize, } params = flatDict(queryParams) notifications = self._executor.read( ('Notifications',), Notifications, params) return notifications
def interruptLiveCall( self, callSid, url=None, method=None, status=None,): """ Send new instructions to the call. :param callSid: Call SID. :param url: The URL that in-progress calls will request for new instructions. :param method: The HTTP method used to request the redirect URL. Valid parameters are GET and POST. :param status: The status used to end the call. Allowed values are "canceled" for ending queued or ringing calls, and "completed" to end in-progress calls in addition to queued and ringing calls. :type callSid: str :type url: str :type method: zang.domain.enums.http_method.HttpMethod :type status: zang.domain.enums.end_call_status.EndCallStatus :return: An `Calls` resource. :rtype: zang.domain.list.calls.Calls :raises: ZangException """ bodyParams = {'Url': url, 'Method': method, 'Status': status} data = flatDict(bodyParams) call = self._executor.update(('Calls', callSid), Call, data=data) return call
def listAvailablePhoneNumbers( self, country, type_, page=None, pageSize=None, contains=None, areaCode=None, inRegion=None, inPostalCode=None, ): """ Shows information on all phone numbers available for purchasing :param country: Two letter country code. :param type_: Type of the phone number. Can be Local or Tollfree :param page: (optiona) Used to return a particular page within the list. :param pageSize: (optiona) Used to specify the amount of list items to return per page. :param contains: (optiona) Specifies the desired characters contained within the available numbers to list. :param areaCode: (optiona) Specifies the area code that the returned list of available numbers should be in. Only available for North American numbers :param inRegion: (optiona) Specifies the desired region of the available numbers to be listed. :param inPostalCode: (optiona) Specifies the desired postal code of the available numbers to be listed. :type country: str :type type: zang.domain.enums.available_number_type.AvailableNumberType :type page: int :type pageSize: int :type contains: str :type areaCode: str :type inRegion: str :type inPostalCode: str :return: `AvailablePhoneNumbers` object :rtype: zang.domain.list.available_phone_numbers.AvailablePhoneNumbers :raises ZangException: """ queryParams = { 'Country': country, 'Type': type_, 'Page': page, 'PageSize': pageSize, 'Contains': contains, 'AreaCode': areaCode, 'InRegion': inRegion, 'InPostalCode': inPostalCode, } if isinstance(type_, Enum): type_ = type_.value params = flatDict(queryParams) availablePhoneNumbers = self._executor.read( ('AvailablePhoneNumbers', country, type_), AvailablePhoneNumbers, params) return availablePhoneNumbers
def transcribeRecording( self, recordingSid, transcribeCallback=None, callbackMethod=None, sliceStart=None, sliceDuration=None, quality=None, ): """ Transcribes some recording :param recordingSid: Recording SID. :param transcribeCallback: (option) The URL some parameters regarding the transcription will be passed to once it is completed. The longer the recording time, the longer the process delay in returning the transcription information. If no TranscribeCallback is given, the recording will still be saved to the system and available either in your Transcriptions Logs or via a REST List Transcriptions (ADD URL LINK) request. URL length is limited to 200 characters. :param callbackMethod: The (option) HTTP method used to request the TranscribeCallback. Valid parameters are GET and POST - any other value will default to POST. :param sliceStart: Start (option) point for slice transcription (in seconds). :param sliceDuration: Duration (option) of slice transcription (in seconds). :param quality: Specifies (option) the transcription quality. Transcription price differs for each quality tier. See pricing page for details. Allowed values are "auto", "hybrid" and "keywords", where "auto" is a machine-generated transcription, "hybrid" is reviewed by a human for accuracy and "keywords" returns topics and keywords for given audio file. :type recordingSid: str :type transcribeCallback: str :type callbackMethod: zang.domain.enums.http_method.HttpMethod :type sliceStart: int :type sliceDuration: int :type quality: zang.domain.enums.transcribe_quality.TranscribeQuality :return: `Transcriptions` object :rtype: zang.domain.list.transcriptions.Transcriptions :raises ZangException: """ queryParams = { 'TranscribeCallback': transcribeCallback, 'CallbackMethod': callbackMethod, 'SliceStart': sliceStart, 'SliceDuration': sliceDuration, 'Quality': quality, } params = flatDict(queryParams) transcription = self._executor.update( ('Recordings', recordingSid, 'Transcriptions'), Transcription, params) return transcription
def listConferences( self, friendlyName=None, status=None, dateCreatedGte=None, dateCreatedLt=None, dateUpdatedGte=None, dateUpdatedLt=None, page=None, pageSize=None, ): """ List conferences associated with an account :param friendlyName: (optional) Filters conferences by the given FriendlyName. :param status: (optional) Filters conferences by the given status. Allowed values are "init", "in-progress", or "completed". :param dateCreatedGte: (optional) Filter by date created greater or equal then :param dateCreatedLt: (optional) Filter by date created less than :param dateUpdatedGte: (optional) Filter by date updated greater or equal then :param dateUpdatedLt: (optional) Filter by date updated less than :param page: (optional) Used to return a particular page within the list. :param pageSize: (optional) Used to specify the amount of list items to return per page. :type friendlyName: str :type status: zang.domain.enums.conference_status.ConferenceStatus :type dateCreatedGte: datetime.date :type dateCreatedLt: datetime.date :type dateUpdatedGte: datetime.date :type dateUpdatedLt: datetime.date :type page: int :type pageSize: int :return: List of Conferences :rtype: zang.domain.list.conferences.Conferences :raises ZangException: """ queryParams = { 'FriendlyName': friendlyName, 'Status': status, 'DateCreated>': dateCreatedGte, 'DateCreated<': dateCreatedLt, 'DateUpdated>': dateUpdatedGte, 'DateUpdated<': dateUpdatedLt, 'Page': page, 'PageSize': pageSize, } params = flatDict(queryParams) conferences = self._executor.read(('Conferences', ), Conferences, params) return conferences
def applyVoiceEffect( self, callSid, direction, pitch=None, pitchSemiTones=None, pitchOctaves=None, rate=None, tempo=None, ): """ Applies voice effect on the call. :param CallSid: Call SID. :param AudioDirection: Specifies which caller should have their voice modified. Allowed values are "in" for the incoming caller and "out" for the outgoing caller. This value can be changed as often as you like to control live call flow. :param Pitch: Sets the pitch. The lower the value, the lower the tone. Allowed values are integers greater than 0. :param PitchSemiTones: Changes the pitch of audio in semitone intervals. Allowed values are integers between -14 and 14. :param PitchOctaves: Changes the pitch of the audio in octave intervals. Allowed values are integers between -1 and 1. :param Rate: Sets the rate. The lower the value, the lower the rate. Allowed values are integers greater than 0. :param Tempo: Sets the tempo. The lower the value, the slower the tempo. Allowed values are integers greater than 0. :type CallSid: str :type AudioDirection: zang.domain.enums.audio_direction.AudioDirection :type Pitch: int :type PitchSemiTones: int :type PitchOctaves: int :type Rate: int :type Tempo: int :return: An `Calls` resource. :rtype: zang.domain.list.calls.Calls :raises: ZangException """ bodyParams = { 'AudioDirection': direction, 'Pitch': pitch, 'PitchSemiTones': pitchSemiTones, 'PitchOctaves': pitchOctaves, 'Rate': rate, 'Tempo': tempo, } data = flatDict(bodyParams) call = self._executor.update(('Calls', callSid, 'Effect'), Call, data=data) return call
def transcribeAudioUrl( self, audioUrl=None, transcribeCallback=None, sliceStart=None, sliceDuration=None, callbackMethod=None, quality=None, ): """ Transcribes an audio file on some URL :param audioUrl: (option) URL where the audio to be transcribed is located. :param transcribeCallback: (option) URL that will be requested when the transcription has finished processing. :param sliceStart: (option) Start point for slice transcription (in seconds). :param sliceDuration: (option) Duration of slice transcription (in seconds). :param callbackMethod: (option) Specifies the HTTP method to use when requesting the TranscribeCallback URL. Allowed values are "POST" and "GET". :param quality: (option) Specifies the transcription quality. Transcription price differs for each quality tier. See pricing page for details. Allowed values are "auto", "hybrid" and "keywords", where "auto" is a machine-generated transcription, "hybrid" is reviewed by a human for accuracy and "keywords" returns topics and keywords for given audio file. :type audioUrl: str :type transcribeCallback: str :type sliceStart: int :type sliceDuration: int :type callbackMethod: zang.domain.enums.http_method.HttpMethod :type quality: zang.domain.enums.transcribe_quality.TranscribeQuality :return: `Transcriptions` object :rtype: zang.domain.list.transcriptions.Transcriptions :raises ZangException: """ bodyParams = { 'AudioUrl': audioUrl, 'TranscribeCallback': transcribeCallback, 'SliceStart': sliceStart, 'SliceDuration': sliceDuration, 'CallbackMethod': callbackMethod, 'Quality': quality, } data = flatDict(bodyParams) transcription = self._executor.update(('Transcriptions', ), Transcription, data) return transcription
def listUsages( self, day=None, month=None, year=None, product=None, page=None, pageSize=None, ): """ Complete list of all usages of your account. :param day: (optional) Filters usage by day of month. If no month is specified then defaults to current month. Allowed values are integers between 1 and 31 depending on the month. Leading 0s will be ignored. :param month: (optional) ilters usage by month. Allowed values are integers between 1 and 12. Leading 0s will be ignored. :param year: (optional) Filters usage by year. Allowed values are valid years in integer form such as "2014". :param product: (optional) Filters usage by a specific “product” of TelAPI. Each product is uniquely identified by an integer. For example: Product=1, would return all outbound call usage. The integer assigned to each product is listed below. :param page: (optional) Used to return a particular page within the list. :param pageSize: (optional) Used to specify the amount of list items to return per page. :type day: int :type month: int :type year: int :type product: int :type page: int :type pageSize: int :return: `Usages` object :rtype: zang.domain.list.usages.Usages :raises ZangException: """ queryParams = { 'Day': day, 'Month': month, 'Year': year, 'Product': product, 'Page': page, 'PageSize': pageSize, } params = flatDict(queryParams) usageList = self._executor.read(('Usages', ), Usages, params=params) return usageList
def listCalls( self, to=None, from_=None, status=None, startTimeGte=None, startTimeLt=None, page=None, pageSize=None, ): """ List all calls associated with your account or filter results.filter. :param to: Filter by a specific number calls were made to. :param from: Filter by a specific number calls were made from. :param status: Filter by calls with the specified status. Allowed values are "ringing", "in-progress", "queued", "busy", "completed", "no-answer", and "failed". :param startTimeGte: Filter by start time greater or equal than :param startTimeLt: Filter by start time less than :param page: Used to return a particular page within the list. :param pageSize: Used to specify the amount of list items to return per page. :type to: str :type from: str :type status: zang.domain.enums.call_status.CallStatus :type startTimeGt: datetime.date :type startTimeLt: datetime.date :type page: int :type pageSize: int :return: An `Calls` resource. :rtype: zang.domain.list.calls.Calls :raises: ZangException """ queryParams = { 'To': to, 'From': from_, 'Status': status, 'StartTime>': startTimeGte, 'StartTime<': startTimeLt, 'Page': page, 'PageSize': pageSize, } params = flatDict(queryParams) calls = self._executor.read(('Calls', ), Calls, params) return calls
def updateAccount(self, friendlyName): """ Updates account information. :param friendlyName: The custom alias for your account. :type friendlyName: str :return: Updated `Account` object :rtype: zang.domain.account.Account :raises ZangException: """ sid = self._executor.configuration.sid bodyParams = {'FriendlyName': friendlyName} data = flatDict(bodyParams) self._executor.update(('Accounts', sid), Account, data)
def createCredentialsList(self, friendlyName): """ Creates SIP domain credentials list. :param friendlyName: A human readable name for this credential list. :type friendlyName: str :return: The created credentials list. :rtype: zang.domain.credentials_list.CredentialsList :raises ZangException: """ bodyParams = {'FriendlyName': friendlyName} data = flatDict(bodyParams) credential = self._executor.create(('SIP', 'CredentialLists'), CredentialsList, data) return credential
def sendSmsMessage(self, to, body, from_=None, statusCallback=None, statusCallbackMethod=None, allowMultiple=None): """ Sends a SMS message. :param to: Must be an SMS capable number. The value does not have to be in any specific format. :param body: Text of the SMS to be sent. :param from_: Must be a Zang number associated with your account. The value does not have to be in any specific format. :param statusCallback: The URL that will be sent information about the SMS. Url length is limited to 200 characters. :param statusCallbackMethod: The HTTP method used to request the StatusCallback. Valid parameters are GET and POST. :param allowMultiple: If the Body length is greater than 160 characters, the SMS will be sent as a multi-part SMS. Allowed values are True or False. :type to: str :type body: str :type from_: str :type statusCallback: str :type statusCallbackMethod: zang.domain.enums.http_method.HttpMethod :type allowMultiple: bool :return: The SMS message which was sent. :rtype: domain.SmsMessage :raises: ZangException """ bodyParams = { 'To': to, 'Body': body, 'From': from_, 'StatusCallback': statusCallback, 'StatusCallbackMethod': statusCallbackMethod, 'AllowMultiple': allowMultiple, } data = flatDict(bodyParams) smsMessage = self._executor.create(('SMS', 'Messages'), SmsMessage, data=data) return smsMessage
def sendMmsMessage(self, to, mediaUrl, body=None, from_=None, statusCallback=None, statusCallbackMethod=None): """ Sends a MMS message. :param to: Must be an MMS capable number. The value does not have to be in any specific format. :param mediaUrl: URL of an image to be sent. :param body: Text of the MMS to be sent. :param from_: Must be a Zang number associated with your account. The value does not have to be in any specific format. :param statusCallback: The URL that will be sent information about the MMS. Url length is limited to 200 characters. :param statusCallbackMethod: The HTTP method used to request the StatusCallback. Valid parameters are GET and POST. :type to: str :type mediaUrl: str :type body: str :type from_: str :type statusCallback: str :type statusCallbackMethod: zang.domain.enums.http_method.HttpMethod :return: The MMS message which was sent. :rtype: domain.MmsMessage :raises: ZangException """ bodyParams = { 'To': to, 'MediaUrl': mediaUrl, 'Body': body, 'From': from_, 'StatusCallback': statusCallback, 'StatusCallbackMethod': statusCallbackMethod } data = flatDict(bodyParams) mmsMessage = self._executor.create(('MMS', 'Messages'), MmsMessage, data=data) return mmsMessage
def createIpAcl(self, friendlyName): """ Create IP access control list :param friendlyName: A human-readable name associated with this IP ACL. :type page: str :return: `IpAccessControlList` object :rtype: zang.domain.ip_access_control_list.IpAccessControlList :raises ZangException: """ bodyParams = { 'FriendlyName': friendlyName, } data = flatDict(bodyParams) ipAccessControlList = self._executor.create( ('SIP', 'IpAccessControlLists'), IpAccessControlList, data) return ipAccessControlList
def listParticipants( self, conferenceSid, muted=None, deaf=None, page=None, pageSize=None, ): """ List participants in a conference. :param ConferenceSid: Conference SID. :param Muted: (optional) Filter by participants that are muted. Allowed values are "true" or "false". :param Deaf: (optional) Filter by participants that are deaf. Allowed values are "true" or "false". :param Page: (optional) Used to return a particular page within the list. :param PageSize: (optional) Used to specify the amount of list items to return per page. :type ConferenceSid: str :type Muted: bool :type Deaf: bool :type Page: int :type PageSize: int :return: List of participants :rtype: zang.domain.list.participants.Participants :raises ZangException: """ queryParams = { 'Muted': muted, 'Deaf': deaf, 'Page': page, 'PageSize': pageSize, } params = flatDict(queryParams) participants = self._executor.read(( 'Conferences', conferenceSid, 'Participants', ), Participants, params) return participants
def updateCredentialsList(self, clsId, friendlyName): """ Updates info for credentials list. :param clsId: Credentials list SID. :param friendlyName: A human readable name for this credential list. :type clsId: str :type friendlyName: str :return: The updated credentials list. :rtype: zang.domain.credentials_list.CredentialsList :raises ZangException: """ bodyParams = {'FriendlyName': friendlyName} data = flatDict(bodyParams) credentialsList = self._executor.update( ('SIP', 'CredentialLists', clsId), CredentialsList, data) return credentialsList
def viewCarrierLookup(self, phoneNumber): """ The Carrier Lookup API allows you to retrieve additional information about a phone number. :param phoneNumber: Phone numbers to do a lookup for. :type phoneNumber: str :return: `CarrierLookup` object :rtype: zang.domain.carrier_lookup.CarrierLookup :raises ZangException: """ bodyParams = { 'PhoneNumber': phoneNumber, } data = flatDict(bodyParams) carrierLookup = self._executor.update(('Lookups', 'Carrier'), CarrierLookup, data) return carrierLookup
def viewBnaLookup(self, phoneNumber): """ Shows information on billing name address for some phone number. :param phoneNumber: The number of the phone you are attempting to perform the BNA lookup on. Multiple PhoneNumbers to lookup can be specified in a single request. :type phoneNumber: str :return: `BnaLookup` object :rtype: zang.domain.bna_lookup.BnaLookup :raises ZangException: """ bodyParams = { 'PhoneNumber': phoneNumber, } data = flatDict(bodyParams) bnaLookup = self._executor.update(('Lookups', 'Bna'), BnaLookup, data) return bnaLookup
def createApplicationClient(self, applicationSid, nickName): """ Creates a new application client for your application :param applicationSid: Application SID of the client :type applicationSid: str :param nickname: Nickname for the new cliend :type nickName: str :return: The created ApplicationClient :rtype: zang.domain.ApplicationClient :raises ZangException: """ bodyParams = {'Nickname': nickName} data = flatDict(bodyParams) applicationClient = self._executor.create( ('Applications', applicationSid, 'Clients', 'Tokens'), ApplicationClient, data) return applicationClient
def mapCredentialsLists(self, domainSid, credentialListSid): """ Maps credentials list to a SIP domain. :param domainSid: Domain SID. :param credentialListSid: The SID of the credential list that you wish to associate with this domain. :rtype domainSid: str :rtype credentialListSid: str :rtype: zang.domain.credentials_list.CredentialsList :raises: ZangException """ bodyParams = {'CredentialListSid': credentialListSid} data = flatDict(bodyParams) credentialsListsList = self._executor.create( ('SIP', 'Domains', domainSid, 'CredentialListMappings'), CredentialsList, data) return credentialsListsList
def viewCnamLookup(self, phoneNumber): """ Shows a CNAM information on some phone number :param phoneNumber: The number of the phone you are attempting to perform the CNAM lookup on. Multiple PhoneNumbers to lookup can be specified in a single request. :type phoneNumber: str :return: `CnamLookup` object :rtype: zang.domain.cnam_lookup.CnamLookup :raises ZangException: """ bodyParams = { 'PhoneNumber': phoneNumber, } data = flatDict(bodyParams) cnamLookup = self._executor.update(('Lookups', 'Cnam'), CnamLookup, data) return cnamLookup
def mapIpAccessControlList(self, domainSid, ipAccessControlListSid): """ Maps IP access control list to a SIP domain. :param domainSid: Domain SID. :param ipAccessControlListSid: The Sid of the IP ACL that you wish to associate with this domain. :rtype domainSid: str :rtype ipAccessControlListSid: str :rtype: zang.domain.ip_access_control_list.IpAccessControlList :raises: ZangException """ bodyParams = {'IpAccessControlListSid': ipAccessControlListSid} data = flatDict(bodyParams) ipAccessControlList = self._executor.create( ('SIP', 'Domains', domainSid, 'IpAccessControlListMappings'), IpAccessControlList, data) return ipAccessControlList
def listSmsMessages(self, to=None, from_=None, dateSentGte=None, dateSentLt=None, page=None, pageSize=None): """ Text messages sent to and from Zang phone numbers are represented with. :param to: (optional) Lists all SMS messages sent to this number. :param from_: (optional) Lists all SMS messages sent from this number. :type dateSentGte: (optional) Filter by date sent greater or equal then :type dateSentLt: (optional) Filter by date sent less than :param pageSize: (optional) Used to specify the amount of list items to return per page. :type to: (optional) str :type from_: (optional) str :type dateSentGte: (optional) datetime.date :type dateSentLt: (optional) datetime.date :type page: (optional) int :type pageSize: (optional) int :return: A list of SmsMessage resources. :rtype: zang.domain.list.sms_messages.SmsMessages :raises: ZangException """ queryParams = { 'To': to, 'From': from_, 'DateSent>': dateSentGte, 'DateSent<': dateSentLt, 'Page': page, 'PageSize': pageSize } params = flatDict(queryParams) smsMessageList = self._executor.read(('SMS', 'Messages'), SmsMessages, params=params) return smsMessageList
def listTranscriptions( self, status=None, dateTranscribedGte=None, dateTranscribedLt=None, page=None, pageSize=None, ): """ :param status: Filter by transcriptions with a given status. Allowed values are "completed", "in-progress", and "failed". :param dateTranscribedGte: Filter by date transcribed greater or equal than :param dateTranscribedLt: filter by date transcribed less than :param page: Used to return a particular page within the list. :param pageSize: Used to specify the amount of list items to return per page. :type status: zang.domain.enums.transcription_status. TranscriptionStatus :param dateTranscribedGte: datetime.date :param dateTranscribedLt: datetime.date :type page: int :type pageSize: int :return: `Transcriptions` object :rtype: zang.domain.list.transcriptions.Transcriptions :raises ZangException: """ queryParams = { 'Status': status, 'DateTranscribed>': dateTranscribedGte, 'DateTranscribed<': dateTranscribedLt, 'Page': page, 'PageSize': pageSize, } params = flatDict(queryParams) transcriptions = self._executor.read(('Transcriptions', ), Transcriptions, params) return transcriptions