_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q29200
DeviceList.get
train
def get(self, sid): """ Constructs a DeviceContext :param sid: A string that uniquely identifies the Device. :returns: twilio.rest.preview.deployed_devices.fleet.device.DeviceContext :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceContext """ return DeviceContext(self._version, fleet_sid=self._solution['fleet_sid'], sid=sid, )
python
{ "resource": "" }
q29201
DevicePage.get_instance
train
def get_instance(self, payload): """ Build an instance of DeviceInstance :param dict payload: Payload response from the API :returns: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance """ return DeviceInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], )
python
{ "resource": "" }
q29202
RecordingList.get
train
def get(self, sid): """ Constructs a RecordingContext :param sid: The unique string that identifies the resource :returns: twilio.rest.api.v2010.account.recording.RecordingContext :rtype: twilio.rest.api.v2010.account.recording.RecordingContext """ return RecordingContext(self._version, account_sid=self._solution['account_sid'], sid=sid, )
python
{ "resource": "" }
q29203
RecordingContext.add_on_results
train
def add_on_results(self): """ Access the add_on_results :returns: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultList :rtype: twilio.rest.api.v2010.account.recording.add_on_result.AddOnResultList """ if self._add_on_results is None: self._add_on_results = AddOnResultList( self._version, account_sid=self._solution['account_sid'], reference_sid=self._solution['sid'], ) return self._add_on_results
python
{ "resource": "" }
q29204
CallSummaryContext.fetch
train
def fetch(self): """ Fetch a CallSummaryInstance :returns: Fetched CallSummaryInstance :rtype: twilio.rest.insights.v1.summary.CallSummaryInstance """ params = values.of({}) payload = self._version.fetch( 'GET', self._uri, params=params, ) return CallSummaryInstance(self._version, payload, call_sid=self._solution['call_sid'], )
python
{ "resource": "" }
q29205
AuthTypeCallsPage.get_instance
train
def get_instance(self, payload): """ Build an instance of AuthTypeCallsInstance :param dict payload: Payload response from the API :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.AuthTypeCallsInstance :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.AuthTypeCallsInstance """ return AuthTypeCallsInstance( self._version, payload, account_sid=self._solution['account_sid'], domain_sid=self._solution['domain_sid'], )
python
{ "resource": "" }
q29206
prefixed_collapsible_map
train
def prefixed_collapsible_map(m, prefix): """ Return a dict of params corresponding to those in m with the added prefix """ if m == values.unset: return {} def flatten_dict(d, result={}, prv_keys=[]): for k, v in d.items(): if isinstance(v, dict): flatten_dict(v, result, prv_keys + [k]) else: result['.'.join(prv_keys + [k])] = v return result if isinstance(m, dict): flattened = flatten_dict(m) return {'{}.{}'.format(prefix, k): v for k, v in flattened.items()} return {}
python
{ "resource": "" }
q29207
object
train
def object(obj): """ Return a jsonified string represenation of obj if obj is jsonifiable else return obj untouched """ if isinstance(obj, dict) or isinstance(obj, list): return json.dumps(obj) return obj
python
{ "resource": "" }
q29208
map
train
def map(lst, serialize_func): """ Applies serialize_func to every element in lst """ if not isinstance(lst, list): return lst return [serialize_func(e) for e in lst]
python
{ "resource": "" }
q29209
AccessToken.add_grant
train
def add_grant(self, grant): """Add a grant to this AccessToken""" if not isinstance(grant, AccessTokenGrant): raise ValueError('Grant must be an instance of AccessTokenGrant.') self.grants.append(grant)
python
{ "resource": "" }
q29210
AvailablePhoneNumberCountryList.get
train
def get(self, country_code): """ Constructs a AvailablePhoneNumberCountryContext :param country_code: The ISO country code of the country to fetch available phone number information about :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryContext :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryContext """ return AvailablePhoneNumberCountryContext( self._version, account_sid=self._solution['account_sid'], country_code=country_code, )
python
{ "resource": "" }
q29211
AvailablePhoneNumberCountryPage.get_instance
train
def get_instance(self, payload): """ Build an instance of AvailablePhoneNumberCountryInstance :param dict payload: Payload response from the API :returns: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryInstance :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryInstance """ return AvailablePhoneNumberCountryInstance( self._version, payload, account_sid=self._solution['account_sid'], )
python
{ "resource": "" }
q29212
AvailablePhoneNumberCountryContext.fetch
train
def fetch(self): """ Fetch a AvailablePhoneNumberCountryInstance :returns: Fetched AvailablePhoneNumberCountryInstance :rtype: twilio.rest.api.v2010.account.available_phone_number.AvailablePhoneNumberCountryInstance """ params = values.of({}) payload = self._version.fetch( 'GET', self._uri, params=params, ) return AvailablePhoneNumberCountryInstance( self._version, payload, account_sid=self._solution['account_sid'], country_code=self._solution['country_code'], )
python
{ "resource": "" }
q29213
AvailablePhoneNumberCountryContext.local
train
def local(self): """ Access the local :returns: twilio.rest.api.v2010.account.available_phone_number.local.LocalList :rtype: twilio.rest.api.v2010.account.available_phone_number.local.LocalList """ if self._local is None: self._local = LocalList( self._version, account_sid=self._solution['account_sid'], country_code=self._solution['country_code'], ) return self._local
python
{ "resource": "" }
q29214
AvailablePhoneNumberCountryContext.national
train
def national(self): """ Access the national :returns: twilio.rest.api.v2010.account.available_phone_number.national.NationalList :rtype: twilio.rest.api.v2010.account.available_phone_number.national.NationalList """ if self._national is None: self._national = NationalList( self._version, account_sid=self._solution['account_sid'], country_code=self._solution['country_code'], ) return self._national
python
{ "resource": "" }
q29215
AvailablePhoneNumberCountryContext.voip
train
def voip(self): """ Access the voip :returns: twilio.rest.api.v2010.account.available_phone_number.voip.VoipList :rtype: twilio.rest.api.v2010.account.available_phone_number.voip.VoipList """ if self._voip is None: self._voip = VoipList( self._version, account_sid=self._solution['account_sid'], country_code=self._solution['country_code'], ) return self._voip
python
{ "resource": "" }
q29216
AvailablePhoneNumberCountryContext.shared_cost
train
def shared_cost(self): """ Access the shared_cost :returns: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostList :rtype: twilio.rest.api.v2010.account.available_phone_number.shared_cost.SharedCostList """ if self._shared_cost is None: self._shared_cost = SharedCostList( self._version, account_sid=self._solution['account_sid'], country_code=self._solution['country_code'], ) return self._shared_cost
python
{ "resource": "" }
q29217
AvailablePhoneNumberCountryContext.machine_to_machine
train
def machine_to_machine(self): """ Access the machine_to_machine :returns: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineList :rtype: twilio.rest.api.v2010.account.available_phone_number.machine_to_machine.MachineToMachineList """ if self._machine_to_machine is None: self._machine_to_machine = MachineToMachineList( self._version, account_sid=self._solution['account_sid'], country_code=self._solution['country_code'], ) return self._machine_to_machine
python
{ "resource": "" }
q29218
PublishedTrackList.get
train
def get(self, sid): """ Constructs a PublishedTrackContext :param sid: A 34 character string that uniquely identifies this resource. :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackContext :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackContext """ return PublishedTrackContext( self._version, room_sid=self._solution['room_sid'], participant_sid=self._solution['participant_sid'], sid=sid, )
python
{ "resource": "" }
q29219
PublishedTrackPage.get_instance
train
def get_instance(self, payload): """ Build an instance of PublishedTrackInstance :param dict payload: Payload response from the API :returns: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackInstance :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackInstance """ return PublishedTrackInstance( self._version, payload, room_sid=self._solution['room_sid'], participant_sid=self._solution['participant_sid'], )
python
{ "resource": "" }
q29220
PublishedTrackContext.fetch
train
def fetch(self): """ Fetch a PublishedTrackInstance :returns: Fetched PublishedTrackInstance :rtype: twilio.rest.video.v1.room.room_participant.room_participant_published_track.PublishedTrackInstance """ params = values.of({}) payload = self._version.fetch( 'GET', self._uri, params=params, ) return PublishedTrackInstance( self._version, payload, room_sid=self._solution['room_sid'], participant_sid=self._solution['participant_sid'], sid=self._solution['sid'], )
python
{ "resource": "" }
q29221
QueueList.get
train
def get(self, sid): """ Constructs a QueueContext :param sid: The unique string that identifies this resource :returns: twilio.rest.api.v2010.account.queue.QueueContext :rtype: twilio.rest.api.v2010.account.queue.QueueContext """ return QueueContext(self._version, account_sid=self._solution['account_sid'], sid=sid, )
python
{ "resource": "" }
q29222
QueuePage.get_instance
train
def get_instance(self, payload): """ Build an instance of QueueInstance :param dict payload: Payload response from the API :returns: twilio.rest.api.v2010.account.queue.QueueInstance :rtype: twilio.rest.api.v2010.account.queue.QueueInstance """ return QueueInstance(self._version, payload, account_sid=self._solution['account_sid'], )
python
{ "resource": "" }
q29223
QueueInstance.update
train
def update(self, friendly_name=values.unset, max_size=values.unset): """ Update the QueueInstance :param unicode friendly_name: A string to describe this resource :param unicode max_size: The max number of calls allowed in the queue :returns: Updated QueueInstance :rtype: twilio.rest.api.v2010.account.queue.QueueInstance """ return self._proxy.update(friendly_name=friendly_name, max_size=max_size, )
python
{ "resource": "" }
q29224
ParticipantList.stream
train
def stream(self, muted=values.unset, hold=values.unset, coaching=values.unset, limit=None, page_size=None): """ Streams ParticipantInstance records from the API as a generator stream. This operation lazily loads records as efficiently as possible until the limit is reached. The results are returned as a generator, so this operation is memory efficient. :param bool muted: Whether to return only participants that are muted :param bool hold: Whether to return only participants that are on hold :param bool coaching: Whether to return only participants who are coaching another call :param int limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param int page_size: Number of records to fetch per request, when not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000) :returns: Generator that will yield up to limit results :rtype: list[twilio.rest.api.v2010.account.conference.participant.ParticipantInstance] """ limits = self._version.read_limits(limit, page_size) page = self.page(muted=muted, hold=hold, coaching=coaching, page_size=limits['page_size'], ) return self._version.stream(page, limits['limit'], limits['page_limit'])
python
{ "resource": "" }
q29225
ParticipantContext.fetch
train
def fetch(self): """ Fetch a ParticipantInstance :returns: Fetched ParticipantInstance :rtype: twilio.rest.api.v2010.account.conference.participant.ParticipantInstance """ params = values.of({}) payload = self._version.fetch( 'GET', self._uri, params=params, ) return ParticipantInstance( self._version, payload, account_sid=self._solution['account_sid'], conference_sid=self._solution['conference_sid'], call_sid=self._solution['call_sid'], )
python
{ "resource": "" }
q29226
SyncMapPermissionList.get
train
def get(self, identity): """ Constructs a SyncMapPermissionContext :param identity: Identity of the user to whom the Sync Map Permission applies. :returns: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionContext :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionContext """ return SyncMapPermissionContext( self._version, service_sid=self._solution['service_sid'], map_sid=self._solution['map_sid'], identity=identity, )
python
{ "resource": "" }
q29227
SyncMapPermissionPage.get_instance
train
def get_instance(self, payload): """ Build an instance of SyncMapPermissionInstance :param dict payload: Payload response from the API :returns: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance """ return SyncMapPermissionInstance( self._version, payload, service_sid=self._solution['service_sid'], map_sid=self._solution['map_sid'], )
python
{ "resource": "" }
q29228
SyncMapPermissionContext.fetch
train
def fetch(self): """ Fetch a SyncMapPermissionInstance :returns: Fetched SyncMapPermissionInstance :rtype: twilio.rest.sync.v1.service.sync_map.sync_map_permission.SyncMapPermissionInstance """ params = values.of({}) payload = self._version.fetch( 'GET', self._uri, params=params, ) return SyncMapPermissionInstance( self._version, payload, service_sid=self._solution['service_sid'], map_sid=self._solution['map_sid'], identity=self._solution['identity'], )
python
{ "resource": "" }
q29229
VerificationList.get
train
def get(self, sid): """ Constructs a VerificationContext :param sid: The unique string that identifies the resource :returns: twilio.rest.verify.v2.service.verification.VerificationContext :rtype: twilio.rest.verify.v2.service.verification.VerificationContext """ return VerificationContext(self._version, service_sid=self._solution['service_sid'], sid=sid, )
python
{ "resource": "" }
q29230
VerificationPage.get_instance
train
def get_instance(self, payload): """ Build an instance of VerificationInstance :param dict payload: Payload response from the API :returns: twilio.rest.verify.v2.service.verification.VerificationInstance :rtype: twilio.rest.verify.v2.service.verification.VerificationInstance """ return VerificationInstance(self._version, payload, service_sid=self._solution['service_sid'], )
python
{ "resource": "" }
q29231
VerificationContext.update
train
def update(self, status): """ Update the VerificationInstance :param VerificationInstance.Status status: The new status of the resource :returns: Updated VerificationInstance :rtype: twilio.rest.verify.v2.service.verification.VerificationInstance """ data = values.of({'Status': status, }) payload = self._version.update( 'POST', self._uri, data=data, ) return VerificationInstance( self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], )
python
{ "resource": "" }
q29232
CertificateList.get
train
def get(self, sid): """ Constructs a CertificateContext :param sid: A string that uniquely identifies the Certificate. :returns: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateContext :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateContext """ return CertificateContext(self._version, fleet_sid=self._solution['fleet_sid'], sid=sid, )
python
{ "resource": "" }
q29233
CertificatePage.get_instance
train
def get_instance(self, payload): """ Build an instance of CertificateInstance :param dict payload: Payload response from the API :returns: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance :rtype: twilio.rest.preview.deployed_devices.fleet.certificate.CertificateInstance """ return CertificateInstance(self._version, payload, fleet_sid=self._solution['fleet_sid'], )
python
{ "resource": "" }
q29234
WorkspaceStatisticsPage.get_instance
train
def get_instance(self, payload): """ Build an instance of WorkspaceStatisticsInstance :param dict payload: Payload response from the API :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsInstance :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsInstance """ return WorkspaceStatisticsInstance( self._version, payload, workspace_sid=self._solution['workspace_sid'], )
python
{ "resource": "" }
q29235
SyncListPermissionList.get
train
def get(self, identity): """ Constructs a SyncListPermissionContext :param identity: Identity of the user to whom the Sync List Permission applies. :returns: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionContext :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionContext """ return SyncListPermissionContext( self._version, service_sid=self._solution['service_sid'], list_sid=self._solution['list_sid'], identity=identity, )
python
{ "resource": "" }
q29236
SyncListPermissionPage.get_instance
train
def get_instance(self, payload): """ Build an instance of SyncListPermissionInstance :param dict payload: Payload response from the API :returns: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance """ return SyncListPermissionInstance( self._version, payload, service_sid=self._solution['service_sid'], list_sid=self._solution['list_sid'], )
python
{ "resource": "" }
q29237
SyncListPermissionContext.fetch
train
def fetch(self): """ Fetch a SyncListPermissionInstance :returns: Fetched SyncListPermissionInstance :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance """ params = values.of({}) payload = self._version.fetch( 'GET', self._uri, params=params, ) return SyncListPermissionInstance( self._version, payload, service_sid=self._solution['service_sid'], list_sid=self._solution['list_sid'], identity=self._solution['identity'], )
python
{ "resource": "" }
q29238
SyncListPermissionContext.update
train
def update(self, read, write, manage): """ Update the SyncListPermissionInstance :param bool read: Read access. :param bool write: Write access. :param bool manage: Manage access. :returns: Updated SyncListPermissionInstance :rtype: twilio.rest.sync.v1.service.sync_list.sync_list_permission.SyncListPermissionInstance """ data = values.of({'Read': read, 'Write': write, 'Manage': manage, }) payload = self._version.update( 'POST', self._uri, data=data, ) return SyncListPermissionInstance( self._version, payload, service_sid=self._solution['service_sid'], list_sid=self._solution['list_sid'], identity=self._solution['identity'], )
python
{ "resource": "" }
q29239
TaskQueueList.page
train
def page(self, friendly_name=values.unset, evaluate_worker_attributes=values.unset, worker_sid=values.unset, page_token=values.unset, page_number=values.unset, page_size=values.unset): """ Retrieve a single page of TaskQueueInstance records from the API. Request is executed immediately :param unicode friendly_name: Filter by a human readable description of a TaskQueue :param unicode evaluate_worker_attributes: Provide a Worker attributes expression, and this will return the list of TaskQueues that would distribute tasks to a worker with these attributes. :param unicode worker_sid: The worker_sid :param str page_token: PageToken provided by the API :param int page_number: Page Number, this value is simply for client state :param int page_size: Number of records to return, defaults to 50 :returns: Page of TaskQueueInstance :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueuePage """ params = values.of({ 'FriendlyName': friendly_name, 'EvaluateWorkerAttributes': evaluate_worker_attributes, 'WorkerSid': worker_sid, 'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) response = self._version.page( 'GET', self._uri, params=params, ) return TaskQueuePage(self._version, response, self._solution)
python
{ "resource": "" }
q29240
TaskQueueList.create
train
def create(self, friendly_name, target_workers=values.unset, max_reserved_workers=values.unset, task_order=values.unset, reservation_activity_sid=values.unset, assignment_activity_sid=values.unset): """ Create a new TaskQueueInstance :param unicode friendly_name: Human readable description of this TaskQueue :param unicode target_workers: A string describing the Worker selection criteria for any Tasks that enter this TaskQueue. :param unicode max_reserved_workers: The maximum amount of workers to create reservations for the assignment of a task while in this queue. :param TaskQueueInstance.TaskOrder task_order: TaskOrder will determine which order the Tasks will be assigned to Workers. :param unicode reservation_activity_sid: ActivitySID to assign workers once a task is reserved for them :param unicode assignment_activity_sid: ActivitySID to assign workers once a task is assigned for them :returns: Newly created TaskQueueInstance :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance """ data = values.of({ 'FriendlyName': friendly_name, 'TargetWorkers': target_workers, 'MaxReservedWorkers': max_reserved_workers, 'TaskOrder': task_order, 'ReservationActivitySid': reservation_activity_sid, 'AssignmentActivitySid': assignment_activity_sid, }) payload = self._version.create( 'POST', self._uri, data=data, ) return TaskQueueInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], )
python
{ "resource": "" }
q29241
TaskQueueList.get
train
def get(self, sid): """ Constructs a TaskQueueContext :param sid: The sid :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueContext :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueContext """ return TaskQueueContext(self._version, workspace_sid=self._solution['workspace_sid'], sid=sid, )
python
{ "resource": "" }
q29242
TaskQueuePage.get_instance
train
def get_instance(self, payload): """ Build an instance of TaskQueueInstance :param dict payload: Payload response from the API :returns: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance """ return TaskQueueInstance(self._version, payload, workspace_sid=self._solution['workspace_sid'], )
python
{ "resource": "" }
q29243
TaskQueueContext.fetch
train
def fetch(self): """ Fetch a TaskQueueInstance :returns: Fetched TaskQueueInstance :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance """ params = values.of({}) payload = self._version.fetch( 'GET', self._uri, params=params, ) return TaskQueueInstance( self._version, payload, workspace_sid=self._solution['workspace_sid'], sid=self._solution['sid'], )
python
{ "resource": "" }
q29244
TaskQueueInstance.update
train
def update(self, friendly_name=values.unset, target_workers=values.unset, reservation_activity_sid=values.unset, assignment_activity_sid=values.unset, max_reserved_workers=values.unset, task_order=values.unset): """ Update the TaskQueueInstance :param unicode friendly_name: Human readable description of this TaskQueue :param unicode target_workers: A string describing the Worker selection criteria for any Tasks that enter this TaskQueue. :param unicode reservation_activity_sid: ActivitySID that will be assigned to Workers when they are reserved for a task from this TaskQueue. :param unicode assignment_activity_sid: ActivitySID that will be assigned to Workers when they are assigned a task from this TaskQueue. :param unicode max_reserved_workers: The maximum amount of workers to create reservations for the assignment of a task while in this queue. :param TaskQueueInstance.TaskOrder task_order: TaskOrder will determine which order the Tasks will be assigned to Workers. :returns: Updated TaskQueueInstance :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.TaskQueueInstance """ return self._proxy.update( friendly_name=friendly_name, target_workers=target_workers, reservation_activity_sid=reservation_activity_sid, assignment_activity_sid=assignment_activity_sid, max_reserved_workers=max_reserved_workers, task_order=task_order, )
python
{ "resource": "" }
q29245
WorkersStatisticsPage.get_instance
train
def get_instance(self, payload): """ Build an instance of WorkersStatisticsInstance :param dict payload: Payload response from the API :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsInstance :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_statistics.WorkersStatisticsInstance """ return WorkersStatisticsInstance( self._version, payload, workspace_sid=self._solution['workspace_sid'], )
python
{ "resource": "" }
q29246
UserChannelList.get
train
def get(self, channel_sid): """ Constructs a UserChannelContext :param channel_sid: The SID of the Channel that has the User Channel to fetch :returns: twilio.rest.chat.v2.service.user.user_channel.UserChannelContext :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelContext """ return UserChannelContext( self._version, service_sid=self._solution['service_sid'], user_sid=self._solution['user_sid'], channel_sid=channel_sid, )
python
{ "resource": "" }
q29247
UserChannelPage.get_instance
train
def get_instance(self, payload): """ Build an instance of UserChannelInstance :param dict payload: Payload response from the API :returns: twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance """ return UserChannelInstance( self._version, payload, service_sid=self._solution['service_sid'], user_sid=self._solution['user_sid'], )
python
{ "resource": "" }
q29248
UserChannelContext.fetch
train
def fetch(self): """ Fetch a UserChannelInstance :returns: Fetched UserChannelInstance :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance """ params = values.of({}) payload = self._version.fetch( 'GET', self._uri, params=params, ) return UserChannelInstance( self._version, payload, service_sid=self._solution['service_sid'], user_sid=self._solution['user_sid'], channel_sid=self._solution['channel_sid'], )
python
{ "resource": "" }
q29249
UserChannelContext.update
train
def update(self, notification_level): """ Update the UserChannelInstance :param UserChannelInstance.NotificationLevel notification_level: The push notification level to assign to the User Channel :returns: Updated UserChannelInstance :rtype: twilio.rest.chat.v2.service.user.user_channel.UserChannelInstance """ data = values.of({'NotificationLevel': notification_level, }) payload = self._version.update( 'POST', self._uri, data=data, ) return UserChannelInstance( self._version, payload, service_sid=self._solution['service_sid'], user_sid=self._solution['user_sid'], channel_sid=self._solution['channel_sid'], )
python
{ "resource": "" }
q29250
WorkerStatisticsList.get
train
def get(self): """ Constructs a WorkerStatisticsContext :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsContext :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsContext """ return WorkerStatisticsContext( self._version, workspace_sid=self._solution['workspace_sid'], worker_sid=self._solution['worker_sid'], )
python
{ "resource": "" }
q29251
WorkerStatisticsPage.get_instance
train
def get_instance(self, payload): """ Build an instance of WorkerStatisticsInstance :param dict payload: Payload response from the API :returns: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsInstance :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsInstance """ return WorkerStatisticsInstance( self._version, payload, workspace_sid=self._solution['workspace_sid'], worker_sid=self._solution['worker_sid'], )
python
{ "resource": "" }
q29252
WorkerStatisticsInstance.fetch
train
def fetch(self, minutes=values.unset, start_date=values.unset, end_date=values.unset, task_channel=values.unset): """ Fetch a WorkerStatisticsInstance :param unicode minutes: Filter cumulative statistics by up to 'x' minutes in the past. :param datetime start_date: Filter cumulative statistics by a start date. :param datetime end_date: Filter cumulative statistics by a end date. :param unicode task_channel: Filter cumulative statistics by TaskChannel. :returns: Fetched WorkerStatisticsInstance :rtype: twilio.rest.taskrouter.v1.workspace.worker.worker_statistics.WorkerStatisticsInstance """ return self._proxy.fetch( minutes=minutes, start_date=start_date, end_date=end_date, task_channel=task_channel, )
python
{ "resource": "" }
q29253
example
train
def example(): """ Example of using the ValidationClient for signed requests to Twilio. This is only available to enterprise customers. This will walkthrough creating an API Key, generating an RSA keypair, setting up a ValidationClient with these values and making requests with the client. """ client = Client(ACCOUNT_SID, AUTH_TOKEN) # Using Client Validation requires using API Keys for auth # First create an API key using the standard account sid, auth token client print('Creating new api key...') api_key = client.new_keys.create(friendly_name='ClientValidationApiKey') # Generate a new RSA Keypair print('Generating RSA key pair...') key_pair = rsa.generate_private_key( public_exponent=65537, key_size=2048, backend=default_backend() ) public_key = key_pair.public_key().public_bytes(Encoding.PEM, PublicFormat.SubjectPublicKeyInfo) private_key = key_pair.private_bytes(Encoding.PEM, PrivateFormat.PKCS8, NoEncryption()) # Register the public key with Twilio print('Registering public key with Twilio...') credential = client.accounts.credentials.public_key.create( public_key, friendly_name='ClientValidationPublicKey' ) # Create a new ValidationClient with the keys we created validation_client = ValidationClient( ACCOUNT_SID, api_key.sid, credential.sid, private_key ) # Create a REST Client using the validation_client client = Client(api_key.sid, api_key.secret, ACCOUNT_SID, http_client=validation_client) # Use the library as usual print('Trying out client validation...') messages = client.messages.list(limit=10) for m in messages: print('Message {}'.format(m.sid)) print('Client validation works!')
python
{ "resource": "" }
q29254
SyncMapItemList.get
train
def get(self, key): """ Constructs a SyncMapItemContext :param key: The key :returns: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemContext :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemContext """ return SyncMapItemContext( self._version, service_sid=self._solution['service_sid'], map_sid=self._solution['map_sid'], key=key, )
python
{ "resource": "" }
q29255
SyncMapItemPage.get_instance
train
def get_instance(self, payload): """ Build an instance of SyncMapItemInstance :param dict payload: Payload response from the API :returns: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance """ return SyncMapItemInstance( self._version, payload, service_sid=self._solution['service_sid'], map_sid=self._solution['map_sid'], )
python
{ "resource": "" }
q29256
SyncMapItemContext.fetch
train
def fetch(self): """ Fetch a SyncMapItemInstance :returns: Fetched SyncMapItemInstance :rtype: twilio.rest.preview.sync.service.sync_map.sync_map_item.SyncMapItemInstance """ params = values.of({}) payload = self._version.fetch( 'GET', self._uri, params=params, ) return SyncMapItemInstance( self._version, payload, service_sid=self._solution['service_sid'], map_sid=self._solution['map_sid'], key=self._solution['key'], )
python
{ "resource": "" }
q29257
ServiceContext.channels
train
def channels(self): """ Access the channels :returns: twilio.rest.chat.v2.service.channel.ChannelList :rtype: twilio.rest.chat.v2.service.channel.ChannelList """ if self._channels is None: self._channels = ChannelList(self._version, service_sid=self._solution['sid'], ) return self._channels
python
{ "resource": "" }
q29258
ServiceContext.roles
train
def roles(self): """ Access the roles :returns: twilio.rest.chat.v2.service.role.RoleList :rtype: twilio.rest.chat.v2.service.role.RoleList """ if self._roles is None: self._roles = RoleList(self._version, service_sid=self._solution['sid'], ) return self._roles
python
{ "resource": "" }
q29259
ServiceContext.users
train
def users(self): """ Access the users :returns: twilio.rest.chat.v2.service.user.UserList :rtype: twilio.rest.chat.v2.service.user.UserList """ if self._users is None: self._users = UserList(self._version, service_sid=self._solution['sid'], ) return self._users
python
{ "resource": "" }
q29260
ServiceContext.bindings
train
def bindings(self): """ Access the bindings :returns: twilio.rest.chat.v2.service.binding.BindingList :rtype: twilio.rest.chat.v2.service.binding.BindingList """ if self._bindings is None: self._bindings = BindingList(self._version, service_sid=self._solution['sid'], ) return self._bindings
python
{ "resource": "" }
q29261
ChannelList.page
train
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.v1.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)
python
{ "resource": "" }
q29262
ChannelList.get
train
def get(self, sid): """ Constructs a ChannelContext :param sid: The sid :returns: twilio.rest.chat.v1.service.channel.ChannelContext :rtype: twilio.rest.chat.v1.service.channel.ChannelContext """ return ChannelContext(self._version, service_sid=self._solution['service_sid'], sid=sid, )
python
{ "resource": "" }
q29263
ChannelPage.get_instance
train
def get_instance(self, payload): """ Build an instance of ChannelInstance :param dict payload: Payload response from the API :returns: twilio.rest.chat.v1.service.channel.ChannelInstance :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance """ return ChannelInstance(self._version, payload, service_sid=self._solution['service_sid'], )
python
{ "resource": "" }
q29264
ChannelContext.update
train
def update(self, friendly_name=values.unset, unique_name=values.unset, attributes=values.unset): """ Update the ChannelInstance :param unicode friendly_name: A human-readable name for the Channel. :param unicode unique_name: A unique, addressable name for the Channel. :param unicode attributes: An optional metadata field you can use to store any data you wish. :returns: Updated ChannelInstance :rtype: twilio.rest.chat.v1.service.channel.ChannelInstance """ data = values.of({ 'FriendlyName': friendly_name, 'UniqueName': unique_name, 'Attributes': attributes, }) payload = self._version.update( 'POST', self._uri, data=data, ) return ChannelInstance( self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], )
python
{ "resource": "" }
q29265
ChannelContext.invites
train
def invites(self): """ Access the invites :returns: twilio.rest.chat.v1.service.channel.invite.InviteList :rtype: twilio.rest.chat.v1.service.channel.invite.InviteList """ if self._invites is None: self._invites = InviteList( self._version, service_sid=self._solution['service_sid'], channel_sid=self._solution['sid'], ) return self._invites
python
{ "resource": "" }
q29266
ApplicationList.create
train
def create(self, friendly_name, api_version=values.unset, voice_url=values.unset, voice_method=values.unset, voice_fallback_url=values.unset, voice_fallback_method=values.unset, status_callback=values.unset, status_callback_method=values.unset, voice_caller_id_lookup=values.unset, sms_url=values.unset, sms_method=values.unset, sms_fallback_url=values.unset, sms_fallback_method=values.unset, sms_status_callback=values.unset, message_status_callback=values.unset): """ Create a new ApplicationInstance :param unicode friendly_name: A string to describe the new resource :param unicode api_version: The API version to use to start a new TwiML session :param unicode voice_url: The URL to call when the phone number receives a call :param unicode voice_method: The HTTP method to use with the voice_url :param unicode voice_fallback_url: The URL to call when a TwiML error occurs :param unicode voice_fallback_method: The HTTP method to use with voice_fallback_url :param unicode status_callback: The URL to send status information to your application :param unicode status_callback_method: The HTTP method to use to call status_callback :param bool voice_caller_id_lookup: Whether to lookup the caller's name :param unicode sms_url: The URL to call when the phone number receives an incoming SMS message :param unicode sms_method: The HTTP method to use with sms_url :param unicode sms_fallback_url: The URL to call when an error occurs while retrieving or executing the TwiML :param unicode sms_fallback_method: The HTTP method to use with sms_fallback_url :param unicode sms_status_callback: The URL to send status information to your application :param unicode message_status_callback: The URL to send message status information to your application :returns: Newly created ApplicationInstance :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance """ data = values.of({ 'FriendlyName': friendly_name, 'ApiVersion': api_version, 'VoiceUrl': voice_url, 'VoiceMethod': voice_method, 'VoiceFallbackUrl': voice_fallback_url, 'VoiceFallbackMethod': voice_fallback_method, 'StatusCallback': status_callback, 'StatusCallbackMethod': status_callback_method, 'VoiceCallerIdLookup': voice_caller_id_lookup, 'SmsUrl': sms_url, 'SmsMethod': sms_method, 'SmsFallbackUrl': sms_fallback_url, 'SmsFallbackMethod': sms_fallback_method, 'SmsStatusCallback': sms_status_callback, 'MessageStatusCallback': message_status_callback, }) payload = self._version.create( 'POST', self._uri, data=data, ) return ApplicationInstance(self._version, payload, account_sid=self._solution['account_sid'], )
python
{ "resource": "" }
q29267
ApplicationList.get
train
def get(self, sid): """ Constructs a ApplicationContext :param sid: The unique string that identifies the resource :returns: twilio.rest.api.v2010.account.application.ApplicationContext :rtype: twilio.rest.api.v2010.account.application.ApplicationContext """ return ApplicationContext(self._version, account_sid=self._solution['account_sid'], sid=sid, )
python
{ "resource": "" }
q29268
ApplicationPage.get_instance
train
def get_instance(self, payload): """ Build an instance of ApplicationInstance :param dict payload: Payload response from the API :returns: twilio.rest.api.v2010.account.application.ApplicationInstance :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance """ return ApplicationInstance(self._version, payload, account_sid=self._solution['account_sid'], )
python
{ "resource": "" }
q29269
ApplicationInstance.update
train
def update(self, friendly_name=values.unset, api_version=values.unset, voice_url=values.unset, voice_method=values.unset, voice_fallback_url=values.unset, voice_fallback_method=values.unset, status_callback=values.unset, status_callback_method=values.unset, voice_caller_id_lookup=values.unset, sms_url=values.unset, sms_method=values.unset, sms_fallback_url=values.unset, sms_fallback_method=values.unset, sms_status_callback=values.unset, message_status_callback=values.unset): """ Update the ApplicationInstance :param unicode friendly_name: A string to describe the resource :param unicode api_version: The API version to use to start a new TwiML session :param unicode voice_url: The URL to call when the phone number receives a call :param unicode voice_method: The HTTP method to use with the voice_url :param unicode voice_fallback_url: The URL to call when a TwiML error occurs :param unicode voice_fallback_method: The HTTP method to use with voice_fallback_url :param unicode status_callback: The URL to send status information to your application :param unicode status_callback_method: The HTTP method to use to call status_callback :param bool voice_caller_id_lookup: Whether to lookup the caller's name :param unicode sms_url: The URL to call when the phone number receives an incoming SMS message :param unicode sms_method: The HTTP method to use with sms_url :param unicode sms_fallback_url: The URL to call when an error occurs while retrieving or executing the TwiML :param unicode sms_fallback_method: The HTTP method to use with sms_fallback_url :param unicode sms_status_callback: The URL to send status information to your application :param unicode message_status_callback: The URL to send message status information to your application :returns: Updated ApplicationInstance :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance """ return self._proxy.update( friendly_name=friendly_name, api_version=api_version, voice_url=voice_url, voice_method=voice_method, voice_fallback_url=voice_fallback_url, voice_fallback_method=voice_fallback_method, status_callback=status_callback, status_callback_method=status_callback_method, voice_caller_id_lookup=voice_caller_id_lookup, sms_url=sms_url, sms_method=sms_method, sms_fallback_url=sms_fallback_url, sms_fallback_method=sms_fallback_method, sms_status_callback=sms_status_callback, message_status_callback=message_status_callback, )
python
{ "resource": "" }
q29270
VoiceList.numbers
train
def numbers(self): """ Access the numbers :returns: twilio.rest.pricing.v1.voice.number.NumberList :rtype: twilio.rest.pricing.v1.voice.number.NumberList """ if self._numbers is None: self._numbers = NumberList(self._version, ) return self._numbers
python
{ "resource": "" }
q29271
ShortCodeList.create
train
def create(self, sid): """ Create a new ShortCodeInstance :param unicode sid: The SID of a Twilio ShortCode resource :returns: Newly created ShortCodeInstance :rtype: twilio.rest.proxy.v1.service.short_code.ShortCodeInstance """ data = values.of({'Sid': sid, }) payload = self._version.create( 'POST', self._uri, data=data, ) return ShortCodeInstance(self._version, payload, service_sid=self._solution['service_sid'], )
python
{ "resource": "" }
q29272
ExportContext.fetch
train
def fetch(self): """ Fetch a ExportInstance :returns: Fetched ExportInstance :rtype: twilio.rest.preview.bulk_exports.export.ExportInstance """ params = values.of({}) payload = self._version.fetch( 'GET', self._uri, params=params, ) return ExportInstance(self._version, payload, resource_type=self._solution['resource_type'], )
python
{ "resource": "" }
q29273
ExportContext.days
train
def days(self): """ Access the days :returns: twilio.rest.preview.bulk_exports.export.day.DayList :rtype: twilio.rest.preview.bulk_exports.export.day.DayList """ if self._days is None: self._days = DayList(self._version, resource_type=self._solution['resource_type'], ) return self._days
python
{ "resource": "" }
q29274
MessageInteractionList.create
train
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'], )
python
{ "resource": "" }
q29275
MessageInteractionPage.get_instance
train
def get_instance(self, payload): """ Build an instance of MessageInteractionInstance :param dict payload: Payload response from the API :returns: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionInstance :rtype: twilio.rest.proxy.v1.service.session.participant.message_interaction.MessageInteractionInstance """ return MessageInteractionInstance( self._version, payload, service_sid=self._solution['service_sid'], session_sid=self._solution['session_sid'], participant_sid=self._solution['participant_sid'], )
python
{ "resource": "" }
q29276
SimList.stream
train
def stream(self, status=values.unset, iccid=values.unset, rate_plan=values.unset, e_id=values.unset, sim_registration_code=values.unset, limit=None, page_size=None): """ Streams SimInstance records from the API as a generator stream. This operation lazily loads records as efficiently as possible until the limit is reached. The results are returned as a generator, so this operation is memory efficient. :param unicode status: The status :param unicode iccid: The iccid :param unicode rate_plan: The rate_plan :param unicode e_id: The e_id :param unicode sim_registration_code: The sim_registration_code :param int limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param int page_size: Number of records to fetch per request, when not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000) :returns: Generator that will yield up to limit results :rtype: list[twilio.rest.preview.wireless.sim.SimInstance] """ limits = self._version.read_limits(limit, page_size) page = self.page( status=status, iccid=iccid, rate_plan=rate_plan, e_id=e_id, sim_registration_code=sim_registration_code, page_size=limits['page_size'], ) return self._version.stream(page, limits['limit'], limits['page_limit'])
python
{ "resource": "" }
q29277
SimList.page
train
def page(self, status=values.unset, iccid=values.unset, rate_plan=values.unset, e_id=values.unset, sim_registration_code=values.unset, page_token=values.unset, page_number=values.unset, page_size=values.unset): """ Retrieve a single page of SimInstance records from the API. Request is executed immediately :param unicode status: The status :param unicode iccid: The iccid :param unicode rate_plan: The rate_plan :param unicode e_id: The e_id :param unicode sim_registration_code: The sim_registration_code :param str page_token: PageToken provided by the API :param int page_number: Page Number, this value is simply for client state :param int page_size: Number of records to return, defaults to 50 :returns: Page of SimInstance :rtype: twilio.rest.preview.wireless.sim.SimPage """ params = values.of({ 'Status': status, 'Iccid': iccid, 'RatePlan': rate_plan, 'EId': e_id, 'SimRegistrationCode': sim_registration_code, 'PageToken': page_token, 'Page': page_number, 'PageSize': page_size, }) response = self._version.page( 'GET', self._uri, params=params, ) return SimPage(self._version, response, self._solution)
python
{ "resource": "" }
q29278
RoleList.create
train
def create(self, friendly_name, type, permission): """ Create a new RoleInstance :param unicode friendly_name: A string to describe the new resource :param RoleInstance.RoleType type: The type of role :param unicode permission: A permission the role should have :returns: Newly created RoleInstance :rtype: twilio.rest.chat.v2.service.role.RoleInstance """ data = values.of({ 'FriendlyName': friendly_name, 'Type': type, 'Permission': serialize.map(permission, lambda e: e), }) payload = self._version.create( 'POST', self._uri, data=data, ) return RoleInstance(self._version, payload, service_sid=self._solution['service_sid'], )
python
{ "resource": "" }
q29279
RoleList.get
train
def get(self, sid): """ Constructs a RoleContext :param sid: The unique string that identifies the resource :returns: twilio.rest.chat.v2.service.role.RoleContext :rtype: twilio.rest.chat.v2.service.role.RoleContext """ return RoleContext(self._version, service_sid=self._solution['service_sid'], sid=sid, )
python
{ "resource": "" }
q29280
RolePage.get_instance
train
def get_instance(self, payload): """ Build an instance of RoleInstance :param dict payload: Payload response from the API :returns: twilio.rest.chat.v2.service.role.RoleInstance :rtype: twilio.rest.chat.v2.service.role.RoleInstance """ return RoleInstance(self._version, payload, service_sid=self._solution['service_sid'], )
python
{ "resource": "" }
q29281
RoleContext.update
train
def update(self, permission): """ Update the RoleInstance :param unicode permission: A permission the role should have :returns: Updated RoleInstance :rtype: twilio.rest.chat.v2.service.role.RoleInstance """ data = values.of({'Permission': serialize.map(permission, lambda e: e), }) payload = self._version.update( 'POST', self._uri, data=data, ) return RoleInstance( self._version, payload, service_sid=self._solution['service_sid'], sid=self._solution['sid'], )
python
{ "resource": "" }
q29282
StepList.get
train
def get(self, sid): """ Constructs a StepContext :param sid: Step Sid. :returns: twilio.rest.studio.v1.flow.engagement.step.StepContext :rtype: twilio.rest.studio.v1.flow.engagement.step.StepContext """ return StepContext( self._version, flow_sid=self._solution['flow_sid'], engagement_sid=self._solution['engagement_sid'], sid=sid, )
python
{ "resource": "" }
q29283
StepPage.get_instance
train
def get_instance(self, payload): """ Build an instance of StepInstance :param dict payload: Payload response from the API :returns: twilio.rest.studio.v1.flow.engagement.step.StepInstance :rtype: twilio.rest.studio.v1.flow.engagement.step.StepInstance """ return StepInstance( self._version, payload, flow_sid=self._solution['flow_sid'], engagement_sid=self._solution['engagement_sid'], )
python
{ "resource": "" }
q29284
StepContext.fetch
train
def fetch(self): """ Fetch a StepInstance :returns: Fetched StepInstance :rtype: twilio.rest.studio.v1.flow.engagement.step.StepInstance """ params = values.of({}) payload = self._version.fetch( 'GET', self._uri, params=params, ) return StepInstance( self._version, payload, flow_sid=self._solution['flow_sid'], engagement_sid=self._solution['engagement_sid'], sid=self._solution['sid'], )
python
{ "resource": "" }
q29285
example
train
def example(): """ Some example usage of different twilio resources. """ client = Client(ACCOUNT_SID, AUTH_TOKEN) # Get all messages all_messages = client.messages.list() print('There are {} messages in your account.'.format(len(all_messages))) # Get only last 10 messages... some_messages = client.messages.list(limit=10) print('Here are the last 10 messages in your account:') for m in some_messages: print(m) # Get messages in smaller pages... all_messages = client.messages.list(page_size=10) print('There are {} messages in your account.'.format(len(all_messages))) print('Sending a message...') new_message = client.messages.create(to='XXXX', from_='YYYY', body='Twilio rocks!') print('Making a call...') new_call = client.calls.create(to='XXXX', from_='YYYY', method='GET') print('Serving TwiML') twiml_response = VoiceResponse() twiml_response.say('Hello!') twiml_response.hangup() twiml_xml = twiml_response.to_xml() print('Generated twiml: {}'.format(twiml_xml))
python
{ "resource": "" }
q29286
WorkflowRealTimeStatisticsList.get
train
def get(self): """ Constructs a WorkflowRealTimeStatisticsContext :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsContext :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsContext """ return WorkflowRealTimeStatisticsContext( self._version, workspace_sid=self._solution['workspace_sid'], workflow_sid=self._solution['workflow_sid'], )
python
{ "resource": "" }
q29287
WorkflowRealTimeStatisticsPage.get_instance
train
def get_instance(self, payload): """ Build an instance of WorkflowRealTimeStatisticsInstance :param dict payload: Payload response from the API :returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsInstance :rtype: twilio.rest.taskrouter.v1.workspace.workflow.workflow_real_time_statistics.WorkflowRealTimeStatisticsInstance """ return WorkflowRealTimeStatisticsInstance( self._version, payload, workspace_sid=self._solution['workspace_sid'], workflow_sid=self._solution['workflow_sid'], )
python
{ "resource": "" }
q29288
ServiceContext.environments
train
def environments(self): """ Access the environments :returns: twilio.rest.serverless.v1.service.environment.EnvironmentList :rtype: twilio.rest.serverless.v1.service.environment.EnvironmentList """ if self._environments is None: self._environments = EnvironmentList(self._version, service_sid=self._solution['sid'], ) return self._environments
python
{ "resource": "" }
q29289
ServiceContext.functions
train
def functions(self): """ Access the functions :returns: twilio.rest.serverless.v1.service.function.FunctionList :rtype: twilio.rest.serverless.v1.service.function.FunctionList """ if self._functions is None: self._functions = FunctionList(self._version, service_sid=self._solution['sid'], ) return self._functions
python
{ "resource": "" }
q29290
ServiceContext.assets
train
def assets(self): """ Access the assets :returns: twilio.rest.serverless.v1.service.asset.AssetList :rtype: twilio.rest.serverless.v1.service.asset.AssetList """ if self._assets is None: self._assets = AssetList(self._version, service_sid=self._solution['sid'], ) return self._assets
python
{ "resource": "" }
q29291
ServiceContext.builds
train
def builds(self): """ Access the builds :returns: twilio.rest.serverless.v1.service.build.BuildList :rtype: twilio.rest.serverless.v1.service.build.BuildList """ if self._builds is None: self._builds = BuildList(self._version, service_sid=self._solution['sid'], ) return self._builds
python
{ "resource": "" }
q29292
AuthCallsCredentialListMappingList.create
train
def create(self, credential_list_sid): """ Create a new AuthCallsCredentialListMappingInstance :param unicode credential_list_sid: The SID of the CredentialList resource to map to the SIP domain :returns: Newly created AuthCallsCredentialListMappingInstance :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingInstance """ data = values.of({'CredentialListSid': credential_list_sid, }) payload = self._version.create( 'POST', self._uri, data=data, ) return AuthCallsCredentialListMappingInstance( self._version, payload, account_sid=self._solution['account_sid'], domain_sid=self._solution['domain_sid'], )
python
{ "resource": "" }
q29293
AuthCallsCredentialListMappingList.get
train
def get(self, sid): """ Constructs a AuthCallsCredentialListMappingContext :param sid: The unique string that identifies the resource :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingContext :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingContext """ return AuthCallsCredentialListMappingContext( self._version, account_sid=self._solution['account_sid'], domain_sid=self._solution['domain_sid'], sid=sid, )
python
{ "resource": "" }
q29294
AuthCallsCredentialListMappingPage.get_instance
train
def get_instance(self, payload): """ Build an instance of AuthCallsCredentialListMappingInstance :param dict payload: Payload response from the API :returns: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingInstance :rtype: twilio.rest.api.v2010.account.sip.domain.auth_types.auth_calls_mapping.auth_calls_credential_list_mapping.AuthCallsCredentialListMappingInstance """ return AuthCallsCredentialListMappingInstance( self._version, payload, account_sid=self._solution['account_sid'], domain_sid=self._solution['domain_sid'], )
python
{ "resource": "" }
q29295
TaskQueueCumulativeStatisticsList.get
train
def get(self): """ Constructs a TaskQueueCumulativeStatisticsContext :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsContext :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsContext """ return TaskQueueCumulativeStatisticsContext( self._version, workspace_sid=self._solution['workspace_sid'], task_queue_sid=self._solution['task_queue_sid'], )
python
{ "resource": "" }
q29296
TaskQueueCumulativeStatisticsPage.get_instance
train
def get_instance(self, payload): """ Build an instance of TaskQueueCumulativeStatisticsInstance :param dict payload: Payload response from the API :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsInstance :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics.TaskQueueCumulativeStatisticsInstance """ return TaskQueueCumulativeStatisticsInstance( self._version, payload, workspace_sid=self._solution['workspace_sid'], task_queue_sid=self._solution['task_queue_sid'], )
python
{ "resource": "" }
q29297
FieldTypeList.get
train
def get(self, sid): """ Constructs a FieldTypeContext :param sid: The unique string that identifies the resource :returns: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeContext :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeContext """ return FieldTypeContext(self._version, assistant_sid=self._solution['assistant_sid'], sid=sid, )
python
{ "resource": "" }
q29298
FieldTypePage.get_instance
train
def get_instance(self, payload): """ Build an instance of FieldTypeInstance :param dict payload: Payload response from the API :returns: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeInstance :rtype: twilio.rest.autopilot.v1.assistant.field_type.FieldTypeInstance """ return FieldTypeInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], )
python
{ "resource": "" }
q29299
FieldTypeContext.field_values
train
def field_values(self): """ Access the field_values :returns: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueList :rtype: twilio.rest.autopilot.v1.assistant.field_type.field_value.FieldValueList """ if self._field_values is None: self._field_values = FieldValueList( self._version, assistant_sid=self._solution['assistant_sid'], field_type_sid=self._solution['sid'], ) return self._field_values
python
{ "resource": "" }