def update(self, friendly_name=values.unset, log_queries=values.unset, unique_name=values.unset, callback_url=values.unset, callback_events=values.unset, style_sheet=values.unset, defaults=values.unset): """ Update the AssistantInstance :param unicode friendly_name: A string to describe the resource :param bool log_queries: Whether queries should be logged and kept after training :param unicode unique_name: An application-defined string that uniquely identifies the resource :param unicode callback_url: Reserved :param unicode callback_events: Reserved :param dict style_sheet: A JSON string that defines the Assistant's style sheet :param dict defaults: A JSON object that defines the Assistant's [default tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios :returns: Updated AssistantInstance :rtype: twilio.rest.autopilot.v1.assistant.AssistantInstance """ data = values.of({ 'FriendlyName': friendly_name, 'LogQueries': log_queries, 'UniqueName': unique_name, 'CallbackUrl': callback_url, 'CallbackEvents': callback_events, 'StyleSheet': serialize.object(style_sheet), 'Defaults': serialize.object(defaults), }) payload = self._version.update( 'POST', self._uri, data=data, ) return AssistantInstance(self._version, payload, sid=self._solution['sid'], )
def update(self, data): """ Update the DocumentInstance :param dict data: The data :returns: Updated DocumentInstance :rtype: twilio.rest.sync.v1.service.document.DocumentInstance """ data = values.of({ 'Data': serialize.object(data), }) payload = self._version.update( 'POST', self._uri, data=data, ) return DocumentInstance( self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], )
def update(self, friendly_name=values.unset, unique_name=values.unset, actions=values.unset, actions_url=values.unset): """ Update the TaskInstance :param unicode friendly_name: A string to describe the resource :param unicode unique_name: An application-defined string that uniquely identifies the resource :param dict actions: The JSON string that specifies the actions that instruct the Assistant on how to perform the task :param unicode actions_url: The URL from which the Assistant can fetch actions :returns: The updated TaskInstance :rtype: twilio.rest.autopilot.v1.assistant.task.TaskInstance """ data = values.of({ 'FriendlyName': friendly_name, 'UniqueName': unique_name, 'Actions': serialize.object(actions), 'ActionsUrl': actions_url, }) payload = self._version.update( method='POST', uri=self._uri, data=data, ) return TaskInstance( self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], )
def update(self, friendly_name=values.unset, unique_name=values.unset, actions=values.unset, actions_url=values.unset): """ Update the TaskInstance :param unicode friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. :param unicode unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. :param dict actions: A user-provided JSON object encoded as a string to specify the actions for this task. It is optional and non-unique. :param unicode actions_url: User-provided HTTP endpoint where from the assistant fetches actions :returns: Updated TaskInstance :rtype: twilio.rest.preview.understand.assistant.task.TaskInstance """ data = values.of({ 'FriendlyName': friendly_name, 'UniqueName': unique_name, 'Actions': serialize.object(actions), 'ActionsUrl': actions_url, }) payload = self._version.update( 'POST', self._uri, data=data, ) return TaskInstance( self._version, payload, assistant_sid=self._solution['assistant_sid'], sid=self._solution['sid'], )
def create(self, key, data, ttl=values.unset, item_ttl=values.unset, collection_ttl=values.unset): """ Create a new SyncMapItemInstance :param unicode key: The unique user-defined key of this Map Item. :param dict data: Contains arbitrary user-defined, schema-less data that this Map Item stores, represented by a JSON object, up to 16KB. :param unicode ttl: Alias for item_ttl :param unicode item_ttl: Time-to-live of this item in seconds, defaults to no expiration. :param unicode collection_ttl: Time-to-live of this item's parent Map in seconds, defaults to no expiration. :returns: Newly created SyncMapItemInstance :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance """ data = values.of({ 'Key': key, 'Data': serialize.object(data), 'Ttl': ttl, 'ItemTtl': item_ttl, 'CollectionTtl': collection_ttl, }) payload = self._version.create( 'POST', self._uri, data=data, ) return SyncMapItemInstance( self._version, payload, service_sid=self._solution['service_sid'], map_sid=self._solution['map_sid'], )
def create(self, data): """ Create a new SyncListItemInstance :param dict data: The data :returns: Newly created SyncListItemInstance :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance """ data = values.of({ 'Data': serialize.object(data), }) payload = self._version.create( 'POST', self._uri, data=data, ) return SyncListItemInstance( self._version, payload, service_sid=self._solution['service_sid'], list_sid=self._solution['list_sid'], )
def create(self, unique_name=values.unset, data=values.unset, ttl=values.unset): """ Create a new DocumentInstance :param unicode unique_name: An application-defined string that uniquely identifies the Sync Document :param dict data: A JSON string that represents an arbitrary, schema-less object that the Sync Document stores :param unicode ttl: How long, in seconds, before the Sync Document expires and is deleted :returns: Newly created DocumentInstance :rtype: twilio.rest.sync.v1.service.document.DocumentInstance """ data = values.of({ 'UniqueName': unique_name, 'Data': serialize.object(data), 'Ttl': ttl, }) payload = self._version.create( 'POST', self._uri, data=data, ) return DocumentInstance( self._version, payload, service_sid=self._solution['service_sid'], )
def create(self, available_add_on_sid, accept_terms_of_service, configuration=values.unset, unique_name=values.unset): """ Create the InstalledAddOnInstance :param unicode available_add_on_sid: The SID of the AvaliableAddOn to install :param bool accept_terms_of_service: Whether the Terms of Service were accepted :param dict configuration: The JSON object representing the configuration :param unicode unique_name: An application-defined string that uniquely identifies the resource :returns: The created InstalledAddOnInstance :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance """ data = values.of({ 'AvailableAddOnSid': available_add_on_sid, 'AcceptTermsOfService': accept_terms_of_service, 'Configuration': serialize.object(configuration), 'UniqueName': unique_name, }) payload = self._version.create( method='POST', uri=self._uri, data=data, ) return InstalledAddOnInstance( self._version, payload, )
def update(self, actions=values.unset): """ Update the TaskActionsInstance :param dict actions: The JSON string that specifies the actions that instruct the Assistant on how to perform the task :returns: Updated TaskActionsInstance :rtype: twilio.rest.autopilot.v1.assistant.task.task_actions.TaskActionsInstance """ data = values.of({ 'Actions': serialize.object(actions), }) payload = self._version.update( 'POST', self._uri, data=data, ) return TaskActionsInstance( self._version, payload, assistant_sid=self._solution['assistant_sid'], task_sid=self._solution['task_sid'], )
def update(self, data=values.unset, ttl=values.unset): """ Update the SyncMapItemInstance :param dict data: Contains an arbitrary JSON object to be stored in this Map Item. :param unicode ttl: New time-to-live of this Map in seconds. :returns: Updated SyncMapItemInstance :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance """ data = values.of({'Data': serialize.object(data), 'Ttl': ttl, }) payload = self._version.update( 'POST', self._uri, data=data, ) return SyncMapItemInstance( self._version, payload, service_sid=self._solution['service_sid'], map_sid=self._solution['map_sid'], key=self._solution['key'], )
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'], )
def create(self, unique_name=values.unset, data=values.unset): """ Create a new DocumentInstance :param unicode unique_name: The unique_name :param dict data: The data :returns: Newly created DocumentInstance :rtype: twilio.rest.sync.v1.service.document.DocumentInstance """ data = values.of({ 'UniqueName': unique_name, 'Data': serialize.object(data), }) payload = self._version.create( 'POST', self._uri, data=data, ) return DocumentInstance( self._version, payload, service_sid=self._solution['service_sid'], )
def update(self, rules=values.unset): """ Update the SubscribeRulesInstance :param dict rules: A JSON-encoded array of subscribe rules :returns: The updated SubscribeRulesInstance :rtype: twilio.rest.video.v1.room.room_participant.room_participant_subscribe_rule.SubscribeRulesInstance """ data = values.of({ 'Rules': serialize.object(rules), }) payload = self._version.update( method='POST', uri=self._uri, data=data, ) return SubscribeRulesInstance( self._version, payload, room_sid=self._solution['room_sid'], participant_sid=self._solution['participant_sid'], )
def update(self, data=values.unset, ttl=values.unset): """ Update the DocumentInstance :param dict data: A JSON string that represents an arbitrary, schema-less object that the Sync Document stores :param unicode ttl: How long, in seconds, before the Document resource expires and is deleted :returns: Updated DocumentInstance :rtype: twilio.rest.sync.v1.service.document.DocumentInstance """ data = values.of({ 'Data': serialize.object(data), 'Ttl': ttl, }) payload = self._version.update( 'POST', self._uri, data=data, ) return DocumentInstance( self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], )
def test_update_request(self): self.holodeck.mock(Response(500, '')) with self.assertRaises(TwilioException): self.client.preview.sync.services("ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ .sync_lists("ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ .sync_list_items(1).update(data={}, if_match="if_match") values = { 'Data': serialize.object({}), } headers = { 'If-Match': "if_match", } self.holodeck.assert_has_request( Request( 'post', 'https://preview.twilio.com/Sync/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items/1', headers=headers, )) self.holodeck.assert_has_request( Request( 'post', 'https://preview.twilio.com/Sync/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Lists/ESXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items/1', data=values, ))
def create(self, to, from_, parameters=values.unset): """ Create the EngagementInstance :param unicode to: The Contact phone number to start a Studio Flow Engagement :param unicode from_: The Twilio phone number to send messages or initiate calls from during the Flow Engagement :param dict parameters: A JSON string we will add to your flow's context and that you can access as variables inside your flow :returns: The created EngagementInstance :rtype: twilio.rest.studio.v1.flow.engagement.EngagementInstance """ data = values.of({ 'To': to, 'From': from_, 'Parameters': serialize.object(parameters), }) payload = self._version.create( method='POST', uri=self._uri, data=data, ) return EngagementInstance( self._version, payload, flow_sid=self._solution['flow_sid'], )
def create(self, to, from_, parameters=values.unset): """ Create the ExecutionInstance :param unicode to: The to :param unicode from_: The from :param dict parameters: The parameters :returns: The created ExecutionInstance :rtype: twilio.rest.studio.v2.flow.execution.ExecutionInstance """ data = values.of({ 'To': to, 'From': from_, 'Parameters': serialize.object(parameters), }) payload = self._version.create( method='POST', uri=self._uri, data=data, ) return ExecutionInstance( self._version, payload, flow_sid=self._solution['flow_sid'], )
def create(self, data, ttl=values.unset, item_ttl=values.unset, collection_ttl=values.unset): """ Create a new SyncListItemInstance :param dict data: A JSON string that represents an arbitrary, schema-less object that the List Item stores :param unicode ttl: An alias for item_ttl :param unicode item_ttl: How long, in seconds, before the List Item expires :param unicode collection_ttl: How long, in seconds, before the List Item's parent Sync List expires :returns: Newly created SyncListItemInstance :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance """ data = values.of({ 'Data': serialize.object(data), 'Ttl': ttl, 'ItemTtl': item_ttl, 'CollectionTtl': collection_ttl, }) payload = self._version.create( 'POST', self._uri, data=data, ) return SyncListItemInstance( self._version, payload, service_sid=self._solution['service_sid'], list_sid=self._solution['list_sid'], )
def update(self, data=values.unset, ttl=values.unset, item_ttl=values.unset, collection_ttl=values.unset, if_match=values.unset): """ Update the SyncMapItemInstance :param dict data: A JSON string that represents an arbitrary, schema-less object that the Map Item stores :param unicode ttl: An alias for item_ttl :param unicode item_ttl: How long, in seconds, before the Map Item expires :param unicode collection_ttl: How long, in seconds, before the Map Item's parent Sync Map expires and is deleted :param unicode if_match: The If-Match HTTP request header :returns: The updated SyncMapItemInstance :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance """ data = values.of({ 'Data': serialize.object(data), 'Ttl': ttl, 'ItemTtl': item_ttl, 'CollectionTtl': collection_ttl, }) headers = values.of({'If-Match': if_match, }) payload = self._version.update(method='POST', uri=self._uri, data=data, headers=headers, ) return SyncMapItemInstance( self._version, payload, service_sid=self._solution['service_sid'], map_sid=self._solution['map_sid'], key=self._solution['key'], )
def create(self, to, from_, parameters=values.unset): """ Create the ExecutionInstance :param unicode to: The Contact phone number to start a Studio Flow Execution :param unicode from_: The Twilio phone number to send messages or initiate calls from during the Flow Execution :param dict parameters: JSON data that will be added to the Flow's context :returns: The created ExecutionInstance :rtype: twilio.rest.studio.v1.flow.execution.ExecutionInstance """ data = values.of({ 'To': to, 'From': from_, 'Parameters': serialize.object(parameters), }) payload = self._version.create( method='POST', uri=self._uri, data=data, ) return ExecutionInstance( self._version, payload, flow_sid=self._solution['flow_sid'], )
def create(self, key, data, ttl=values.unset, item_ttl=values.unset, collection_ttl=values.unset): """ Create the SyncMapItemInstance :param unicode key: The unique, user-defined key for the Map Item :param dict data: A JSON string that represents an arbitrary, schema-less object that the Map Item stores :param unicode ttl: An alias for item_ttl :param unicode item_ttl: How long, in seconds, before the Map Item expires :param unicode collection_ttl: How long, in seconds, before the Map Item's parent Sync Map expires and is deleted :returns: The created SyncMapItemInstance :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance """ data = values.of({ 'Key': key, 'Data': serialize.object(data), 'Ttl': ttl, 'ItemTtl': item_ttl, 'CollectionTtl': collection_ttl, }) payload = self._version.create(method='POST', uri=self._uri, data=data, ) return SyncMapItemInstance( self._version, payload, service_sid=self._solution['service_sid'], map_sid=self._solution['map_sid'], )
def create(self, data): """ Create a new StreamMessageInstance :param dict data: Stream Message body. :returns: Newly created StreamMessageInstance :rtype: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageInstance """ data = values.of({ 'Data': serialize.object(data), }) payload = self._version.create( 'POST', self._uri, data=data, ) return StreamMessageInstance( self._version, payload, service_sid=self._solution['service_sid'], stream_sid=self._solution['stream_sid'], )
def update(self, friendly_name, status, definition, commit_message=values.unset): """ Update the FlowValidateInstance :param unicode friendly_name: The friendly_name :param FlowValidateInstance.Status status: The status :param dict definition: The definition :param unicode commit_message: The commit_message :returns: The updated FlowValidateInstance :rtype: twilio.rest.studio.v2.flow_validate.FlowValidateInstance """ data = values.of({ 'FriendlyName': friendly_name, 'Status': status, 'Definition': serialize.object(definition), 'CommitMessage': commit_message, }) payload = self._version.update( method='POST', uri=self._uri, data=data, ) return FlowValidateInstance( self._version, payload, )
def update(self, data=values.unset, ttl=values.unset, item_ttl=values.unset, collection_ttl=values.unset): """ Update the SyncMapItemInstance :param dict data: Contains an arbitrary JSON object to be stored in this Map Item. :param unicode ttl: Alias for item_ttl :param unicode item_ttl: Time-to-live of this item in seconds, defaults to no expiration. :param unicode collection_ttl: Time-to-live of this item's parent Map in seconds, defaults to no expiration. :returns: Updated SyncMapItemInstance :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance """ data = values.of({ 'Data': serialize.object(data), 'Ttl': ttl, 'ItemTtl': item_ttl, 'CollectionTtl': collection_ttl, }) payload = self._version.update( 'POST', self._uri, data=data, ) return SyncMapItemInstance( self._version, payload, service_sid=self._solution['service_sid'], map_sid=self._solution['map_sid'], key=self._solution['key'], )
def update(self, data): """ Update the SyncListItemInstance :param dict data: The data :returns: Updated SyncListItemInstance :rtype: twilio.rest.preview.sync.service.sync_list.sync_list_item.SyncListItemInstance """ data = values.of({ 'Data': serialize.object(data), }) payload = self._version.update( 'POST', self._uri, data=data, ) return SyncListItemInstance( self._version, payload, service_sid=self._solution['service_sid'], list_sid=self._solution['list_sid'], index=self._solution['index'], )
def update(self, data): """ Update the SyncMapItemInstance :param dict data: The data :returns: Updated SyncMapItemInstance :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance """ data = values.of({ 'Data': serialize.object(data), }) payload = self._version.update( 'POST', self._uri, data=data, ) return SyncMapItemInstance( self._version, payload, service_sid=self._solution['service_sid'], map_sid=self._solution['map_sid'], key=self._solution['key'], )
def update(self, data): """ Update the SyncMapItemInstance :param dict data: The data :returns: Updated SyncMapItemInstance :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance """ data = values.of({ 'Data': serialize.object(data), }) payload = self._version.update( 'POST', self._uri, data=data, ) return SyncMapItemInstance( self._version, payload, service_sid=self._solution['service_sid'], map_sid=self._solution['map_sid'], key=self._solution['key'], )
def create(self, key, data): """ Create a new SyncMapItemInstance :param unicode key: The key :param dict data: The data :returns: Newly created SyncMapItemInstance :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance """ data = values.of({ 'Key': key, 'Data': serialize.object(data), }) payload = self._version.create( 'POST', self._uri, data=data, ) return SyncMapItemInstance( self._version, payload, service_sid=self._solution['service_sid'], map_sid=self._solution['map_sid'], )
def update(self, configuration=values.unset, unique_name=values.unset): """ Update the InstalledAddOnInstance :param dict configuration: The JSON object representing the configuration :param unicode unique_name: The string that uniquely identifies this Add-on installation :returns: Updated InstalledAddOnInstance :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance """ data = values.of({ 'Configuration': serialize.object(configuration), 'UniqueName': unique_name, }) payload = self._version.update( 'POST', self._uri, data=data, ) return InstalledAddOnInstance( self._version, payload, sid=self._solution['sid'], )
def create(self, data, ttl=values.unset, item_ttl=values.unset, collection_ttl=values.unset): """ Create a new SyncListItemInstance :param dict data: Contains arbitrary user-defined, schema-less data that this List Item stores, represented by a JSON object, up to 16KB. :param unicode ttl: Alias for item_ttl :param unicode item_ttl: Time-to-live of this item in seconds, defaults to no expiration. :param unicode collection_ttl: Time-to-live of this item's parent List in seconds, defaults to no expiration. :returns: Newly created SyncListItemInstance :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance """ data = values.of({ 'Data': serialize.object(data), 'Ttl': ttl, 'ItemTtl': item_ttl, 'CollectionTtl': collection_ttl, }) payload = self._version.create( 'POST', self._uri, data=data, ) return SyncListItemInstance( self._version, payload, service_sid=self._solution['service_sid'], list_sid=self._solution['list_sid'], )
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'], )
def create(self, available_add_on_sid, accept_terms_of_service, configuration=values.unset, unique_name=values.unset): """ Create a new InstalledAddOnInstance :param unicode available_add_on_sid: A string that uniquely identifies the Add-on to install :param bool accept_terms_of_service: A boolean reflecting your acceptance of the Terms of Service :param dict configuration: The JSON object representing the configuration :param unicode unique_name: The string that uniquely identifies this Add-on installation :returns: Newly created InstalledAddOnInstance :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance """ data = values.of({ 'AvailableAddOnSid': available_add_on_sid, 'AcceptTermsOfService': accept_terms_of_service, 'Configuration': serialize.object(configuration), 'UniqueName': unique_name, }) payload = self._version.create( 'POST', self._uri, data=data, ) return InstalledAddOnInstance(self._version, payload, )
def create(self, available_add_on_sid, accept_terms_of_service, configuration=values.unset, unique_name=values.unset): """ Create a new InstalledAddOnInstance :param unicode available_add_on_sid: A string that uniquely identifies the Add-on to install :param bool accept_terms_of_service: A boolean reflecting your acceptance of the Terms of Service :param dict configuration: The JSON object representing the configuration :param unicode unique_name: The string that uniquely identifies this Add-on installation :returns: Newly created InstalledAddOnInstance :rtype: twilio.rest.preview.marketplace.installed_add_on.InstalledAddOnInstance """ data = values.of({ 'AvailableAddOnSid': available_add_on_sid, 'AcceptTermsOfService': accept_terms_of_service, 'Configuration': serialize.object(configuration), 'UniqueName': unique_name, }) payload = self._version.create( 'POST', self._uri, data=data, ) return InstalledAddOnInstance( self._version, payload, )
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 list[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 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'], )
def create(self, friendly_name, status, definition, commit_message=values.unset): """ Create the FlowInstance :param unicode friendly_name: The string that you assigned to describe the Flow :param FlowInstance.Status status: The status of the Flow :param dict definition: JSON representation of flow definition :param unicode commit_message: Description on change made in the revision :returns: The created FlowInstance :rtype: twilio.rest.studio.v2.flow.FlowInstance """ data = values.of({ 'FriendlyName': friendly_name, 'Status': status, 'Definition': serialize.object(definition), 'CommitMessage': commit_message, }) payload = self._version.create( method='POST', uri=self._uri, data=data, ) return FlowInstance( self._version, payload, )
def update(self, data): """ Update the DocumentInstance :param dict data: The data :returns: Updated DocumentInstance :rtype: twilio.rest.preview.sync.service.document.DocumentInstance """ data = values.of({ 'Data': serialize.object(data), }) payload = self._version.update( 'POST', self._uri, data=data, ) return DocumentInstance( self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], )
def create(self, key, data): """ Create a new SyncMapItemInstance :param unicode key: The key :param dict data: The data :returns: Newly created SyncMapItemInstance :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_item.SyncMapItemInstance """ data = values.of({ 'Key': key, 'Data': serialize.object(data), }) payload = self._version.create( 'POST', self._uri, data=data, ) return SyncMapItemInstance( self._version, payload, service_sid=self._solution['service_sid'], map_sid=self._solution['map_sid'], )
def create(self, unique_name=values.unset, data=values.unset): """ Create a new DocumentInstance :param unicode unique_name: The unique_name :param dict data: The data :returns: Newly created DocumentInstance :rtype: twilio.rest.preview.sync.service.document.DocumentInstance """ data = values.of({ 'UniqueName': unique_name, 'Data': serialize.object(data), }) payload = self._version.create( 'POST', self._uri, data=data, ) return DocumentInstance( self._version, payload, service_sid=self._solution['service_sid'], )
def create(self, description, sink_configuration, sink_type): """ Create the SinkInstance :param unicode description: Sink Description :param dict sink_configuration: JSON Sink configuration. :param SinkInstance.SinkType sink_type: Sink type. :returns: The created SinkInstance :rtype: twilio.rest.events.v1.sink.SinkInstance """ data = values.of({ 'Description': description, 'SinkConfiguration': serialize.object(sink_configuration), 'SinkType': sink_type, }) payload = self._version.create( method='POST', uri=self._uri, data=data, ) return SinkInstance( self._version, payload, )
def update(self, data=values.unset, ttl=values.unset, item_ttl=values.unset, collection_ttl=values.unset): """ Update the SyncListItemInstance :param dict data: Contains arbitrary user-defined, schema-less data that this List Item stores, represented by a JSON object, up to 16KB. :param unicode ttl: Alias for item_ttl :param unicode item_ttl: Time-to-live of this item in seconds, defaults to no expiration. :param unicode collection_ttl: Time-to-live of this item's parent List in seconds, defaults to no expiration. :returns: Updated SyncListItemInstance :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_item.SyncListItemInstance """ data = values.of({ 'Data': serialize.object(data), 'Ttl': ttl, 'ItemTtl': item_ttl, 'CollectionTtl': collection_ttl, }) payload = self._version.update( 'POST', self._uri, data=data, ) return SyncListItemInstance( self._version, payload, service_sid=self._solution['service_sid'], list_sid=self._solution['list_sid'], index=self._solution['index'], )
def create(self, extension, extension_context, extension_environment=values.unset, status_callback=values.unset, status_callback_method=values.unset, max_duration=values.unset): """ Create the MediaProcessorInstance :param unicode extension: The Media Extension name or URL :param unicode extension_context: The Media Extension context :param dict extension_environment: The Media Extension environment :param unicode status_callback: The URL to send MediaProcessor event updates to your application :param unicode status_callback_method: The HTTP method Twilio should use to call the `status_callback` URL :param unicode max_duration: Maximum MediaProcessor duration in minutes :returns: The created MediaProcessorInstance :rtype: twilio.rest.media.v1.media_processor.MediaProcessorInstance """ data = values.of({ 'Extension': extension, 'ExtensionContext': extension_context, 'ExtensionEnvironment': serialize.object(extension_environment), 'StatusCallback': status_callback, 'StatusCallbackMethod': status_callback_method, 'MaxDuration': max_duration, }) payload = self._version.create(method='POST', uri=self._uri, data=data, ) return MediaProcessorInstance(self._version, payload, )
def create(self, data): """ Create the StreamMessageInstance :param dict data: A JSON string that represents an arbitrary, schema-less object that makes up the Stream Message body :returns: The created StreamMessageInstance :rtype: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageInstance """ data = values.of({ 'Data': serialize.object(data), }) payload = self._version.create( method='POST', uri=self._uri, data=data, ) return StreamMessageInstance( self._version, payload, service_sid=self._solution['service_sid'], stream_sid=self._solution['stream_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'], )
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 test_update_request(self): self.holodeck.mock(Response(500, '')) with self.assertRaises(TwilioException): self.client.preview.sync.services(sid="ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ .documents(sid="ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update(data={}) values = {'Data': serialize.object({}), } self.holodeck.assert_has_request(Request( 'post', 'https://preview.twilio.com/Sync/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Documents/ETXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', data=values, ))
def test_create_request(self): self.holodeck.mock(Response(500, '')) with self.assertRaises(TwilioException): self.client.sync.v1.services(sid="ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ .sync_maps(sid="MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \ .sync_map_items.create(key="key", data={}) values = {'Key': "key", 'Data': serialize.object({}), } self.holodeck.assert_has_request(Request( 'post', 'https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps/MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items', data=values, ))
def update(self, defaults=values.unset): """ Update the DefaultsInstance :param dict defaults: A JSON string that describes the default task links. :returns: Updated DefaultsInstance :rtype: twilio.rest.autopilot.v1.assistant.defaults.DefaultsInstance """ data = values.of({'Defaults': serialize.object(defaults), }) payload = self._version.update( 'POST', self._uri, data=data, ) return DefaultsInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], )
def update(self, style_sheet=values.unset): """ Update the StyleSheetInstance :param dict style_sheet: The JSON Style sheet string :returns: Updated StyleSheetInstance :rtype: twilio.rest.preview.understand.assistant.style_sheet.StyleSheetInstance """ data = values.of({'StyleSheet': serialize.object(style_sheet), }) payload = self._version.update( 'POST', self._uri, data=data, ) return StyleSheetInstance(self._version, payload, assistant_sid=self._solution['assistant_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, )
def create(self, to, from_, parameters=values.unset): """ Create a new ExecutionInstance :param unicode to: The Contact phone number to start a Studio Flow Execution. :param unicode from_: The Twilio phone number to send messages or initiate calls from during the Flow Execution. :param dict parameters: JSON data that will be added to your flow's context and can accessed as variables inside your flow. :returns: Newly created ExecutionInstance :rtype: twilio.rest.studio.v1.flow.execution.ExecutionInstance """ data = values.of({'To': to, 'From': from_, 'Parameters': serialize.object(parameters), }) payload = self._version.create( 'POST', self._uri, data=data, ) return ExecutionInstance(self._version, payload, flow_sid=self._solution['flow_sid'], )
def create(self, to, from_, parameters=values.unset): """ Create a new EngagementInstance :param unicode to: The to :param unicode from_: The from :param dict parameters: The parameters :returns: Newly created EngagementInstance :rtype: twilio.rest.studio.v1.flow.engagement.EngagementInstance """ data = values.of({'To': to, 'From': from_, 'Parameters': serialize.object(parameters), }) payload = self._version.create( 'POST', self._uri, data=data, ) return EngagementInstance(self._version, payload, flow_sid=self._solution['flow_sid'], )
def create(self, unique_name=values.unset, data=values.unset, ttl=values.unset): """ Create a new DocumentInstance :param unicode unique_name: Human-readable name for this document :param dict data: JSON data to be stored in this document :param unicode ttl: Time-to-live of this Document in seconds, defaults to no expiration. :returns: Newly created DocumentInstance :rtype: twilio.rest.sync.v1.service.document.DocumentInstance """ data = values.of({'UniqueName': unique_name, 'Data': serialize.object(data), 'Ttl': ttl, }) payload = self._version.create( 'POST', self._uri, data=data, ) return DocumentInstance(self._version, payload, service_sid=self._solution['service_sid'], )
def update(self, fallback_actions=values.unset): """ Update the AssistantFallbackActionsInstance :param dict fallback_actions: The fallback_actions :returns: Updated AssistantFallbackActionsInstance :rtype: twilio.rest.preview.understand.assistant.assistant_fallback_actions.AssistantFallbackActionsInstance """ data = values.of({'FallbackActions': serialize.object(fallback_actions), }) payload = self._version.update( 'POST', self._uri, data=data, ) return AssistantFallbackActionsInstance( self._version, payload, assistant_sid=self._solution['assistant_sid'], )
def update(self, actions=values.unset): """ Update the TaskActionsInstance :param dict actions: The JSON actions that instruct the Assistant how to perform this task. :returns: Updated TaskActionsInstance :rtype: twilio.rest.preview.understand.assistant.task.task_actions.TaskActionsInstance """ data = values.of({'Actions': serialize.object(actions), }) payload = self._version.update( 'POST', self._uri, data=data, ) return TaskActionsInstance( self._version, payload, assistant_sid=self._solution['assistant_sid'], task_sid=self._solution['task_sid'], )
def create(self, data): """ Create a new StreamMessageInstance :param dict data: Stream Message body. :returns: Newly created StreamMessageInstance :rtype: twilio.rest.sync.v1.service.sync_stream.stream_message.StreamMessageInstance """ data = values.of({'Data': serialize.object(data), }) payload = self._version.create( 'POST', self._uri, data=data, ) return StreamMessageInstance( self._version, payload, service_sid=self._solution['service_sid'], stream_sid=self._solution['stream_sid'], )