def fetch(self, country_code=values.unset, type=values.unset,
              add_ons=values.unset, add_ons_data=values.unset):
        """
        Fetch a PhoneNumberInstance

        :param unicode country_code: Optional ISO country code of the phone number.
        :param unicode type: Indicates the type of information you would like returned with your request.
        :param unicode add_ons: Indicates the particular Add-on you would like to use to get more information.
        :param dict add_ons_data: The add_ons_data

        :returns: Fetched PhoneNumberInstance
        :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberInstance
        """
        params = values.of({
            'CountryCode': country_code,
            'Type': serialize.map(type, lambda e: e),
            'AddOns': serialize.map(add_ons, lambda e: e),
        })

        params.update(serialize.prefixed_collapsible_map(add_ons_data, 'AddOns'))
        payload = self._version.fetch(
            'GET',
            self._uri,
            params=params,
        )

        return PhoneNumberInstance(self._version, payload, phone_number=self._solution['phone_number'], )
Exemple #2
0
    def fetch(self, country_code=values.unset, type=values.unset,
              add_ons=values.unset, add_ons_data=values.unset):
        """
        Fetch a PhoneNumberInstance

        :param unicode country_code: The ISO country code of the phone number
        :param unicode type: The type of information to return
        :param unicode add_ons: The unique_name of an Add-on you would like to invoke
        :param dict add_ons_data: Data specific to the add-on you would like to invoke

        :returns: Fetched PhoneNumberInstance
        :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberInstance
        """
        params = values.of({
            'CountryCode': country_code,
            'Type': serialize.map(type, lambda e: e),
            'AddOns': serialize.map(add_ons, lambda e: e),
        })

        params.update(serialize.prefixed_collapsible_map(add_ons_data, 'AddOns'))
        payload = self._version.fetch(
            'GET',
            self._uri,
            params=params,
        )

        return PhoneNumberInstance(self._version, payload, phone_number=self._solution['phone_number'], )
Exemple #3
0
    def update(self, hosted_number_order_sids=values.unset,
               address_sid=values.unset, email=values.unset, cc_emails=values.unset,
               status=values.unset):
        """
        Update the AuthorizationDocumentInstance

        :param unicode hosted_number_order_sids: A list of HostedNumberOrder sids.
        :param unicode address_sid: Address sid.
        :param unicode email: Email.
        :param unicode cc_emails: A list of emails.
        :param AuthorizationDocumentInstance.Status status: The Status of this AuthorizationDocument.

        :returns: Updated 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,
            'CcEmails': serialize.map(cc_emails, lambda e: e),
            'Status': status,
        })

        payload = self._version.update(
            'POST',
            self._uri,
            data=data,
        )

        return AuthorizationDocumentInstance(self._version, payload, sid=self._solution['sid'], )
Exemple #4
0
    def create(self, hosted_number_order_sids, address_sid, email,
               cc_emails=values.unset):
        """
        Create a new AuthorizationDocumentInstance

        :param unicode hosted_number_order_sids: A list of HostedNumberOrder sids.
        :param unicode address_sid: Address sid.
        :param unicode email: Email.
        :param unicode cc_emails: A list of emails.

        :returns: Newly 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,
            'CcEmails': serialize.map(cc_emails, lambda e: e),
        })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return AuthorizationDocumentInstance(self._version, payload, )
Exemple #5
0
    def page(self, binding_type=values.unset, identity=values.unset,
             page_token=values.unset, page_number=values.unset,
             page_size=values.unset):
        """
        Retrieve a single page of BindingInstance records from the API.
        Request is executed immediately

        :param BindingInstance.BindingType binding_type: The push technology used for the bindings returned.
        :param unicode identity: The identity
        :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 BindingInstance
        :rtype: twilio.rest.chat.v2.service.binding.BindingPage
        """
        params = values.of({
            'BindingType': serialize.map(binding_type, lambda e: e),
            'Identity': serialize.map(identity, lambda e: e),
            'PageToken': page_token,
            'Page': page_number,
            'PageSize': page_size,
        })

        response = self._version.page(
            'GET',
            self._uri,
            params=params,
        )

        return BindingPage(self._version, response, self._solution)
Exemple #6
0
    def page(self, start_date=values.unset, end_date=values.unset,
             identity=values.unset, tag=values.unset, page_token=values.unset,
             page_number=values.unset, page_size=values.unset):
        """
        Retrieve a single page of BindingInstance records from the API.
        Request is executed immediately

        :param date start_date: Only list Bindings created on or after the given date.
        :param date end_date: Only list Bindings created on or before the given date.
        :param unicode identity: Only list Bindings that have any of the specified Identities.
        :param unicode tag: Only list Bindings that have all of the specified Tags.
        :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 BindingInstance
        :rtype: twilio.rest.notify.v1.service.binding.BindingPage
        """
        params = values.of({
            'StartDate': serialize.iso8601_date(start_date),
            'EndDate': serialize.iso8601_date(end_date),
            'Identity': serialize.map(identity, lambda e: e),
            'Tag': serialize.map(tag, lambda e: e),
            'PageToken': page_token,
            'Page': page_number,
            'PageSize': page_size,
        })

        response = self._version.page(
            'GET',
            self._uri,
            params=params,
        )

        return BindingPage(self._version, response, self._solution)
    def test_does_not_change_other_types(self):
        actual = serialize.map("abc", lambda e: e * 2)
        self.assertEqual("abc", actual)

        actual = serialize.map(123, lambda e: e * 2)
        self.assertEqual(123, actual)

        actual = serialize.map({'some': 'val'}, lambda e: e * 2)
        self.assertEqual({'some': 'val'}, actual)
