本文整理汇总了Python中twilio.base.serialize.map函数的典型用法代码示例。如果您正苦于以下问题:Python map函数的具体用法?Python map怎么用?Python map使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了map函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: page
def page(self, binding_type=values.unset, identity=values.unset,
page_token=values.unset, page_number=values.unset,
page_size=values.unset):
"""
Retrieve a single page of BindingInstance records from the API.
Request is executed immediately
:param BindingInstance.BindingType binding_type: The push technology used for the bindings returned.
:param unicode identity: The identity
:param str page_token: PageToken provided by the API
:param int page_number: Page Number, this value is simply for client state
:param int page_size: Number of records to return, defaults to 50
:returns: Page of BindingInstance
:rtype: twilio.rest.chat.v2.service.binding.BindingPage
"""
params = values.of({
'BindingType': serialize.map(binding_type, lambda e: e),
'Identity': serialize.map(identity, lambda e: e),
'PageToken': page_token,
'Page': page_number,
'PageSize': page_size,
})
response = self._version.page(
'GET',
self._uri,
params=params,
)
return BindingPage(self._version, response, self._solution)
示例2: fetch
def fetch(self, country_code=values.unset, type=values.unset,
add_ons=values.unset, add_ons_data=values.unset):
"""
Fetch a PhoneNumberInstance
:param unicode country_code: The ISO country code of the phone number
:param unicode type: The type of information to return
:param unicode add_ons: The unique_name of an Add-on you would like to invoke
:param dict add_ons_data: Data specific to the add-on you would like to invoke
:returns: Fetched PhoneNumberInstance
:rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberInstance
"""
params = values.of({
'CountryCode': country_code,
'Type': serialize.map(type, lambda e: e),
'AddOns': serialize.map(add_ons, lambda e: e),
})
params.update(serialize.prefixed_collapsible_map(add_ons_data, 'AddOns'))
payload = self._version.fetch(
'GET',
self._uri,
params=params,
)
return PhoneNumberInstance(self._version, payload, phone_number=self._solution['phone_number'], )
示例3: page
def page(self, start_date=values.unset, end_date=values.unset,
identity=values.unset, tag=values.unset, page_token=values.unset,
page_number=values.unset, page_size=values.unset):
"""
Retrieve a single page of BindingInstance records from the API.
Request is executed immediately
:param date start_date: Only list Bindings created on or after the given date.
:param date end_date: Only list Bindings created on or before the given date.
:param unicode identity: Only list Bindings that have any of the specified Identities.
:param unicode tag: Only list Bindings that have all of the specified Tags.
:param str page_token: PageToken provided by the API
:param int page_number: Page Number, this value is simply for client state
:param int page_size: Number of records to return, defaults to 50
:returns: Page of BindingInstance
:rtype: twilio.rest.notify.v1.service.binding.BindingPage
"""
params = values.of({
'StartDate': serialize.iso8601_date(start_date),
'EndDate': serialize.iso8601_date(end_date),
'Identity': serialize.map(identity, lambda e: e),
'Tag': serialize.map(tag, lambda e: e),
'PageToken': page_token,
'Page': page_number,
'PageSize': page_size,
})
response = self._version.page(
'GET',
self._uri,
params=params,
)
return BindingPage(self._version, response, self._solution)
示例4: fetch
def fetch(self, country_code=values.unset, type=values.unset,
add_ons=values.unset, add_ons_data=values.unset):
"""
Fetch a PhoneNumberInstance
:param unicode country_code: Optional ISO country code of the phone number.
:param unicode type: Indicates the type of information you would like returned with your request.
:param unicode add_ons: Indicates the particular Add-on you would like to use to get more information.
:param dict add_ons_data: The add_ons_data
:returns: Fetched PhoneNumberInstance
:rtype: twilio.rest.lookups.v1.phone_number.PhoneNumberInstance
"""
params = values.of({
'CountryCode': country_code,
'Type': serialize.map(type, lambda e: e),
'AddOns': serialize.map(add_ons, lambda e: e),
})
params.update(serialize.prefixed_collapsible_map(add_ons_data, 'AddOns'))
payload = self._version.fetch(
'GET',
self._uri,
params=params,
)
return PhoneNumberInstance(self._version, payload, phone_number=self._solution['phone_number'], )
示例5: create
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'], )
示例6: create
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'], )
示例7: test_does_not_change_other_types
def test_does_not_change_other_types(self):
actual = serialize.map("abc", lambda e: e * 2)
self.assertEqual("abc", actual)
actual = serialize.map(123, lambda e: e * 2)
self.assertEqual(123, actual)
actual = serialize.map({'some': 'val'}, lambda e: e * 2)
self.assertEqual({'some': 'val'}, actual)
示例8: create
def create(self, phone_number, sms_capability, account_sid=values.unset,
friendly_name=values.unset, unique_name=values.unset,
cc_emails=values.unset, sms_url=values.unset,
sms_method=values.unset, sms_fallback_url=values.unset,
sms_fallback_method=values.unset, status_callback_url=values.unset,
status_callback_method=values.unset,
sms_application_sid=values.unset, address_sid=values.unset,
email=values.unset, verification_type=values.unset,
verification_document_sid=values.unset):
"""
Create a new HostedNumberOrderInstance
:param unicode phone_number: An E164 formatted phone number.
:param bool sms_capability: Specify SMS capability to host.
:param unicode account_sid: Account Sid.
:param unicode friendly_name: A human readable description of this resource.
:param unicode unique_name: A unique, developer assigned name of this HostedNumberOrder.
:param unicode cc_emails: A list of emails.
:param unicode sms_url: SMS URL.
:param unicode sms_method: SMS Method.
:param unicode sms_fallback_url: SMS Fallback URL.
:param unicode sms_fallback_method: SMS Fallback Method.
:param unicode status_callback_url: Status Callback URL.
:param unicode status_callback_method: Status Callback Method.
:param unicode sms_application_sid: SMS Application Sid.
:param unicode address_sid: Address sid.
:param unicode email: Email.
:param HostedNumberOrderInstance.VerificationType verification_type: Verification Type.
:param unicode verification_document_sid: Verification Document Sid
:returns: Newly created HostedNumberOrderInstance
:rtype: twilio.rest.preview.hosted_numbers.hosted_number_order.HostedNumberOrderInstance
"""
data = values.of({
'PhoneNumber': phone_number,
'SmsCapability': sms_capability,
'AccountSid': account_sid,
'FriendlyName': friendly_name,
'UniqueName': unique_name,
'CcEmails': serialize.map(cc_emails, lambda e: e),
'SmsUrl': sms_url,
'SmsMethod': sms_method,
'SmsFallbackUrl': sms_fallback_url,
'SmsFallbackMethod': sms_fallback_method,
'StatusCallbackUrl': status_callback_url,
'StatusCallbackMethod': status_callback_method,
'SmsApplicationSid': sms_application_sid,
'AddressSid': address_sid,
'Email': email,
'VerificationType': verification_type,
'VerificationDocumentSid': verification_document_sid,
})
payload = self._version.create(
'POST',
self._uri,
data=data,
)
return HostedNumberOrderInstance(self._version, payload, )
示例9: update
def update(self, webhook_method=values.unset, webhook_filters=values.unset,
pre_webhook_url=values.unset, post_webhook_url=values.unset,
pre_webhook_retry_count=values.unset,
post_webhook_retry_count=values.unset, target=values.unset):
"""
Update the WebhookInstance
:param unicode webhook_method: The HTTP method to be used when sending a webhook request.
:param unicode webhook_filters: The list of webhook event triggers that are enabled for this Service.
:param unicode pre_webhook_url: The absolute url the pre-event webhook request should be sent to.
:param unicode post_webhook_url: The absolute url the post-event webhook request should be sent to.
:param unicode pre_webhook_retry_count: The number of retries in case of pre-event webhook request failures.
:param unicode post_webhook_retry_count: The number of retries in case of post-event webhook request failures.
:param WebhookInstance.Target target: The routing target of the webhook.
:returns: Updated WebhookInstance
:rtype: twilio.rest.messaging.v1.webhook.WebhookInstance
"""
data = values.of({
'WebhookMethod': webhook_method,
'WebhookFilters': serialize.map(webhook_filters, lambda e: e),
'PreWebhookUrl': pre_webhook_url,
'PostWebhookUrl': post_webhook_url,
'PreWebhookRetryCount': pre_webhook_retry_count,
'PostWebhookRetryCount': post_webhook_retry_count,
'Target': target,
})
payload = self._version.update(
'POST',
self._uri,
data=data,
)
return WebhookInstance(self._version, payload, )
示例10: page
def page(self, identity=values.unset, page_token=values.unset,
page_number=values.unset, page_size=values.unset):
"""
Retrieve a single page of InviteInstance records from the API.
Request is executed immediately
:param unicode identity: A unique string identifier for this User in this Service.
:param str page_token: PageToken provided by the API
:param int page_number: Page Number, this value is simply for client state
:param int page_size: Number of records to return, defaults to 50
:returns: Page of InviteInstance
:rtype: twilio.rest.chat.v1.service.channel.invite.InvitePage
"""
params = values.of({
'Identity': serialize.map(identity, lambda e: e),
'PageToken': page_token,
'Page': page_number,
'PageSize': page_size,
})
response = self._version.page(
'GET',
self._uri,
params=params,
)
return InvitePage(self._version, response, self._solution)
示例11: update
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'],
)
示例12: create
def create(self, identity, binding_type, address, tag=values.unset,
notification_protocol_version=values.unset,
credential_sid=values.unset, endpoint=values.unset):
"""
Create a new BindingInstance
:param unicode identity: The `identity` value that identifies the new resource's User
:param BindingInstance.BindingType binding_type: The type of the Binding
:param unicode address: The channel-specific address
:param unicode tag: A tag that can be used to select the Bindings to notify
:param unicode notification_protocol_version: The protocol version to use to send the notification
:param unicode credential_sid: The SID of the Credential resource to be used to send notifications to this Binding
:param unicode endpoint: Deprecated
:returns: Newly created BindingInstance
:rtype: twilio.rest.notify.v1.service.binding.BindingInstance
"""
data = values.of({
'Identity': identity,
'BindingType': binding_type,
'Address': address,
'Tag': serialize.map(tag, lambda e: e),
'NotificationProtocolVersion': notification_protocol_version,
'CredentialSid': credential_sid,
'Endpoint': endpoint,
})
payload = self._version.create(
'POST',
self._uri,
data=data,
)
return BindingInstance(self._version, payload, service_sid=self._solution['service_sid'], )
示例13: create
def create(self, identity, binding_type, address, tag=values.unset,
notification_protocol_version=values.unset,
credential_sid=values.unset, endpoint=values.unset):
"""
Create a new BindingInstance
:param unicode identity: The Identity to which this Binding belongs to.
:param BindingInstance.BindingType binding_type: The type of the Binding.
:param unicode address: The address specific to the channel.
:param unicode tag: The list of tags associated with this Binding.
:param unicode notification_protocol_version: The version of the protocol used to send the notification.
:param unicode credential_sid: The unique identifier of the Credential resource to be used to send notifications to this Binding.
:param unicode endpoint: DEPRECATED*
:returns: Newly created BindingInstance
:rtype: twilio.rest.notify.v1.service.binding.BindingInstance
"""
data = values.of({
'Identity': identity,
'BindingType': binding_type,
'Address': address,
'Tag': serialize.map(tag, lambda e: e),
'NotificationProtocolVersion': notification_protocol_version,
'CredentialSid': credential_sid,
'Endpoint': endpoint,
})
payload = self._version.create(
'POST',
self._uri,
data=data,
)
return BindingInstance(self._version, payload, service_sid=self._solution['service_sid'], )
示例14: page
def page(self, start_date=values.unset, end_date=values.unset, tag=values.unset,
page_token=values.unset, page_number=values.unset,
page_size=values.unset):
"""
Retrieve a single page of UserBindingInstance records from the API.
Request is executed immediately
:param date start_date: The start_date
:param date end_date: The end_date
:param unicode tag: The tag
:param str page_token: PageToken provided by the API
:param int page_number: Page Number, this value is simply for client state
:param int page_size: Number of records to return, defaults to 50
:returns: Page of UserBindingInstance
:rtype: twilio.rest.notify.v1.service.user.user_binding.UserBindingPage
"""
params = values.of({
'StartDate': serialize.iso8601_date(start_date),
'EndDate': serialize.iso8601_date(end_date),
'Tag': serialize.map(tag, lambda e: e),
'PageToken': page_token,
'Page': page_number,
'PageSize': page_size,
})
response = self._version.page(
'GET',
self._uri,
params=params,
)
return UserBindingPage(self._version, response, self._solution)
示例15: update
def update(self, unique_name=values.unset, ttl=values.unset,
status=values.unset, participants=values.unset):
"""
Update the SessionInstance
:param unicode unique_name: A unique, developer assigned name of this Session.
:param unicode ttl: How long will this session stay open, in seconds.
:param SessionInstance.Status status: The Status of this Session
:param unicode participants: The participants
:returns: Updated SessionInstance
:rtype: twilio.rest.preview.proxy.service.session.SessionInstance
"""
data = values.of({
'UniqueName': unique_name,
'Ttl': ttl,
'Status': status,
'Participants': serialize.map(participants, lambda e: e),
})
payload = self._version.update(
'POST',
self._uri,
data=data,
)
return SessionInstance(
self._version,
payload,
service_sid=self._solution['service_sid'],
sid=self._solution['sid'],
)