Exemple #8
0
    def create(self, body=values.unset, priority=values.unset, ttl=values.unset,
               title=values.unset, sound=values.unset, action=values.unset,
               data=values.unset, apn=values.unset, gcm=values.unset,
               sms=values.unset, facebook_messenger=values.unset, fcm=values.unset,
               segment=values.unset, alexa=values.unset, to_binding=values.unset,
               identity=values.unset, tag=values.unset):
        """
        Create a new NotificationInstance

        :param unicode body: The notification body text
        :param NotificationInstance.Priority priority: The priority of the notification
        :param unicode ttl: How long, in seconds, the notification is valid
        :param unicode title: The notification title
        :param unicode sound: The name of the sound to be played for the notification
        :param unicode action: The actions to display for the notification
        :param dict data: The custom key-value pairs of the notification's payload
        :param dict apn: The APNS-specific payload that overrides corresponding attributes in a generic payload for APNS Bindings
        :param dict gcm: The GCM-specific payload that overrides corresponding attributes in generic payload for GCM Bindings
        :param dict sms: The SMS-specific payload that overrides corresponding attributes in generic payload for SMS Bindings
        :param dict facebook_messenger: Deprecated
        :param dict fcm: The FCM-specific payload that overrides corresponding attributes in generic payload for FCM Bindings
        :param unicode segment: A Segment to notify
        :param dict alexa: Deprecated
        :param unicode to_binding: The destination address specified as a JSON string
        :param unicode identity: The `identity` value that identifies the new resource's User
        :param unicode tag: A tag that selects the Bindings to notify

        :returns: Newly created NotificationInstance
        :rtype: twilio.rest.notify.v1.service.notification.NotificationInstance
        """
        data = values.of({
            'Identity': serialize.map(identity, lambda e: e),
            'Tag': serialize.map(tag, lambda e: e),
            'Body': body,
            'Priority': priority,
            'Ttl': ttl,
            'Title': title,
            'Sound': sound,
            'Action': action,
            'Data': serialize.object(data),
            'Apn': serialize.object(apn),
            'Gcm': serialize.object(gcm),
            'Sms': serialize.object(sms),
            'FacebookMessenger': serialize.object(facebook_messenger),
            'Fcm': serialize.object(fcm),
            'Segment': serialize.map(segment, lambda e: e),
            'Alexa': serialize.object(alexa),
            'ToBinding': serialize.map(to_binding, lambda e: e),
        })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return NotificationInstance(self._version, payload, service_sid=self._solution['service_sid'], )
    def create(self, body=values.unset, priority=values.unset, ttl=values.unset,
               title=values.unset, sound=values.unset, action=values.unset,
               data=values.unset, apn=values.unset, gcm=values.unset,
               sms=values.unset, facebook_messenger=values.unset, fcm=values.unset,
               segment=values.unset, alexa=values.unset, to_binding=values.unset,
               identity=values.unset, tag=values.unset):
        """
        Create a new NotificationInstance

        :param unicode body: Indicates the notification body text.
        :param NotificationInstance.Priority priority: Two priorities defined: low and high.
        :param unicode ttl: This parameter specifies how long the notification is valid.
        :param unicode title: Indicates the notification title.
        :param unicode sound: Indicates a sound to be played.
        :param unicode action: Specifies the actions to be displayed for the notification.
        :param dict data: This parameter specifies the custom key-value pairs of the notification's payload.
        :param dict apn: APNS specific payload that overrides corresponding attributes in a generic payload for Bindings with the apn BindingType.
        :param dict gcm: GCM specific payload that overrides corresponding attributes in generic payload for Bindings with gcm BindingType.
        :param dict sms: SMS specific payload that overrides corresponding attributes in generic payload for Bindings with sms BindingType.
        :param dict facebook_messenger: Messenger specific payload that overrides corresponding attributes in generic payload for Bindings with facebook-messenger BindingType.
        :param dict fcm: FCM specific payload that overrides corresponding attributes in generic payload for Bindings with fcm BindingType.
        :param unicode segment: The segment
        :param dict alexa: The alexa
        :param unicode to_binding: The destination address in a JSON object.
        :param unicode identity: Delivery will be attempted only to Bindings with an Identity in this list.
        :param unicode tag: Delivery will be attempted only to Bindings that have all of the Tags in this list.

        :returns: Newly created NotificationInstance
        :rtype: twilio.rest.notify.v1.service.notification.NotificationInstance
        """
        data = values.of({
            'Identity': serialize.map(identity, lambda e: e),
            'Tag': serialize.map(tag, lambda e: e),
            'Body': body,
            'Priority': priority,
            'Ttl': ttl,
            'Title': title,
            'Sound': sound,
            'Action': action,
            'Data': serialize.object(data),
            'Apn': serialize.object(apn),
            'Gcm': serialize.object(gcm),
            'Sms': serialize.object(sms),
            'FacebookMessenger': serialize.object(facebook_messenger),
            'Fcm': serialize.object(fcm),
            'Segment': serialize.map(segment, lambda e: e),
            'Alexa': serialize.object(alexa),
            'ToBinding': serialize.map(to_binding, lambda e: e),
        })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return NotificationInstance(self._version, payload, service_sid=self._solution['service_sid'], )
Exemple #10
0
    def update(self, unique_name=values.unset, ttl=values.unset,
               status=values.unset, participants=values.unset):
        """
        Update the SessionInstance

        :param unicode unique_name: A unique, developer assigned name of this Session.
        :param unicode ttl: How long will this session stay open, in seconds.
        :param SessionInstance.Status status: The Status of this Session
        :param unicode participants: The participants

        :returns: Updated SessionInstance
        :rtype: twilio.rest.preview.proxy.service.session.SessionInstance
        """
        data = values.of({
            'UniqueName': unique_name,
            'Ttl': ttl,
            'Status': status,
            'Participants': serialize.map(participants, lambda e: e),
        })

        payload = self._version.update(
            'POST',
            self._uri,
            data=data,
        )

        return SessionInstance(
            self._version,
            payload,
            service_sid=self._solution['service_sid'],
            sid=self._solution['sid'],
        )
Exemple #11
0
    def create(self, unique_name=values.unset, date_expiry=values.unset,
               ttl=values.unset, mode=values.unset, status=values.unset,
               participants=values.unset):
        """
        Create a new 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 dict participants: The Participant objects to include in the new session

        :returns: Newly 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(
            'POST',
            self._uri,
            data=data,
        )

        return SessionInstance(self._version, payload, service_sid=self._solution['service_sid'], )
Exemple #12
0
    def page(self, identity=values.unset, segment=values.unset,
             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 unicode identity: The identity
        :param unicode segment: The segment
        :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.notify.v1.service.user.UserPage
        """
        params = values.of({
            'Identity': serialize.map(identity, lambda e: e),
            'Segment': segment,
            'PageToken': page_token,
            'Page': page_number,
            'PageSize': page_size,
        })

        response = self._version.page(
            'GET',
            self._uri,
            params=params,
        )

        return UserPage(self._version, response, self._solution)
Exemple #13
0
    def page(self, identity=values.unset, page_token=values.unset,
             page_number=values.unset, page_size=values.unset):
        """
        Retrieve a single page of InviteInstance records from the API.
        Request is executed immediately

        :param unicode identity: A unique string identifier for this User in this Service.
        :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 InviteInstance
        :rtype: twilio.rest.chat.v1.service.channel.invite.InvitePage
        """
        params = values.of({
            'Identity': serialize.map(identity, lambda e: e),
            'PageToken': page_token,
            'Page': page_number,
            'PageSize': page_size,
        })

        response = self._version.page(
            'GET',
            self._uri,
            params=params,
        )

        return InvitePage(self._version, response, self._solution)
Exemple #14
0
    def create(self, identity, binding_type, address, tag=values.unset,
               notification_protocol_version=values.unset,
               credential_sid=values.unset, endpoint=values.unset):
        """
        Create a new BindingInstance

        :param unicode identity: The Identity to which this Binding belongs to.
        :param BindingInstance.BindingType binding_type: The type of the Binding.
        :param unicode address: The address specific to the channel.
        :param unicode tag: The list of tags associated with this Binding.
        :param unicode notification_protocol_version: The version of the protocol used to send the notification.
        :param unicode credential_sid: The unique identifier of the Credential resource to be used to send notifications to this Binding.
        :param unicode endpoint: DEPRECATED*

        :returns: Newly created BindingInstance
        :rtype: twilio.rest.notify.v1.service.binding.BindingInstance
        """
        data = values.of({
            'Identity': identity,
            'BindingType': binding_type,
            'Address': address,
            'Tag': serialize.map(tag, lambda e: e),
            'NotificationProtocolVersion': notification_protocol_version,
            'CredentialSid': credential_sid,
            'Endpoint': endpoint,
        })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return BindingInstance(self._version, payload, service_sid=self._solution['service_sid'], )
    def page(self, start_date=values.unset, end_date=values.unset, tag=values.unset,
             page_token=values.unset, page_number=values.unset,
             page_size=values.unset):
        """
        Retrieve a single page of UserBindingInstance records from the API.
        Request is executed immediately

        :param date start_date: The start_date
        :param date end_date: The end_date
        :param unicode tag: The tag
        :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 UserBindingInstance
        :rtype: twilio.rest.notify.v1.service.user.user_binding.UserBindingPage
        """
        params = values.of({
            'StartDate': serialize.iso8601_date(start_date),
            'EndDate': serialize.iso8601_date(end_date),
            'Tag': serialize.map(tag, lambda e: e),
            'PageToken': page_token,
            'Page': page_number,
            'PageSize': page_size,
        })

        response = self._version.page(
            'GET',
            self._uri,
            params=params,
        )

        return UserBindingPage(self._version, response, self._solution)
Exemple #16
0
    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 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.chat.v2.service.channel.ChannelPage
        """
        params = values.of({
            'Type': serialize.map(type, lambda e: e),
            'PageToken': page_token,
            'Page': page_number,
            'PageSize': page_size,
        })

        response = self._version.page(
            'GET',
            self._uri,
            params=params,
        )

        return ChannelPage(self._version, response, self._solution)
    def create(self, phone_number, sms_capability, account_sid=values.unset,
               friendly_name=values.unset, unique_name=values.unset,
               cc_emails=values.unset, sms_url=values.unset,
               sms_method=values.unset, sms_fallback_url=values.unset,
               sms_fallback_method=values.unset, status_callback_url=values.unset,
               status_callback_method=values.unset,
               sms_application_sid=values.unset, address_sid=values.unset,
               email=values.unset, verification_type=values.unset,
               verification_document_sid=values.unset):
        """
        Create a new HostedNumberOrderInstance

        :param unicode phone_number: An E164 formatted phone number.
        :param bool sms_capability: Specify SMS capability to host.
        :param unicode account_sid: Account Sid.
        :param unicode friendly_name: A human readable description of this resource.
        :param unicode unique_name: A unique, developer assigned name of this HostedNumberOrder.
        :param unicode cc_emails: A list of emails.
        :param unicode sms_url: SMS URL.
        :param unicode sms_method: SMS Method.
        :param unicode sms_fallback_url: SMS Fallback URL.
        :param unicode sms_fallback_method: SMS Fallback Method.
        :param unicode status_callback_url: Status Callback URL.
        :param unicode status_callback_method: Status Callback Method.
        :param unicode sms_application_sid: SMS Application Sid.
        :param unicode address_sid: Address sid.
        :param unicode email: Email.
        :param HostedNumberOrderInstance.VerificationType verification_type: Verification Type.
        :param unicode verification_document_sid: Verification Document Sid

        :returns: Newly created HostedNumberOrderInstance
        :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance
        """
        data = values.of({
            'PhoneNumber': phone_number,
            'SmsCapability': sms_capability,
            'AccountSid': account_sid,
            'FriendlyName': friendly_name,
            'UniqueName': unique_name,
            'CcEmails': serialize.map(cc_emails, lambda e: e),
            'SmsUrl': sms_url,
            'SmsMethod': sms_method,
            'SmsFallbackUrl': sms_fallback_url,
            'SmsFallbackMethod': sms_fallback_method,
            'StatusCallbackUrl': status_callback_url,
            'StatusCallbackMethod': status_callback_method,
            'SmsApplicationSid': sms_application_sid,
            'AddressSid': address_sid,
            'Email': email,
            'VerificationType': verification_type,
            'VerificationDocumentSid': verification_document_sid,
        })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return HostedNumberOrderInstance(self._version, payload, )
    def create(self, body=values.unset, media_url=values.unset):
        """
        Create a new MessageInteractionInstance

        :param unicode body: Message body
        :param unicode media_url: Reserved

        :returns: Newly created MessageInteractionInstance
        :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionInstance
        """
        data = values.of({'Body': body, 'MediaUrl': serialize.map(media_url, lambda e: e), })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return MessageInteractionInstance(
            self._version,
            payload,
            service_sid=self._solution['service_sid'],
            session_sid=self._solution['session_sid'],
            participant_sid=self._solution['participant_sid'],
        )
Exemple #19
0
    def update(self, date_expiry=values.unset, ttl=values.unset, mode=values.unset,
               status=values.unset, participants=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.Mode mode: The Mode of the Session
        :param SessionInstance.Status status: The new status of the resource
        :param dict participants: The Participant objects to include in the session

        :returns: Updated SessionInstance
        :rtype: twilio.rest.proxy.v1.service.session.SessionInstance
        """
        data = values.of({
            'DateExpiry': serialize.iso8601_datetime(date_expiry),
            'Ttl': ttl,
            'Mode': mode,
            'Status': status,
            'Participants': serialize.map(participants, lambda e: serialize.object(e)),
        })

        payload = self._version.update(
            'POST',
            self._uri,
            data=data,
        )

        return SessionInstance(
            self._version,
            payload,
            service_sid=self._solution['service_sid'],
            sid=self._solution['sid'],
        )
Exemple #20
0
    def update(self, webhook_method=values.unset, webhook_filters=values.unset,
               pre_webhook_url=values.unset, post_webhook_url=values.unset,
               pre_webhook_retry_count=values.unset,
               post_webhook_retry_count=values.unset, target=values.unset):
        """
        Update the WebhookInstance

        :param unicode webhook_method: The HTTP method to be used when sending a webhook request.
        :param unicode webhook_filters: The list of webhook event triggers that are enabled for this Service.
        :param unicode pre_webhook_url: The absolute url the pre-event webhook request should be sent to.
        :param unicode post_webhook_url: The absolute url the post-event webhook request should be sent to.
        :param unicode pre_webhook_retry_count: The number of retries in case of pre-event webhook request failures.
        :param unicode post_webhook_retry_count: The number of retries in case of post-event webhook request failures.
        :param WebhookInstance.Target target: The routing target of the webhook.

        :returns: Updated WebhookInstance
        :rtype: twilio.rest.messaging.v1.webhook.WebhookInstance
        """
        data = values.of({
            'WebhookMethod': webhook_method,
            'WebhookFilters': serialize.map(webhook_filters, lambda e: e),
            'PreWebhookUrl': pre_webhook_url,
            'PostWebhookUrl': post_webhook_url,
            'PreWebhookRetryCount': pre_webhook_retry_count,
            'PostWebhookRetryCount': post_webhook_retry_count,
            'Target': target,
        })

        payload = self._version.update(
            'POST',
            self._uri,
            data=data,
        )

        return WebhookInstance(self._version, payload, )
Exemple #21
0
    def create(self, unique_name=values.unset, date_expiry=values.unset,
               ttl=values.unset, mode=values.unset, status=values.unset,
               participants=values.unset):
        """
        Create a new SessionInstance

        :param unicode unique_name: A unique, developer assigned name of this Session.
        :param datetime date_expiry: The date this Session should expire
        :param unicode ttl: TTL for a Session, in seconds.
        :param SessionInstance.Mode mode: The Mode of this Session
        :param SessionInstance.Status status: Session status
        :param dict participants: The participants

        :returns: Newly 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(
            'POST',
            self._uri,
            data=data,
        )

        return SessionInstance(self._version, payload, service_sid=self._solution['service_sid'], )
Exemple #22
0
    def create(self, identity, binding_type, address, tag=values.unset,
               notification_protocol_version=values.unset,
               credential_sid=values.unset, endpoint=values.unset):
        """
        Create a new BindingInstance

        :param unicode identity: The `identity` value that identifies the new resource's User
        :param BindingInstance.BindingType binding_type: The type of the Binding
        :param unicode address: The channel-specific address
        :param unicode tag: A tag that can be used to select the Bindings to notify
        :param unicode notification_protocol_version: The protocol version to use to send the notification
        :param unicode credential_sid: The SID of the Credential resource to be used to send notifications to this Binding
        :param unicode endpoint: Deprecated

        :returns: Newly created BindingInstance
        :rtype: twilio.rest.notify.v1.service.binding.BindingInstance
        """
        data = values.of({
            'Identity': identity,
            'BindingType': binding_type,
            'Address': address,
            'Tag': serialize.map(tag, lambda e: e),
            'NotificationProtocolVersion': notification_protocol_version,
            'CredentialSid': credential_sid,
            'Endpoint': endpoint,
        })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return BindingInstance(self._version, payload, service_sid=self._solution['service_sid'], )
Exemple #23
0
    def update(self, configuration_url=values.unset,
               configuration_method=values.unset,
               configuration_filters=values.unset,
               configuration_triggers=values.unset,
               configuration_flow_sid=values.unset,
               configuration_retry_count=values.unset,
               configuration_buffer_messages=values.unset,
               configuration_buffer_window=values.unset):
        """
        Update the WebhookInstance

        :param unicode configuration_url: The absolute url the webhook request should be sent to.
        :param WebhookInstance.Method configuration_method: The HTTP method to be used when sending a webhook request.
        :param unicode configuration_filters: The list of events, firing webhook event for this Session.
        :param unicode configuration_triggers: The list of keywords, firing webhook event for this Session.
        :param unicode configuration_flow_sid: The studio flow sid, where the webhook should be sent to.
        :param unicode configuration_retry_count: The number of retries in case of webhook request failures.
        :param bool configuration_buffer_messages: The flag whether buffering should be applied to messages.
        :param unicode configuration_buffer_window: The period of buffering messages.

        :returns: Updated WebhookInstance
        :rtype: twilio.rest.messaging.v1.session.webhook.WebhookInstance
        """
        data = values.of({
            'Configuration.Url': configuration_url,
            'Configuration.Method': configuration_method,
            'Configuration.Filters': serialize.map(configuration_filters, lambda e: e),
            'Configuration.Triggers': serialize.map(configuration_triggers, lambda e: e),
            'Configuration.FlowSid': configuration_flow_sid,
            'Configuration.RetryCount': configuration_retry_count,
            'Configuration.BufferMessages': configuration_buffer_messages,
            'Configuration.BufferWindow': configuration_buffer_window,
        })

        payload = self._version.update(
            'POST',
            self._uri,
            data=data,
        )

        return WebhookInstance(
            self._version,
            payload,
            session_sid=self._solution['session_sid'],
            sid=self._solution['sid'],
        )
Exemple #24
0
    def create(self, to, status_callback=values.unset, application_sid=values.unset,
               max_price=values.unset, provide_feedback=values.unset,
               validity_period=values.unset, max_rate=values.unset,
               force_delivery=values.unset, provider_sid=values.unset,
               content_retention=values.unset, address_retention=values.unset,
               smart_encoded=values.unset, from_=values.unset,
               messaging_service_sid=values.unset, body=values.unset,
               media_url=values.unset):
        """
        Create a new MessageInstance

        :param unicode to: The phone number to receive the message
        :param unicode status_callback: URL Twilio will request when the status changes
        :param unicode application_sid: The application to use for callbacks
        :param unicode max_price: The total maximum price up to the fourth decimal in US dollars acceptable for the message to be delivered.
        :param bool provide_feedback: Set this value to true if you are sending messages that have a trackable user action and you intend to confirm delivery of the message using the Message Feedback API.
        :param unicode validity_period: The number of seconds that the message can remain in a Twilio queue.
        :param unicode max_rate: The max_rate
        :param bool force_delivery: The force_delivery
        :param unicode provider_sid: The provider_sid
        :param MessageInstance.ContentRetention content_retention: The content_retention
        :param MessageInstance.AddressRetention address_retention: The address_retention
        :param bool smart_encoded: The smart_encoded
        :param unicode from_: The phone number that initiated the message
        :param unicode messaging_service_sid: The 34 character unique id of the Messaging Service you want to associate with this Message.
        :param unicode body: The text of the message you want to send, limited to 1600 characters.
        :param unicode media_url: The URL of the media you wish to send out with the message.

        :returns: Newly 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,
            'ValidityPeriod': validity_period,
            'MaxRate': max_rate,
            'ForceDelivery': force_delivery,
            'ProviderSid': provider_sid,
            'ContentRetention': content_retention,
            'AddressRetention': address_retention,
            'SmartEncoded': smart_encoded,
        })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return MessageInstance(self._version, payload, account_sid=self._solution['account_sid'], )
Exemple #25
0
    def create(self, type, configuration_url=values.unset,
               configuration_method=values.unset,
               configuration_filters=values.unset,
               configuration_triggers=values.unset,
               configuration_flow_sid=values.unset,
               configuration_retry_count=values.unset):
        """
        Create a new WebhookInstance

        :param WebhookInstance.Type type: The type of webhook
        :param unicode configuration_url: The URL of the webhook to call
        :param WebhookInstance.Method configuration_method: The HTTP method used to call `configuration.url`
        :param unicode configuration_filters: The events that cause us to call the Channel Webhook
        :param unicode configuration_triggers: A string that will cause us to call the webhook when it is found in a message body
        :param unicode configuration_flow_sid: The SID of the Studio Flow to call when an event occurs
        :param unicode configuration_retry_count: The number of times to retry the webhook if the first attempt fails

        :returns: Newly created WebhookInstance
        :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookInstance
        """
        data = values.of({
            'Type': type,
            'Configuration.Url': configuration_url,
            'Configuration.Method': configuration_method,
            'Configuration.Filters': serialize.map(configuration_filters, lambda e: e),
            'Configuration.Triggers': serialize.map(configuration_triggers, lambda e: e),
            'Configuration.FlowSid': configuration_flow_sid,
            'Configuration.RetryCount': configuration_retry_count,
        })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return WebhookInstance(
            self._version,
            payload,
            service_sid=self._solution['service_sid'],
            channel_sid=self._solution['channel_sid'],
        )
Exemple #26
0
    def create(self, type, configuration_url=values.unset,
               configuration_method=values.unset,
               configuration_filters=values.unset,
               configuration_triggers=values.unset,
               configuration_flow_sid=values.unset,
               configuration_retry_count=values.unset):
        """
        Create a new WebhookInstance

        :param WebhookInstance.Type type: The type
        :param unicode configuration_url: The configuration.url
        :param WebhookInstance.Method configuration_method: The configuration.method
        :param unicode configuration_filters: The configuration.filters
        :param unicode configuration_triggers: The configuration.triggers
        :param unicode configuration_flow_sid: The configuration.flow_sid
        :param unicode configuration_retry_count: The configuration.retry_count

        :returns: Newly created WebhookInstance
        :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookInstance
        """
        data = values.of({
            'Type': type,
            'Configuration.Url': configuration_url,
            'Configuration.Method': configuration_method,
            'Configuration.Filters': serialize.map(configuration_filters, lambda e: e),
            'Configuration.Triggers': serialize.map(configuration_triggers, lambda e: e),
            'Configuration.FlowSid': configuration_flow_sid,
            'Configuration.RetryCount': configuration_retry_count,
        })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return WebhookInstance(
            self._version,
            payload,
            service_sid=self._solution['service_sid'],
            channel_sid=self._solution['channel_sid'],
        )
    def create(self, friendly_name, enabled=values.unset, 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 a new CompositionHookInstance

        :param unicode friendly_name: Friendly name of the Composition Hook to be shown in the console.
        :param bool enabled: Boolean flag indicating if the Composition Hook is active.
        :param dict video_layout: The JSON video layout description.
        :param unicode audio_sources: A list of audio sources related to this Composition Hook.
        :param unicode audio_sources_excluded: A list of audio sources excluded related to this Composition Hook.
        :param unicode resolution: Pixel resolution of the composed video.
        :param CompositionHookInstance.Format format: Container format of the Composition Hook media file. Any of the following: `mp4`, `webm`.
        :param unicode status_callback: A URL that Twilio sends asynchronous webhook requests to on every composition event.
        :param unicode status_callback_method: HTTP method Twilio should use when requesting the above URL.
        :param bool trim: Boolean flag for clipping intervals that have no media.

        :returns: Newly created CompositionHookInstance
        :rtype: twilio.rest.video.v1.composition_hook.CompositionHookInstance
        """
        data = values.of({
            'FriendlyName': friendly_name,
            'Enabled': enabled,
            '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(
            'POST',
            self._uri,
            data=data,
        )

        return CompositionHookInstance(self._version, payload, )
Exemple #28
0
    def page(self,
             start_date=values.unset,
             end_date=values.unset,
             identity=values.unset,
             tag=values.unset,
             page_token=values.unset,
             page_number=values.unset,
             page_size=values.unset):
        """
        Retrieve a single page of BindingInstance records from the API.
        Request is executed immediately

        :param date start_date: The start_date
        :param date end_date: The end_date
        :param unicode identity: The identity
        :param unicode tag: The tag
        :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 BindingInstance
        :rtype: twilio.rest.notify.v1.service.binding.BindingPage
        """
        params = values.of({
            'StartDate': serialize.iso8601_date(start_date),
            'EndDate': serialize.iso8601_date(end_date),
            'Identity': serialize.map(identity, lambda e: e),
            'Tag': serialize.map(tag, lambda e: e),
            'PageToken': page_token,
            'Page': page_number,
            'PageSize': page_size,
        })

        response = self._version.page(
            'GET',
            self._uri,
            params=params,
        )

        return BindingPage(self._version, response, self._solution)
Exemple #29
0
    def create(self, audio_sources=values.unset, video_sources=values.unset,
               video_layout=values.unset, resolution=values.unset,
               format=values.unset, desired_bitrate=values.unset,
               desired_max_duration=values.unset, status_callback=values.unset,
               status_callback_method=values.unset):
        """
        Create a new CompositionInstance

        :param unicode audio_sources: The audio_sources
        :param unicode video_sources: The video_sources
        :param CompositionInstance.VideoLayout video_layout: The video_layout
        :param unicode resolution: The resolution
        :param CompositionInstance.Format format: The format
        :param unicode desired_bitrate: The desired_bitrate
        :param unicode desired_max_duration: The desired_max_duration
        :param unicode status_callback: The status_callback
        :param unicode status_callback_method: The status_callback_method

        :returns: Newly created CompositionInstance
        :rtype: twilio.rest.video.v1.composition.CompositionInstance
        """
        data = values.of({
            'AudioSources': serialize.map(audio_sources, lambda e: e),
            'VideoSources': serialize.map(video_sources, lambda e: e),
            'VideoLayout': video_layout,
            'Resolution': resolution,
            'Format': format,
            'DesiredBitrate': desired_bitrate,
            'DesiredMaxDuration': desired_max_duration,
            'StatusCallback': status_callback,
            'StatusCallbackMethod': status_callback_method,
        })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return CompositionInstance(self._version, payload, )
Exemple #30
0
    def page(self,
             start_date=values.unset,
             end_date=values.unset,
             identity=values.unset,
             tag=values.unset,
             page_token=values.unset,
             page_number=values.unset,
             page_size=values.unset):
        """
        Retrieve a single page of BindingInstance records from the API.
        Request is executed immediately

        :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 unicode identity: The `identity` value of the resources to read
        :param unicode tag: Only list Bindings that have all of the specified Tags
        :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 BindingInstance
        :rtype: twilio.rest.notify.v1.service.binding.BindingPage
        """
        data = values.of({
            'StartDate': serialize.iso8601_date(start_date),
            'EndDate': serialize.iso8601_date(end_date),
            'Identity': serialize.map(identity, lambda e: e),
            'Tag': serialize.map(tag, lambda e: e),
            'PageToken': page_token,
            'Page': page_number,
            'PageSize': page_size,
        })

        response = self._version.page(
            method='GET',
            uri=self._uri,
            params=data,
        )

        return BindingPage(self._version, response, self._solution)
Exemple #31
0
    def create(self, room_sid=values.unset, 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 a new CompositionInstance

        :param unicode room_sid: The room_sid
        :param dict video_layout: The video_layout
        :param unicode audio_sources: The audio_sources
        :param unicode audio_sources_excluded: The audio_sources_excluded
        :param unicode resolution: The resolution
        :param CompositionInstance.Format format: The format
        :param unicode status_callback: The status_callback
        :param unicode status_callback_method: The status_callback_method
        :param bool trim: The trim

        :returns: Newly 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(
            'POST',
            self._uri,
            data=data,
        )

        return CompositionInstance(self._version, payload, )
Exemple #32
0
    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 a new 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 unicode audio_sources: An array of track names from the same group room to merge
        :param 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: Newly 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(
            'POST',
            self._uri,
            data=data,
        )

        return CompositionInstance(self._version, payload, )
Exemple #33
0
    def create(self, room_sid=values.unset, 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 a new CompositionInstance

        :param unicode room_sid: Twilio Room SID.
        :param dict video_layout: The JSON video layout description.
        :param unicode audio_sources: A list of audio sources related to this Composition.
        :param unicode audio_sources_excluded: A list of audio sources excluded related to this Composition.
        :param unicode resolution: Pixel resolution of the composed video.
        :param CompositionInstance.Format format: ontainer format of the Composition media file. Any of the following: `mp4`, `webm`.
        :param unicode status_callback: A URL that Twilio sends asynchronous webhook requests to on every composition event.
        :param unicode status_callback_method: HTTP method Twilio should use when requesting the above URL.
        :param bool trim: Boolean flag for clipping intervals that have no media.

        :returns: Newly 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(
            'POST',
            self._uri,
            data=data,
        )

        return CompositionInstance(self._version, payload, )
    def update(self,
               friendly_name=values.unset,
               unique_name=values.unset,
               email=values.unset,
               cc_emails=values.unset,
               status=values.unset,
               verification_code=values.unset,
               verification_type=values.unset,
               verification_document_sid=values.unset,
               extension=values.unset,
               call_delay=values.unset):
        """
        Update the HostedNumberOrderInstance

        :param unicode friendly_name: A human readable description of this resource.
        :param unicode unique_name: A unique, developer assigned name of this HostedNumberOrder.
        :param unicode email: Email.
        :param unicode cc_emails: A list of emails.
        :param HostedNumberOrderInstance.Status status: The Status of this HostedNumberOrder.
        :param unicode verification_code: A verification code.
        :param HostedNumberOrderInstance.VerificationType verification_type: Verification Type.
        :param unicode verification_document_sid: Verification Document Sid
        :param unicode extension: Digits to dial after connecting the verification call.
        :param unicode call_delay: The number of seconds, between 0 and 60, to delay before initiating the verification call.

        :returns: The updated HostedNumberOrderInstance
        :rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance
        """
        data = values.of({
            'FriendlyName': friendly_name,
            'UniqueName': unique_name,
            'Email': email,
            'CcEmails': serialize.map(cc_emails, lambda e: e),
            'Status': status,
            'VerificationCode': verification_code,
            'VerificationType': verification_type,
            'VerificationDocumentSid': verification_document_sid,
            'Extension': extension,
            'CallDelay': call_delay,
        })

        payload = self._version.update(
            method='POST',
            uri=self._uri,
            data=data,
        )

        return HostedNumberOrderInstance(
            self._version,
            payload,
            sid=self._solution['sid'],
        )
Exemple #35
0
    def create(self, to, status_callback=values.unset, application_sid=values.unset,
               max_price=values.unset, provide_feedback=values.unset,
               validity_period=values.unset, force_delivery=values.unset,
               smart_encoded=values.unset, interactive_data=values.unset,
               force_opt_in=values.unset, from_=values.unset,
               messaging_service_sid=values.unset, body=values.unset,
               media_url=values.unset):
        """
        Create a new 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 validity_period: The number of seconds that the message can remain in our outgoing queue.
        :param bool force_delivery: Reserved
        :param bool smart_encoded: Whether to detect Unicode characters that have a similar GSM-7 character and replace them
        :param unicode interactive_data: A JSON string that represents an interactive message
        :param bool force_opt_in: Whether to forcefully whitelist a from:to pair
        :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 unicode media_url: The URL of the media to send with the message

        :returns: Newly 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,
            'ValidityPeriod': validity_period,
            'ForceDelivery': force_delivery,
            'SmartEncoded': smart_encoded,
            'InteractiveData': interactive_data,
            'ForceOptIn': force_opt_in,
        })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return MessageInstance(self._version, payload, account_sid=self._solution['account_sid'], )
Exemple #36
0
    def create(self, to, status_callback=values.unset, application_sid=values.unset,
               max_price=values.unset, provide_feedback=values.unset,
               validity_period=values.unset, force_delivery=values.unset,
               smart_encoded=values.unset, interactive_data=values.unset,
               force_opt_in=values.unset, from_=values.unset,
               messaging_service_sid=values.unset, body=values.unset,
               media_url=values.unset):
        """
        Create a new 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 validity_period: The number of seconds that the message can remain in our outgoing queue.
        :param bool force_delivery: Reserved
        :param bool smart_encoded: Whether to detect Unicode characters that have a similar GSM-7 character and replace them
        :param unicode interactive_data: A JSON string that represents an interactive message
        :param bool force_opt_in: Whether to forcefully whitelist a from:to pair
        :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 unicode media_url: The URL of the media to send with the message

        :returns: Newly 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,
            'ValidityPeriod': validity_period,
            'ForceDelivery': force_delivery,
            'SmartEncoded': smart_encoded,
            'InteractiveData': interactive_data,
            'ForceOptIn': force_opt_in,
        })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return MessageInstance(self._version, payload, account_sid=self._solution['account_sid'], )
Exemple #37
0
    def page(self,
             binding_type=values.unset,
             identity=values.unset,
             page_token=values.unset,
             page_number=values.unset,
             page_size=values.unset):
        """
        Retrieve a single page of BindingInstance records from the API.
        Request is executed immediately

        :param list[BindingInstance.BindingType] binding_type: The push technology used by the Binding resources to read.
        :param list[unicode] identity: The identity of Conversation User associated with this binding.
        :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 BindingInstance
        :rtype: twilio.rest.conversations.v1.service.binding.BindingPage
        """
        data = values.of({
            'BindingType':
            serialize.map(binding_type, lambda e: e),
            'Identity':
            serialize.map(identity, lambda e: e),
            'PageToken':
            page_token,
            'Page':
            page_number,
            'PageSize':
            page_size,
        })

        response = self._version.page(
            method='GET',
            uri=self._uri,
            params=data,
        )

        return BindingPage(self._version, response, self._solution)
Exemple #38
0
    def page(self,
             binding_type=values.unset,
             identity=values.unset,
             page_token=values.unset,
             page_number=values.unset,
             page_size=values.unset):
        """
        Retrieve a single page of BindingInstance records from the API.
        Request is executed immediately

        :param BindingInstance.BindingType binding_type: The push technology used by the Binding resources to read
        :param unicode identity: The `identity` value 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 BindingInstance
        :rtype: twilio.rest.chat.v2.service.binding.BindingPage
        """
        params = values.of({
            'BindingType':
            serialize.map(binding_type, lambda e: e),
            'Identity':
            serialize.map(identity, lambda e: e),
            'PageToken':
            page_token,
            'Page':
            page_number,
            'PageSize':
            page_size,
        })

        response = self._version.page(
            'GET',
            self._uri,
            params=params,
        )

        return BindingPage(self._version, response, self._solution)
Exemple #39
0
    def page(self,
             status=values.unset,
             source_sid=values.unset,
             grouping_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 RecordingInstance records from the API.
        Request is executed immediately

        :param RecordingInstance.Status status: Only show Recordings with the given status.
        :param unicode source_sid: Only show the Recordings with the given source Sid.
        :param unicode grouping_sid: Only show Recordings that have this GroupingSid.
        :param datetime date_created_after: Only show Recordings that started on or after this ISO8601 date-time.
        :param datetime date_created_before: Only show Recordings that started before this this ISO8601 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 RecordingInstance
        :rtype: twilio.rest.video.v1.recording.RecordingPage
        """
        params = 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),
            'PageToken':
            page_token,
            'Page':
            page_number,
            'PageSize':
            page_size,
        })

        response = self._version.page(
            'GET',
            self._uri,
            params=params,
        )

        return RecordingPage(self._version, response, self._solution)
Exemple #40
0
    def create(self, target, configuration_url=values.unset,
               configuration_method=values.unset,
               configuration_filters=values.unset,
               configuration_triggers=values.unset,
               configuration_flow_sid=values.unset,
               configuration_replay_after=values.unset):
        """
        Create the WebhookInstance

        :param WebhookInstance.Target target: The target of this webhook.
        :param unicode configuration_url: The absolute url the webhook request should be sent to.
        :param WebhookInstance.Method configuration_method: The HTTP method to be used when sending a webhook request.
        :param list[unicode] configuration_filters: The list of events, firing webhook event for this Conversation.
        :param list[unicode] configuration_triggers: The list of keywords, firing webhook event for this Conversation.
        :param unicode configuration_flow_sid: The studio flow SID, where the webhook should be sent to.
        :param unicode configuration_replay_after: The message index for which and it's successors the webhook will be replayed.

        :returns: The created WebhookInstance
        :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookInstance
        """
        data = values.of({
            'Target': target,
            'Configuration.Url': configuration_url,
            'Configuration.Method': configuration_method,
            'Configuration.Filters': serialize.map(configuration_filters, lambda e: e),
            'Configuration.Triggers': serialize.map(configuration_triggers, lambda e: e),
            'Configuration.FlowSid': configuration_flow_sid,
            'Configuration.ReplayAfter': configuration_replay_after,
        })

        payload = self._version.create(method='POST', uri=self._uri, data=data, )

        return WebhookInstance(
            self._version,
            payload,
            chat_service_sid=self._solution['chat_service_sid'],
            conversation_sid=self._solution['conversation_sid'],
        )
Exemple #41
0
    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'],
        )
Exemple #42
0
    def create(self, type, configuration_url=values.unset,
               configuration_method=values.unset,
               configuration_filters=values.unset,
               configuration_triggers=values.unset,
               configuration_flow_sid=values.unset,
               configuration_retry_count=values.unset):
        """
        Create the WebhookInstance

        :param WebhookInstance.Type type: The type
        :param unicode configuration_url: The configuration.url
        :param WebhookInstance.Method configuration_method: The configuration.method
        :param list[unicode] configuration_filters: The configuration.filters
        :param list[unicode] configuration_triggers: The configuration.triggers
        :param unicode configuration_flow_sid: The configuration.flow_sid
        :param unicode configuration_retry_count: The configuration.retry_count

        :returns: The created WebhookInstance
        :rtype: twilio.rest.ip_messaging.v2.service.channel.webhook.WebhookInstance
        """
        data = values.of({
            'Type': type,
            'Configuration.Url': configuration_url,
            'Configuration.Method': configuration_method,
            'Configuration.Filters': serialize.map(configuration_filters, lambda e: e),
            'Configuration.Triggers': serialize.map(configuration_triggers, lambda e: e),
            'Configuration.FlowSid': configuration_flow_sid,
            'Configuration.RetryCount': configuration_retry_count,
        })

        payload = self._version.create(method='POST', uri=self._uri, data=data, )

        return WebhookInstance(
            self._version,
            payload,
            service_sid=self._solution['service_sid'],
            channel_sid=self._solution['channel_sid'],
        )
Exemple #43
0
    def create(self, friendly_name, enabled=values.unset, 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 CompositionHookInstance

        :param unicode friendly_name: A unique string to describe the resource
        :param bool enabled: Whether the composition hook is active
        :param dict video_layout: An object that describes the video layout of the composition hook
        :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 rows (width) and columns (height) of the generated composed video in pixels
        :param CompositionHookInstance.Format format: The container format of the media files used by the compositions created by the composition hook
        :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 Compositions triggered by the composition hook

        :returns: The created CompositionHookInstance
        :rtype: twilio.rest.video.v1.composition_hook.CompositionHookInstance
        """
        data = values.of({
            'FriendlyName': friendly_name,
            'Enabled': enabled,
            '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 CompositionHookInstance(self._version, payload, )
Exemple #44
0
    def create(self, type, configuration_url=values.unset,
               configuration_method=values.unset,
               configuration_filters=values.unset,
               configuration_triggers=values.unset,
               configuration_flow_sid=values.unset,
               configuration_retry_count=values.unset):
        """
        Create the WebhookInstance

        :param WebhookInstance.Type type: The type of webhook
        :param unicode configuration_url: The URL of the webhook to call
        :param WebhookInstance.Method configuration_method: The HTTP method used to call `configuration.url`
        :param list[unicode] configuration_filters: The events that cause us to call the Channel Webhook
        :param list[unicode] configuration_triggers: A string that will cause us to call the webhook when it is found in a message body
        :param unicode configuration_flow_sid: The SID of the Studio Flow to call when an event occurs
        :param unicode configuration_retry_count: The number of times to retry the webhook if the first attempt fails

        :returns: The created WebhookInstance
        :rtype: twilio.rest.chat.v2.service.channel.webhook.WebhookInstance
        """
        data = values.of({
            'Type': type,
            'Configuration.Url': configuration_url,
            'Configuration.Method': configuration_method,
            'Configuration.Filters': serialize.map(configuration_filters, lambda e: e),
            'Configuration.Triggers': serialize.map(configuration_triggers, lambda e: e),
            'Configuration.FlowSid': configuration_flow_sid,
            'Configuration.RetryCount': configuration_retry_count,
        })

        payload = self._version.create(method='POST', uri=self._uri, data=data, )

        return WebhookInstance(
            self._version,
            payload,
            service_sid=self._solution['service_sid'],
            channel_sid=self._solution['channel_sid'],
        )
Exemple #45
0
    def test_update_request(self):
        self.holodeck.mock(Response(500, ''))

        with self.assertRaises(TwilioException):
            self.client.ip_messaging.v2.services(sid="ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
                                       .roles(sid="RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").update(permission=['permission'])

        values = {'Permission': serialize.map(['permission'], lambda e: e), }

        self.holodeck.assert_has_request(Request(
            'post',
            'https://ip-messaging.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles/RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
            data=values,
        ))
Exemple #46
0
    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'], )
Exemple #47
0
    def fetch(self, country_code=values.unset, type=values.unset,
              add_ons=values.unset, add_ons_data=values.unset):
        """
        Fetch the PhoneNumberInstance

        :param unicode country_code: The ISO country code of the phone number
        :param unicode type: The type of information to return
        :param unicode add_ons: The unique_name of an Add-on you would like to invoke
        :param dict add_ons_data: Data specific to the add-on you would like to invoke

        :returns: The fetched PhoneNumberInstance
        :rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberInstance
        """
        data = values.of({
            'CountryCode': country_code,
            'Type': serialize.map(type, lambda e: e),
            'AddOns': serialize.map(add_ons, lambda e: e),
        })
        data.update(serialize.prefixed_collapsible_map(add_ons_data, 'AddOns'))

        payload = self._version.fetch(method='GET', uri=self._uri, params=data, )

        return PhoneNumberInstance(self._version, payload, phone_number=self._solution['phone_number'], )
Exemple #48
0
    def update(self, permission):
        """
        Update the RoleInstance

        :param unicode permission: A permission the role should have

        :returns: The updated RoleInstance
        :rtype: twilio.rest.conversations.v1.role.RoleInstance
        """
        data = values.of({'Permission': serialize.map(permission, lambda e: e), })

        payload = self._version.update(method='POST', uri=self._uri, data=data, )

        return RoleInstance(self._version, payload, sid=self._solution['sid'], )
Exemple #49
0
    def create(self,
               unique_name=values.unset,
               date_expiry=values.unset,
               ttl=values.unset,
               mode=values.unset,
               status=values.unset,
               participants=values.unset,
               fail_on_participant_conflict=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 dict participants: The Participant objects to include in the new session
        :param bool fail_on_participant_conflict: An experimental parameter to override the ProxyAllowParticipantConflict account flag on a per-request basis.

        :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)),
            'FailOnParticipantConflict':
            fail_on_participant_conflict,
        })

        payload = self._version.create(
            method='POST',
            uri=self._uri,
            data=data,
        )

        return SessionInstance(
            self._version,
            payload,
            service_sid=self._solution['service_sid'],
        )
    def test_update_request(self):
        self.holodeck.mock(Response(500, ''))

        with self.assertRaises(TwilioException):
            self.client.chat.v1.services(sid="ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \
                               .roles(sid="RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(permission=['permission'])

        values = {'Permission': serialize.map(['permission'], lambda e: e), }

        self.holodeck.assert_has_request(Request(
            'post',
            'https://chat.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Roles/RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
            data=values,
        ))
Exemple #51
0
    def create(self,
               hosted_number_order_sids,
               address_sid,
               email,
               cc_emails=values.unset):
        """
        Create a new AuthorizationDocumentInstance

        :param unicode hosted_number_order_sids: A list of HostedNumberOrder sids.
        :param unicode address_sid: Address sid.
        :param unicode email: Email.
        :param unicode cc_emails: A list of emails.

        :returns: Newly 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,
            'CcEmails':
            serialize.map(cc_emails, lambda e: e),
        })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return AuthorizationDocumentInstance(
            self._version,
            payload,
        )
Exemple #52
0
    def create(self,
               factor_sid,
               expiration_date=values.unset,
               details_message=values.unset,
               details_fields=values.unset,
               hidden_details=values.unset,
               twilio_sandbox_mode=values.unset):
        """
        Create the ChallengeInstance

        :param unicode factor_sid: Factor Sid.
        :param datetime expiration_date: The future date in which this Challenge will expire
        :param unicode details_message: Shown to the user when the push notification arrives
        :param 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 twilio_sandbox_mode: The Twilio-Sandbox-Mode HTTP request header

        :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),
        })
        headers = values.of({
            'Twilio-Sandbox-Mode': twilio_sandbox_mode,
        })

        payload = self._version.create(
            method='POST',
            uri=self._uri,
            data=data,
            headers=headers,
        )

        return ChallengeInstance(
            self._version,
            payload,
            service_sid=self._solution['service_sid'],
            identity=self._solution['identity'],
        )
Exemple #53
0
    def update(self,
               webhook_method=values.unset,
               webhook_filters=values.unset,
               pre_webhook_url=values.unset,
               post_webhook_url=values.unset,
               pre_webhook_retry_count=values.unset,
               post_webhook_retry_count=values.unset,
               target=values.unset):
        """
        Update the WebhookInstance

        :param unicode webhook_method: The HTTP method to use when sending a webhook request
        :param unicode webhook_filters: The list of webhook event triggers that are enabled for the Service
        :param unicode pre_webhook_url: The absolute URL of the pre-event webhook
        :param unicode post_webhook_url: The absolute URL of the post-event webhook
        :param unicode pre_webhook_retry_count: The number of times to try the pre-event webhook request if the first attempt fails
        :param unicode post_webhook_retry_count: The number of times to try the post-event webhook request if the first attempt fails
        :param WebhookInstance.Target target: The routing target of the webhook

        :returns: Updated WebhookInstance
        :rtype: twilio.rest.messaging.v1.webhook.WebhookInstance
        """
        data = values.of({
            'WebhookMethod':
            webhook_method,
            'WebhookFilters':
            serialize.map(webhook_filters, lambda e: e),
            'PreWebhookUrl':
            pre_webhook_url,
            'PostWebhookUrl':
            post_webhook_url,
            'PreWebhookRetryCount':
            pre_webhook_retry_count,
            'PostWebhookRetryCount':
            post_webhook_retry_count,
            'Target':
            target,
        })

        payload = self._version.update(
            'POST',
            self._uri,
            data=data,
        )

        return WebhookInstance(
            self._version,
            payload,
        )
Exemple #54
0
    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: Retrieve the list of all Tasks in the workspace with the specified priority.
        :param unicode assignment_status: Returns the list of all Tasks in the workspace with the specified AssignmentStatus.
        :param unicode workflow_sid: Returns the list of Tasks that are being controlled by the Workflow with the specified Sid value.
        :param unicode workflow_name: Returns the list of Tasks that are being controlled by the Workflow with the specified FriendlyName value.
        :param unicode task_queue_sid: Returns the list of Tasks that are currently waiting in the TaskQueue identified by the Sid specified.
        :param unicode task_queue_name: Returns the list of Tasks that are currently waiting in the TaskQueue identified by the FriendlyName specified.
        :param unicode evaluate_task_attributes: Provide a task attributes expression, and this will return tasks which match the attributes.
        :param unicode ordering: Use this parameter to control the order of the Tasks returned.
        :param bool has_addons: The has_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
        """
        params = 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(
            'GET',
            self._uri,
            params=params,
        )

        return TaskPage(self._version, response, self._solution)
Exemple #55
0
    def create(self,
               recording_status_callback_event=values.unset,
               recording_status_callback=values.unset,
               recording_status_callback_method=values.unset,
               trim=values.unset,
               recording_channels=values.unset,
               play_beep=values.unset):
        """
        Create a new RecordingInstance

        :param unicode recording_status_callback_event: The recording_status_callback_event
        :param unicode recording_status_callback: The recording_status_callback
        :param unicode recording_status_callback_method: The recording_status_callback_method
        :param unicode trim: Whether to trim the silence in the recording
        :param unicode recording_channels: The recording_channels
        :param bool play_beep: Whether to play beeps for recording status changes

        :returns: Newly created RecordingInstance
        :rtype: twilio.rest.api.v2010.account.call.recording.RecordingInstance
        """
        data = values.of({
            'RecordingStatusCallbackEvent':
            serialize.map(recording_status_callback_event, lambda e: e),
            'RecordingStatusCallback':
            recording_status_callback,
            'RecordingStatusCallbackMethod':
            recording_status_callback_method,
            'Trim':
            trim,
            'RecordingChannels':
            recording_channels,
            'PlayBeep':
            play_beep,
        })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return RecordingInstance(
            self._version,
            payload,
            account_sid=self._solution['account_sid'],
            call_sid=self._solution['call_sid'],
        )
    def update(self,
               unique_name=values.unset,
               date_expiry=values.unset,
               ttl=values.unset,
               mode=values.unset,
               status=values.unset,
               participants=values.unset):
        """
        Update the SessionInstance

        :param unicode unique_name: A unique, developer assigned name of this Session.
        :param datetime date_expiry: The date this Session was expiry
        :param unicode ttl: TTL for a Session, in seconds.
        :param SessionInstance.Mode mode: The Mode of this Session
        :param SessionInstance.Status status: The Status of this Session
        :param dict participants: A list of phone numbers to add to this Session.

        :returns: Updated 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.update(
            'POST',
            self._uri,
            data=data,
        )

        return SessionInstance(
            self._version,
            payload,
            service_sid=self._solution['service_sid'],
            sid=self._solution['sid'],
        )
    def create(self,
               recording_status_callback_event=values.unset,
               recording_status_callback=values.unset,
               recording_status_callback_method=values.unset,
               trim=values.unset,
               recording_channels=values.unset,
               recording_track=values.unset):
        """
        Create the RecordingInstance

        :param list[unicode] recording_status_callback_event: The recording status changes that should generate a callback
        :param unicode recording_status_callback: The callback URL on each selected recording event
        :param unicode recording_status_callback_method: The HTTP method we should use to call `recording_status_callback`
        :param unicode trim: Whether to trim the silence in the recording
        :param unicode recording_channels: The number of channels that the output recording will be configured with
        :param unicode recording_track: Which track(s) to record

        :returns: The created RecordingInstance
        :rtype: twilio.rest.api.v2010.account.call.recording.RecordingInstance
        """
        data = values.of({
            'RecordingStatusCallbackEvent':
            serialize.map(recording_status_callback_event, lambda e: e),
            'RecordingStatusCallback':
            recording_status_callback,
            'RecordingStatusCallbackMethod':
            recording_status_callback_method,
            'Trim':
            trim,
            'RecordingChannels':
            recording_channels,
            'RecordingTrack':
            recording_track,
        })

        payload = self._version.create(
            method='POST',
            uri=self._uri,
            data=data,
        )

        return RecordingInstance(
            self._version,
            payload,
            account_sid=self._solution['account_sid'],
            call_sid=self._solution['call_sid'],
        )
    def test_create_request(self):
        self.holodeck.mock(Response(500, ''))

        with self.assertRaises(TwilioException):
            self.client.events.v1.subscriptions.create(description="description", sink_sid="DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", types=[{}])

        values = {
            'Description': "description",
            'SinkSid': "DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
            'Types': serialize.map([{}], lambda e: serialize.object(e)),
        }

        self.holodeck.assert_has_request(Request(
            'post',
            'https://events.twilio.com/v1/Subscriptions',
            data=values,
        ))
Exemple #59
0
    def create(self,
               unique_name=values.unset,
               date_expiry=values.unset,
               ttl=values.unset,
               mode=values.unset,
               status=values.unset,
               participants=values.unset):
        """
        Create a new 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 dict participants: The Participant objects to include in the new session

        :returns: Newly 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(
            'POST',
            self._uri,
            data=data,
        )

        return SessionInstance(
            self._version,
            payload,
            service_sid=self._solution['service_sid'],
        )